comparison ym2612.h @ 380:1c8d74f2ab0b

Make the PSG and YM2612 use the master clock internal with an increment based on clock divider so that they stay perflectly in sync. Run both the PSG and YM2612 whenver one of them needs to be run.
author Mike Pavone <pavone@retrodev.com>
date Mon, 03 Jun 2013 21:43:38 -0700
parents 0f8a759f1ff4
children 72933100c55c
comparison
equal deleted inserted replaced
379:3218e2f8d685 380:1c8d74f2ab0b
37 typedef struct { 37 typedef struct {
38 int16_t *audio_buffer; 38 int16_t *audio_buffer;
39 int16_t *back_buffer; 39 int16_t *back_buffer;
40 double buffer_fraction; 40 double buffer_fraction;
41 double buffer_inc; 41 double buffer_inc;
42 uint32_t clock_inc;
42 uint32_t buffer_pos; 43 uint32_t buffer_pos;
43 uint32_t sample_limit; 44 uint32_t sample_limit;
44 uint32_t current_cycle; 45 uint32_t current_cycle;
45 uint32_t write_cycle; 46 uint32_t write_cycle;
46 ym_operator operators[NUM_OPERATORS]; 47 ym_operator operators[NUM_OPERATORS];
57 uint8_t status; 58 uint8_t status;
58 uint8_t selected_reg; 59 uint8_t selected_reg;
59 uint8_t selected_part; 60 uint8_t selected_part;
60 } ym2612_context; 61 } ym2612_context;
61 62
62 void ym_init(ym2612_context * context, uint32_t sample_rate, uint32_t clock_rate, uint32_t sample_limit); 63 void ym_init(ym2612_context * context, uint32_t sample_rate, uint32_t master_clock, uint32_t clock_div, uint32_t sample_limit);
63 void ym_run(ym2612_context * context, uint32_t to_cycle); 64 void ym_run(ym2612_context * context, uint32_t to_cycle);
64 void ym_address_write_part1(ym2612_context * context, uint8_t address); 65 void ym_address_write_part1(ym2612_context * context, uint8_t address);
65 void ym_address_write_part2(ym2612_context * context, uint8_t address); 66 void ym_address_write_part2(ym2612_context * context, uint8_t address);
66 void ym_data_write(ym2612_context * context, uint8_t value); 67 void ym_data_write(ym2612_context * context, uint8_t value);
67 uint8_t ym_read_status(ym2612_context * context); 68 uint8_t ym_read_status(ym2612_context * context);