comparison psg.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 62177cc39049
children 140af5509ce7
comparison
equal deleted inserted replaced
379:3218e2f8d685 380:1c8d74f2ab0b
7 int16_t *audio_buffer; 7 int16_t *audio_buffer;
8 int16_t *back_buffer; 8 int16_t *back_buffer;
9 double buffer_fraction; 9 double buffer_fraction;
10 double buffer_inc; 10 double buffer_inc;
11 uint32_t buffer_pos; 11 uint32_t buffer_pos;
12 uint32_t clock_inc;
12 uint32_t cycles; 13 uint32_t cycles;
13 uint32_t samples_frame; 14 uint32_t samples_frame;
14 uint16_t lsfr; 15 uint16_t lsfr;
15 uint16_t counter_load[4]; 16 uint16_t counter_load[4];
16 uint16_t counters[4]; 17 uint16_t counters[4];
21 uint8_t noise_type; 22 uint8_t noise_type;
22 uint8_t latch; 23 uint8_t latch;
23 } psg_context; 24 } psg_context;
24 25
25 26
26 void psg_init(psg_context * context, uint32_t sample_rate, uint32_t clock_rate, uint32_t samples_frame); 27 void psg_init(psg_context * context, uint32_t sample_rate, uint32_t master_clock, uint32_t clock_div, uint32_t samples_frame);
27 void psg_write(psg_context * context, uint8_t value); 28 void psg_write(psg_context * context, uint8_t value);
28 void psg_run(psg_context * context, uint32_t cycles); 29 void psg_run(psg_context * context, uint32_t cycles);
29 30
30 #endif //PSG_CONTEXT_H_ 31 #endif //PSG_CONTEXT_H_
31 32