comparison vgmplay.c @ 848:7068a9db6dd0

Wrote a buggy tool for splitting VGM files by channel
author Michael Pavone <pavone@retrodev.com>
date Sun, 01 Nov 2015 12:55:08 -0800
parents 574495372d1c
children 12b1a8a32306
comparison
equal deleted inserted replaced
847:7decd421cdc8 848:7068a9db6dd0
19 #define MCLKS_PER_68K 7 19 #define MCLKS_PER_68K 7
20 #define MCLKS_PER_YM MCLKS_PER_68K 20 #define MCLKS_PER_YM MCLKS_PER_68K
21 #define MCLKS_PER_Z80 15 21 #define MCLKS_PER_Z80 15
22 #define MCLKS_PER_PSG (MCLKS_PER_Z80*16) 22 #define MCLKS_PER_PSG (MCLKS_PER_Z80*16)
23 23
24 #pragma pack(push, 1)
25 typedef struct {
26 char ident[4];
27 uint32_t eof_offset;
28 uint32_t version;
29 uint32_t sn76489_clk;
30 uint32_t ym2413_clk;
31 uint32_t gd3_offset;
32 uint32_t num_samples;
33 uint32_t loop_offset;
34 uint32_t loop_samples;
35 uint32_t rate;
36 uint16_t sn76489_fb;
37 uint8_t sn76489_shift;
38 uint8_t sn76489_flags;
39 uint32_t ym2612_clk;
40 uint32_t ym2151_clk;
41 uint32_t data_offset;
42 uint32_t sega_pcm_clk;
43 uint32_t sega_pcm_reg;
44 } vgm_header;
45
46 enum {
47 CMD_PSG_STEREO = 0x4F,
48 CMD_PSG,
49 CMD_YM2413,
50 CMD_YM2612_0,
51 CMD_YM2612_1,
52 CMD_YM2151,
53 CMD_YM2203,
54 CMD_YM2608_0,
55 CMD_YM2608_1,
56 CMD_YM2610_0,
57 CMD_YM2610_1,
58 CMD_YM3812,
59 CMD_YM3526,
60 CMD_Y8950,
61 CMD_YMZ280B,
62 CMD_YMF262_0,
63 CMD_YMF262_1,
64 CMD_WAIT = 0x61,
65 CMD_WAIT_60,
66 CMD_WAIT_50,
67 CMD_END = 0x66,
68 CMD_DATA,
69 CMD_PCM_WRITE,
70 CMD_WAIT_SHORT = 0x70,
71 CMD_YM2612_DAC = 0x80,
72 CMD_DAC_STREAM_SETUP = 0x90,
73 CMD_DAC_STREAM_DATA,
74 CMD_DAC_STREAM_FREQ,
75 CMD_DAC_STREAM_START,
76 CMD_DAC_STREAM_STOP,
77 CMD_DAC_STREAM_STARTFAST,
78 CMD_DATA_SEEK = 0xE0
79 };
80
81 enum {
82 DATA_YM2612_PCM = 0
83 };
84
85 #pragma pack(pop)
86
87 void handle_keydown(int keycode) 24 void handle_keydown(int keycode)
88 { 25 {
89 } 26 }
90 27
91 void handle_keyup(int keycode) 28 void handle_keyup(int keycode)
126 p_context->cycles -= CYCLE_LIMIT; 63 p_context->cycles -= CYCLE_LIMIT;
127 y_context->current_cycle -= CYCLE_LIMIT; 64 y_context->current_cycle -= CYCLE_LIMIT;
128 process_events(); 65 process_events();
129 } 66 }
130 } 67 }
131
132 typedef struct {
133 struct data_block *next;
134 uint8_t *data;
135 uint32_t size;
136 uint8_t type;
137 } data_block;
138 68
139 int main(int argc, char ** argv) 69 int main(int argc, char ** argv)
140 { 70 {
141 set_exe_str(argv[0]); 71 set_exe_str(argv[0]);
142 data_block *blocks = NULL; 72 data_block *blocks = NULL;