comparison ym2612.h @ 487:c08a4efeee7f opengl

Update opengl branch from default. Fix build breakage unrelated to merge
author Mike Pavone <pavone@retrodev.com>
date Sat, 26 Oct 2013 22:38:47 -0700
parents 3e1573fa22cf
children 7df7f493b3b6
comparison
equal deleted inserted replaced
449:7696d824489d 487:c08a4efeee7f
1 /*
2 Copyright 2013 Michael Pavone
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.
5 */
1 #ifndef YM2612_H_ 6 #ifndef YM2612_H_
2 #define YM2612_H_ 7 #define YM2612_H_
3 8
4 #include <stdint.h> 9 #include <stdint.h>
5 #include <stdio.h> 10 #include <stdio.h>
43 uint8_t block; 48 uint8_t block;
44 uint8_t block_fnum_latch; 49 uint8_t block_fnum_latch;
45 uint8_t keycode; 50 uint8_t keycode;
46 } ym_supp; 51 } ym_supp;
47 52
53 #define YM_PART1_START 0x21
54 #define YM_PART2_START 0x30
55 #define YM_REG_END 0xB8
56 #define YM_PART1_REGS (YM_REG_END-YM_PART1_START)
57 #define YM_PART2_REGS (YM_REG_END-YM_PART2_START)
58
48 typedef struct { 59 typedef struct {
49 int16_t *audio_buffer; 60 int16_t *audio_buffer;
50 int16_t *back_buffer; 61 int16_t *back_buffer;
51 double buffer_fraction; 62 uint64_t buffer_fraction;
52 double buffer_inc; 63 uint64_t buffer_inc;
53 uint32_t clock_inc; 64 uint32_t clock_inc;
54 uint32_t buffer_pos; 65 uint32_t buffer_pos;
66 uint32_t sample_rate;
55 uint32_t sample_limit; 67 uint32_t sample_limit;
56 uint32_t current_cycle; 68 uint32_t current_cycle;
57 uint32_t write_cycle; 69 uint32_t write_cycle;
58 ym_operator operators[NUM_OPERATORS]; 70 ym_operator operators[NUM_OPERATORS];
59 ym_channel channels[NUM_CHANNELS]; 71 ym_channel channels[NUM_CHANNELS];
64 uint16_t env_counter; 76 uint16_t env_counter;
65 ym_supp ch3_supp[3]; 77 ym_supp ch3_supp[3];
66 uint8_t ch3_mode; 78 uint8_t ch3_mode;
67 uint8_t current_op; 79 uint8_t current_op;
68 uint8_t current_env_op; 80 uint8_t current_env_op;
69 81
70 uint8_t timer_control; 82 uint8_t timer_control;
71 uint8_t dac_enable; 83 uint8_t dac_enable;
72 uint8_t lfo_enable; 84 uint8_t lfo_enable;
73 uint8_t lfo_freq; 85 uint8_t lfo_freq;
74 uint8_t lfo_counter; 86 uint8_t lfo_counter;
75 uint8_t lfo_am_step; 87 uint8_t lfo_am_step;
76 uint8_t lfo_pm_step; 88 uint8_t lfo_pm_step;
77 uint8_t status; 89 uint8_t status;
78 uint8_t selected_reg; 90 uint8_t selected_reg;
79 uint8_t selected_part; 91 uint8_t selected_part;
92 uint8_t part1_regs[YM_PART1_REGS];
93 uint8_t part2_regs[YM_PART2_REGS];
80 } ym2612_context; 94 } ym2612_context;
81 95
82 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);
83 void ym_run(ym2612_context * context, uint32_t to_cycle); 98 void ym_run(ym2612_context * context, uint32_t to_cycle);
84 void ym_address_write_part1(ym2612_context * context, uint8_t address); 99 void ym_address_write_part1(ym2612_context * context, uint8_t address);
85 void ym_address_write_part2(ym2612_context * context, uint8_t address); 100 void ym_address_write_part2(ym2612_context * context, uint8_t address);
86 void ym_data_write(ym2612_context * context, uint8_t value); 101 void ym_data_write(ym2612_context * context, uint8_t value);
87 uint8_t ym_read_status(ym2612_context * context); 102 uint8_t ym_read_status(ym2612_context * context);
88 uint8_t ym_load_gst(ym2612_context * context, FILE * gstfile); 103 uint8_t ym_load_gst(ym2612_context * context, FILE * gstfile);
104 uint8_t ym_save_gst(ym2612_context * context, FILE * gstfile);
89 105
90 #endif //YM2612_H_ 106 #endif //YM2612_H_
91 107