comparison ym2612.h @ 1555:6ce36c3f250b

More audio refactoring in preparation for allowing proper sync to video with dynamic audio rate control
author Michael Pavone <pavone@retrodev.com>
date Fri, 30 Mar 2018 00:37:08 -0700
parents ce1f93be0104
children 804f13c090b4
comparison
equal deleted inserted replaced
1554:87350caf6dab 1555:6ce36c3f250b
61 #define YM_REG_END 0xB8 61 #define YM_REG_END 0xB8
62 #define YM_PART1_REGS (YM_REG_END-YM_PART1_START) 62 #define YM_PART1_REGS (YM_REG_END-YM_PART1_START)
63 #define YM_PART2_REGS (YM_REG_END-YM_PART2_START) 63 #define YM_PART2_REGS (YM_REG_END-YM_PART2_START)
64 64
65 typedef struct { 65 typedef struct {
66 int16_t *audio_buffer;
67 audio_source *audio; 66 audio_source *audio;
68 uint64_t buffer_fraction;
69 uint64_t buffer_inc;
70 uint32_t clock_inc; 67 uint32_t clock_inc;
71 uint32_t buffer_pos;
72 uint32_t sample_rate;
73 uint32_t sample_limit;
74 uint32_t current_cycle; 68 uint32_t current_cycle;
75 //TODO: Condense the next two fields into one 69 //TODO: Condense the next two fields into one
76 uint32_t write_cycle; 70 uint32_t write_cycle;
77 uint32_t busy_cycles; 71 uint32_t busy_cycles;
78 uint32_t lowpass_alpha; 72 uint32_t lowpass_alpha;
80 ym_channel channels[NUM_CHANNELS]; 74 ym_channel channels[NUM_CHANNELS];
81 uint16_t timer_a; 75 uint16_t timer_a;
82 uint16_t timer_a_load; 76 uint16_t timer_a_load;
83 uint16_t env_counter; 77 uint16_t env_counter;
84 ym_supp ch3_supp[3]; 78 ym_supp ch3_supp[3];
85 int16_t last_left;
86 int16_t last_right;
87 uint8_t timer_b; 79 uint8_t timer_b;
88 uint8_t sub_timer_b; 80 uint8_t sub_timer_b;
89 uint8_t timer_b_load; 81 uint8_t timer_b_load;
90 uint8_t ch3_mode; 82 uint8_t ch3_mode;
91 uint8_t current_op; 83 uint8_t current_op;
130 REG_BLOCK_FN_CH3 = 0xAC, 122 REG_BLOCK_FN_CH3 = 0xAC,
131 REG_ALG_FEEDBACK = 0xB0, 123 REG_ALG_FEEDBACK = 0xB0,
132 REG_LR_AMS_PMS = 0xB4 124 REG_LR_AMS_PMS = 0xB4
133 }; 125 };
134 126
135 void ym_init(ym2612_context * context, uint32_t sample_rate, uint32_t master_clock, uint32_t clock_div, uint32_t sample_limit, uint32_t options, uint32_t lowpass_cutoff); 127 void ym_init(ym2612_context * context, uint32_t master_clock, uint32_t clock_div, uint32_t options);
136 void ym_reset(ym2612_context *context); 128 void ym_reset(ym2612_context *context);
137 void ym_free(ym2612_context *context); 129 void ym_free(ym2612_context *context);
138 void ym_adjust_master_clock(ym2612_context * context, uint32_t master_clock); 130 void ym_adjust_master_clock(ym2612_context * context, uint32_t master_clock);
139 void ym_run(ym2612_context * context, uint32_t to_cycle); 131 void ym_run(ym2612_context * context, uint32_t to_cycle);
140 void ym_address_write_part1(ym2612_context * context, uint8_t address); 132 void ym_address_write_part1(ym2612_context * context, uint8_t address);