Mercurial > repos > blastem
comparison ym2612.h @ 1648:b7ecd0d6a77b mame_interp
Merge from default
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 25 Dec 2018 11:12:26 -0800 |
parents | 6ce36c3f250b |
children | 804f13c090b4 |
comparison
equal
deleted
inserted
replaced
1509:36732f5c2281 | 1648:b7ecd0d6a77b |
---|---|
7 #define YM2612_H_ | 7 #define YM2612_H_ |
8 | 8 |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
11 #include "serialize.h" | 11 #include "serialize.h" |
12 #include "render.h" | |
12 | 13 |
13 #define NUM_PART_REGS (0xB7-0x30) | 14 #define NUM_PART_REGS (0xB7-0x30) |
14 #define NUM_CHANNELS 6 | 15 #define NUM_CHANNELS 6 |
15 #define NUM_OPERATORS (4*NUM_CHANNELS) | 16 #define NUM_OPERATORS (4*NUM_CHANNELS) |
16 | 17 |
60 #define YM_REG_END 0xB8 | 61 #define YM_REG_END 0xB8 |
61 #define YM_PART1_REGS (YM_REG_END-YM_PART1_START) | 62 #define YM_PART1_REGS (YM_REG_END-YM_PART1_START) |
62 #define YM_PART2_REGS (YM_REG_END-YM_PART2_START) | 63 #define YM_PART2_REGS (YM_REG_END-YM_PART2_START) |
63 | 64 |
64 typedef struct { | 65 typedef struct { |
65 int16_t *audio_buffer; | 66 audio_source *audio; |
66 int16_t *back_buffer; | |
67 uint64_t buffer_fraction; | |
68 uint64_t buffer_inc; | |
69 uint32_t clock_inc; | 67 uint32_t clock_inc; |
70 uint32_t buffer_pos; | |
71 uint32_t sample_rate; | |
72 uint32_t sample_limit; | |
73 uint32_t current_cycle; | 68 uint32_t current_cycle; |
74 //TODO: Condense the next two fields into one | 69 //TODO: Condense the next two fields into one |
75 uint32_t write_cycle; | 70 uint32_t write_cycle; |
76 uint32_t busy_cycles; | 71 uint32_t busy_cycles; |
77 uint32_t lowpass_alpha; | 72 uint32_t lowpass_alpha; |
79 ym_channel channels[NUM_CHANNELS]; | 74 ym_channel channels[NUM_CHANNELS]; |
80 uint16_t timer_a; | 75 uint16_t timer_a; |
81 uint16_t timer_a_load; | 76 uint16_t timer_a_load; |
82 uint16_t env_counter; | 77 uint16_t env_counter; |
83 ym_supp ch3_supp[3]; | 78 ym_supp ch3_supp[3]; |
84 int16_t last_left; | |
85 int16_t last_right; | |
86 uint8_t timer_b; | 79 uint8_t timer_b; |
87 uint8_t sub_timer_b; | 80 uint8_t sub_timer_b; |
88 uint8_t timer_b_load; | 81 uint8_t timer_b_load; |
89 uint8_t ch3_mode; | 82 uint8_t ch3_mode; |
90 uint8_t current_op; | 83 uint8_t current_op; |
129 REG_BLOCK_FN_CH3 = 0xAC, | 122 REG_BLOCK_FN_CH3 = 0xAC, |
130 REG_ALG_FEEDBACK = 0xB0, | 123 REG_ALG_FEEDBACK = 0xB0, |
131 REG_LR_AMS_PMS = 0xB4 | 124 REG_LR_AMS_PMS = 0xB4 |
132 }; | 125 }; |
133 | 126 |
134 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); |
135 void ym_reset(ym2612_context *context); | 128 void ym_reset(ym2612_context *context); |
136 void ym_free(ym2612_context *context); | 129 void ym_free(ym2612_context *context); |
137 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); |
138 void ym_run(ym2612_context * context, uint32_t to_cycle); | 131 void ym_run(ym2612_context * context, uint32_t to_cycle); |
139 void ym_address_write_part1(ym2612_context * context, uint8_t address); | 132 void ym_address_write_part1(ym2612_context * context, uint8_t address); |