comparison ym2612.h @ 483:3e1573fa22cf

Implement turbo/slow motion feature that overclocks or underclocks the entire system at the push of a button
author Mike Pavone <pavone@retrodev.com>
date Tue, 01 Oct 2013 23:51:16 -0700
parents 140af5509ce7
children 7df7f493b3b6
comparison
equal deleted inserted replaced
482:4b24260125f3 483:3e1573fa22cf
1 /* 1 /*
2 Copyright 2013 Michael Pavone 2 Copyright 2013 Michael Pavone
3 This file is part of BlastEm. 3 This file is part of BlastEm.
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. 4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
5 */ 5 */
6 #ifndef YM2612_H_ 6 #ifndef YM2612_H_
7 #define YM2612_H_ 7 #define YM2612_H_
8 8
57 #define YM_PART2_REGS (YM_REG_END-YM_PART2_START) 57 #define YM_PART2_REGS (YM_REG_END-YM_PART2_START)
58 58
59 typedef struct { 59 typedef struct {
60 int16_t *audio_buffer; 60 int16_t *audio_buffer;
61 int16_t *back_buffer; 61 int16_t *back_buffer;
62 double buffer_fraction; 62 uint64_t buffer_fraction;
63 double buffer_inc; 63 uint64_t buffer_inc;
64 uint32_t clock_inc; 64 uint32_t clock_inc;
65 uint32_t buffer_pos; 65 uint32_t buffer_pos;
66 uint32_t sample_rate;
66 uint32_t sample_limit; 67 uint32_t sample_limit;
67 uint32_t current_cycle; 68 uint32_t current_cycle;
68 uint32_t write_cycle; 69 uint32_t write_cycle;
69 ym_operator operators[NUM_OPERATORS]; 70 ym_operator operators[NUM_OPERATORS];
70 ym_channel channels[NUM_CHANNELS]; 71 ym_channel channels[NUM_CHANNELS];
91 uint8_t part1_regs[YM_PART1_REGS]; 92 uint8_t part1_regs[YM_PART1_REGS];
92 uint8_t part2_regs[YM_PART2_REGS]; 93 uint8_t part2_regs[YM_PART2_REGS];
93 } ym2612_context; 94 } ym2612_context;
94 95
95 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); 96 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);
97 void ym_adjust_master_clock(ym2612_context * context, uint32_t master_clock);
96 void ym_run(ym2612_context * context, uint32_t to_cycle); 98 void ym_run(ym2612_context * context, uint32_t to_cycle);
97 void ym_address_write_part1(ym2612_context * context, uint8_t address); 99 void ym_address_write_part1(ym2612_context * context, uint8_t address);
98 void ym_address_write_part2(ym2612_context * context, uint8_t address); 100 void ym_address_write_part2(ym2612_context * context, uint8_t address);
99 void ym_data_write(ym2612_context * context, uint8_t value); 101 void ym_data_write(ym2612_context * context, uint8_t value);
100 uint8_t ym_read_status(ym2612_context * context); 102 uint8_t ym_read_status(ym2612_context * context);