diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-02-13 21:46:36 +0100 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-02-13 21:46:36 +0100 |
commit | 7a6f3f9e8b016c4c2b0fd2a5e30e8850465e3742 (patch) | |
tree | 6e6adffa1fb595574ddf2e95b88a590c9d9ef84a /plugins/sid | |
parent | d0b409c2a46e54f8c600377eb5fbee31a7c070da (diff) |
gtkui, sid, gme: added widget controlling chiptune voices
Diffstat (limited to 'plugins/sid')
-rw-r--r-- | plugins/sid/csid.cpp | 67 |
1 files changed, 29 insertions, 38 deletions
diff --git a/plugins/sid/csid.cpp b/plugins/sid/csid.cpp index 5eb717b6..c4b2744b 100644 --- a/plugins/sid/csid.cpp +++ b/plugins/sid/csid.cpp @@ -48,8 +48,6 @@ typedef struct { float duration; // of the current song } sid_info_t; -static uint32_t csid_voicemask; - static inline void le_int16 (int16_t in, unsigned char *out) { char *pin = (char *)∈ @@ -78,6 +76,9 @@ static int sldb_loaded; static sldb_t *sldb; static int sldb_disable; +static int chip_voices = 0xff; +static int chip_voices_changed = 0; + static void sldb_load() { @@ -279,6 +280,20 @@ csid_open (uint32_t hints) { return _info; } +static void +csid_mute_voices (sid_info_t *info, int chip_voices) { + int maxsids = info->sidplay->info ().maxsids; + for (int k = 0; k < maxsids; k++) { + sidemu *emu = info->resid->getsidemu (k); + if (emu) { + for (int i = 0; i < 3; i++) { + bool mute = chip_voices & (1 << i) ? false : true; + emu->voice (i, mute ? 0x00 : 0xff, mute); + } + } + } +} + int csid_init (DB_fileinfo_t *_info, DB_playItem_t *it) { sid_info_t *info = (sid_info_t *)_info; @@ -328,16 +343,8 @@ csid_init (DB_fileinfo_t *_info, DB_playItem_t *it) { _info->fmt.channelmask = _info->fmt.channels == 1 ? DDB_SPEAKER_FRONT_LEFT : (DDB_SPEAKER_FRONT_LEFT | DDB_SPEAKER_FRONT_RIGHT); _info->readpos = 0; - int maxsids = info->sidplay->info ().maxsids; - for (int k = 0; k < maxsids; k++) { - sidemu *emu = info->resid->getsidemu (k); - if (emu) { - for (int i = 0; i < 3; i++) { - bool mute = csid_voicemask & (1 << i) ? true : false; - emu->voice (i, mute ? 0x00 : 0xff, mute); - } - } - } + chip_voices = deadbeef->conf_get_int ("chip.voices", 0xff); + csid_mute_voices (info, chip_voices); return 0; } @@ -359,6 +366,12 @@ csid_read (DB_fileinfo_t *_info, char *bytes, int size) { return 0; } + if (chip_voices_changed) { + chip_voices = deadbeef->conf_get_int ("chip.voices", 0xff); + chip_voices_changed = 0; + csid_mute_voices (info, chip_voices); + } + int rd = info->sidplay->play (bytes, size); int samplesize = (_info->fmt.bps>>3) * _info->fmt.channels; @@ -549,32 +562,6 @@ csid_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { return after; } -#if 0 -int -csid_numvoices (DB_fileinfo_t *_info) { - return 3; -} - -void -csid_mutevoice (DB_fileinfo_t *_info, int voice, int mute) { - sid_info_t *info = (sid_info_t *)_info; - csid_voicemask &= ~ (1<<voice); - csid_voicemask |= ((mute ? 1 : 0) << voice); - if (info->resid) { - int maxsids = info->sidplay->info ().maxsids; - for (int k = 0; k < maxsids; k++) { - sidemu *emu = info->resid->getsidemu (k); - if (emu) { - for (int i = 0; i < 3; i++) { - bool mute = csid_voicemask & (1 << i) ? true : false; - emu->voice (i, mute ? 0x00 : 0xff, mute); - } - } - } - } -} -#endif - static int sid_configchanged (void) { int conf_hvsc_enable = deadbeef->conf_get_int ("hvsc_enable", 0); @@ -590,6 +577,10 @@ sid_configchanged (void) { sldb_loaded = 0; } + if (chip_voices != deadbeef->conf_get_int ("chip.voices", 0xff)) { + chip_voices_changed = 1; + } + return 0; } |