diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2009-07-31 16:13:59 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2009-07-31 16:13:59 +0200 |
commit | beccecbc98af693c3ecfb92573e278d73314c529 (patch) | |
tree | 79b1a44c26008c5c273f56b6e5e5b2cd02865835 /cgme.c | |
parent | 1e7d369b182d10a50fda73038a539a78ed548013 (diff) |
initial channel muting support (gme only for now)
Diffstat (limited to 'cgme.c')
-rw-r--r-- | cgme.c | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -10,12 +10,14 @@ static Music_Emu *emu; static int reallength; static int nzerosamples; extern int sdl_player_freq; // hack! +static uint32_t cgme_voicemask = 0; int cgme_init (const char *fname, int track, float start, float end) { if (gme_open_file (fname, &emu, sdl_player_freq)) { return -1; } + gme_mute_voices (emu, cgme_voicemask); gme_start_track (emu, track); track_info_t inf; gme_track_info (emu, &inf, track); @@ -91,7 +93,7 @@ int cgme_add (const char *fname) { // printf ("adding %s chiptune\n", fname); Music_Emu *emu; - if (!gme_open_file (fname, &emu, 44100)) { + if (!gme_open_file (fname, &emu, gme_info_only)) { int cnt = gme_track_count (emu); for (int i = 0; i < cnt; i++) { track_info_t inf; @@ -146,6 +148,22 @@ const char **cgme_getexts (void) { return exts; } +int +cgme_numvoices (void) { + if (!emu) { + return 0; + } + return gme_voice_count (emu); +} + +void +cgme_mutevoice (int voice, int mute) { + cgme_voicemask &= ~ (1<<voice); + cgme_voicemask |= ((mute ? 1 : 0) << voice); + if (emu) { + gme_mute_voices (emu, cgme_voicemask); + } +} codec_t cgme = { .init = cgme_init, @@ -153,6 +171,8 @@ codec_t cgme = { .read = cgme_read, .seek = cgme_seek, .add = cgme_add, - .getexts = cgme_getexts + .getexts = cgme_getexts, + .numvoices = cgme_numvoices, + .mutevoice = cgme_mutevoice }; |