# HG changeset patch # User Matti Hamalainen # Date 1131438661 0 # Node ID 421e4fc13bce00870b56df7467a19854b10e5af0 # Parent a89064a9c3ba7ddf4d0fd4ad60442690feeff989 More and more of indentation fixes. diff -r a89064a9c3ba -r 421e4fc13bce src/xs_sidplay1.cc --- a/src/xs_sidplay1.cc Tue Nov 08 04:09:00 2005 +0000 +++ b/src/xs_sidplay1.cc Tue Nov 08 08:31:01 2005 +0000 @@ -34,8 +34,6 @@ #include #include -/* Maximum audio frequency supported by libSIDPlay v1 */ -#define SIDPLAY1_MAX_FREQ (48000) typedef struct { @@ -52,288 +50,282 @@ /* Check if we can play the given file */ - gboolean xs_sidplay1_isourfile(gchar * pcFilename) - { - sidTune *testTune = new sidTune(pcFilename); +gboolean xs_sidplay1_isourfile(gchar * pcFilename) +{ + sidTune *testTune = new sidTune(pcFilename); + + if (!testTune) return FALSE; - if (!testTune) - return FALSE; - if (!testTune->getStatus()) - { - delete testTune; - return FALSE; - } + if (!testTune->getStatus()) { + delete testTune; + return FALSE; + } - delete testTune; - return TRUE; - } + delete testTune; + return TRUE; +} /* Initialize SIDPlay1 */ - gboolean xs_sidplay1_init(t_xs_status * myStatus) - { - gint tmpFreq; - t_xs_sidplay1 *myEngine; - assert(myStatus); +gboolean xs_sidplay1_init(t_xs_status * myStatus) +{ + gint tmpFreq; + t_xs_sidplay1 *myEngine; + assert(myStatus); - /* Allocate internal structures */ - myEngine = (t_xs_sidplay1 *) g_malloc0(sizeof(t_xs_sidplay1)); - if (!myEngine) - return FALSE; + /* Allocate internal structures */ + myEngine = (t_xs_sidplay1 *) g_malloc0(sizeof(t_xs_sidplay1)); + if (!myEngine) return FALSE; - /* Initialize engine */ - myEngine->currEng = new emuEngine(); - if (!myEngine->currEng) { - XSERR("Could not initialize libSIDPlay1 emulation engine\n"); - g_free(myEngine); - return FALSE; - } + /* Initialize engine */ + myEngine->currEng = new emuEngine(); + if (!myEngine->currEng) { + XSERR("Could not initialize libSIDPlay1 emulation engine\n"); + g_free(myEngine); + return FALSE; + } - /* Verify endianess */ - if (!myEngine->currEng->verifyEndianess()) { - XSERR("Endianess verification failed\n"); - delete myEngine->currEng; - g_free(myEngine); - return FALSE; - } + /* Verify endianess */ + if (!myEngine->currEng->verifyEndianess()) { + XSERR("Endianess verification failed\n"); + delete myEngine->currEng; + g_free(myEngine); + return FALSE; + } - myStatus->sidEngine = myEngine; + myStatus->sidEngine = myEngine; - /* Get current configuration */ - myEngine->currEng->getConfig(myEngine->currConfig); + /* Get current configuration */ + myEngine->currEng->getConfig(myEngine->currConfig); - /* Configure channel parameters */ - switch (myStatus->audioChannels) { + /* Configure channel parameters */ + switch (myStatus->audioChannels) { - case XS_CHN_AUTOPAN: - myEngine->currConfig.channels = SIDEMU_STEREO; - myEngine->currConfig.autoPanning = SIDEMU_CENTEREDAUTOPANNING; - myEngine->currConfig.volumeControl = SIDEMU_FULLPANNING; - break; + case XS_CHN_AUTOPAN: + myEngine->currConfig.channels = SIDEMU_STEREO; + myEngine->currConfig.autoPanning = SIDEMU_CENTEREDAUTOPANNING; + myEngine->currConfig.volumeControl = SIDEMU_FULLPANNING; + break; - case XS_CHN_STEREO: - myEngine->currConfig.channels = SIDEMU_STEREO; - myEngine->currConfig.autoPanning = SIDEMU_NONE; - myEngine->currConfig.volumeControl = SIDEMU_NONE; - break; + case XS_CHN_STEREO: + myEngine->currConfig.channels = SIDEMU_STEREO; + myEngine->currConfig.autoPanning = SIDEMU_NONE; + myEngine->currConfig.volumeControl = SIDEMU_NONE; + break; - case XS_CHN_MONO: - default: - myEngine->currConfig.channels = SIDEMU_MONO; - myEngine->currConfig.autoPanning = SIDEMU_NONE; - myEngine->currConfig.volumeControl = SIDEMU_NONE; - myStatus->audioChannels = XS_CHN_MONO; - break; - } + case XS_CHN_MONO: + default: + myEngine->currConfig.channels = SIDEMU_MONO; + myEngine->currConfig.autoPanning = SIDEMU_NONE; + myEngine->currConfig.volumeControl = SIDEMU_NONE; + myStatus->audioChannels = XS_CHN_MONO; + break; + } - /* Memory mode settings */ - switch (xs_cfg.memoryMode) { - case XS_MPU_TRANSPARENT_ROM: - myEngine->currConfig.memoryMode = MPU_TRANSPARENT_ROM; - break; + /* Memory mode settings */ + switch (xs_cfg.memoryMode) { + case XS_MPU_TRANSPARENT_ROM: + myEngine->currConfig.memoryMode = MPU_TRANSPARENT_ROM; + break; - case XS_MPU_PLAYSID_ENVIRONMENT: - myEngine->currConfig.memoryMode = MPU_PLAYSID_ENVIRONMENT; - break; + case XS_MPU_PLAYSID_ENVIRONMENT: + myEngine->currConfig.memoryMode = MPU_PLAYSID_ENVIRONMENT; + break; - case XS_MPU_BANK_SWITCHING: - default: - myEngine->currConfig.memoryMode = MPU_BANK_SWITCHING; - xs_cfg.memoryMode = XS_MPU_BANK_SWITCHING; - break; - } + case XS_MPU_BANK_SWITCHING: + default: + myEngine->currConfig.memoryMode = MPU_BANK_SWITCHING; + xs_cfg.memoryMode = XS_MPU_BANK_SWITCHING; + break; + } - /* Clockspeed settings */ - switch (xs_cfg.clockSpeed) { - case XS_CLOCK_NTSC: - myEngine->currConfig.clockSpeed = SIDTUNE_CLOCK_NTSC; - break; + /* Clockspeed settings */ + switch (xs_cfg.clockSpeed) { + case XS_CLOCK_NTSC: + myEngine->currConfig.clockSpeed = SIDTUNE_CLOCK_NTSC; + break; - case XS_CLOCK_PAL: - default: - myEngine->currConfig.clockSpeed = SIDTUNE_CLOCK_PAL; - xs_cfg.clockSpeed = XS_CLOCK_PAL; - break; - } + case XS_CLOCK_PAL: + default: + myEngine->currConfig.clockSpeed = SIDTUNE_CLOCK_PAL; + xs_cfg.clockSpeed = XS_CLOCK_PAL; + break; + } - /* Configure rest of the emulation */ - myEngine->currConfig.mos8580 = xs_cfg.mos8580; - myEngine->currConfig.emulateFilter = xs_cfg.emulateFilters; - myEngine->currConfig.filterFs = xs_cfg.filterFs; - myEngine->currConfig.filterFm = xs_cfg.filterFm; - myEngine->currConfig.filterFt = xs_cfg.filterFt; + /* Configure rest of the emulation */ + myEngine->currConfig.mos8580 = xs_cfg.mos8580; + myEngine->currConfig.emulateFilter = xs_cfg.emulateFilters; + myEngine->currConfig.filterFs = xs_cfg.filterFs; + myEngine->currConfig.filterFm = xs_cfg.filterFm; + myEngine->currConfig.filterFt = xs_cfg.filterFt; - /* Audio parameters sanity checking and setup */ - myEngine->currConfig.bitsPerSample = myStatus->audioBitsPerSample; - tmpFreq = myStatus->audioFrequency; - - if (myStatus->oversampleEnable) { - if ((tmpFreq * myStatus->oversampleFactor) > SIDPLAY1_MAX_FREQ) { - myStatus->oversampleEnable = FALSE; - } else { - tmpFreq = (tmpFreq * myStatus->oversampleFactor); - } - } else { - if (tmpFreq > SIDPLAY1_MAX_FREQ) - tmpFreq = SIDPLAY1_MAX_FREQ; - } + /* Audio parameters sanity checking and setup */ + myEngine->currConfig.bitsPerSample = myStatus->audioBitsPerSample; + tmpFreq = myStatus->audioFrequency; - myEngine->currConfig.frequency = tmpFreq; + if (myStatus->oversampleEnable) { + if ((tmpFreq * myStatus->oversampleFactor) > SIDPLAY1_MAX_FREQ) { + myStatus->oversampleEnable = FALSE; + } else { + tmpFreq = (tmpFreq * myStatus->oversampleFactor); + } + } else { + if (tmpFreq > SIDPLAY1_MAX_FREQ) + tmpFreq = SIDPLAY1_MAX_FREQ; + } - switch (myStatus->audioBitsPerSample) { - case XS_RES_8BIT: - switch (myStatus->audioFormat) { - case FMT_S8: - myStatus->audioFormat = FMT_S8; - myEngine->currConfig.sampleFormat = SIDEMU_SIGNED_PCM; - break; + myEngine->currConfig.frequency = tmpFreq; - case FMT_U8: - default: - myStatus->audioFormat = FMT_U8; - myEngine->currConfig.sampleFormat = SIDEMU_UNSIGNED_PCM; - break; - } + switch (myStatus->audioBitsPerSample) { + case XS_RES_8BIT: + switch (myStatus->audioFormat) { + case FMT_S8: + myStatus->audioFormat = FMT_S8; + myEngine->currConfig.sampleFormat = SIDEMU_SIGNED_PCM; break; - case XS_RES_16BIT: + case FMT_U8: default: - switch (myStatus->audioFormat) { - case FMT_U16_NE: - case FMT_U16_LE: - case FMT_U16_BE: - myStatus->audioFormat = FMT_U16_NE; - myEngine->currConfig.sampleFormat = SIDEMU_UNSIGNED_PCM; - break; - - case FMT_S16_NE: - case FMT_S16_LE: - case FMT_S16_BE: - default: - myStatus->audioFormat = FMT_S16_NE; - myEngine->currConfig.sampleFormat = SIDEMU_SIGNED_PCM; - break; - } + myStatus->audioFormat = FMT_U8; + myEngine->currConfig.sampleFormat = SIDEMU_UNSIGNED_PCM; break; } + break; - /* Now set the emulator configuration */ - if (!myEngine->currEng->setConfig(myEngine->currConfig)) { - XSERR("Emulator engine configuration failed!\n"); - return FALSE; + case XS_RES_16BIT: + default: + switch (myStatus->audioFormat) { + case FMT_U16_NE: + case FMT_U16_LE: + case FMT_U16_BE: + myStatus->audioFormat = FMT_U16_NE; + myEngine->currConfig.sampleFormat = SIDEMU_UNSIGNED_PCM; + break; + + case FMT_S16_NE: + case FMT_S16_LE: + case FMT_S16_BE: + default: + myStatus->audioFormat = FMT_S16_NE; + myEngine->currConfig.sampleFormat = SIDEMU_SIGNED_PCM; + break; } + break; + } - return TRUE; + /* Now set the emulator configuration */ + if (!myEngine->currEng->setConfig(myEngine->currConfig)) { + XSERR("Emulator engine configuration failed!\n"); + return FALSE; } + return TRUE; +} + /* Close SIDPlay1 engine */ - void xs_sidplay1_close(t_xs_status * myStatus) - { - t_xs_sidplay1 *myEngine; - assert(myStatus); +void xs_sidplay1_close(t_xs_status * myStatus) +{ + t_xs_sidplay1 *myEngine; + assert(myStatus); - myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; + myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; - /* Free internals */ - if (myEngine->currEng) { - delete myEngine->currEng; - myEngine->currEng = NULL; - } + /* Free internals */ + if (myEngine->currEng) { + delete myEngine->currEng; + myEngine->currEng = NULL; + } - g_free(myEngine); - myStatus->sidEngine = NULL; - } + g_free(myEngine); + myStatus->sidEngine = NULL; +} /* Initialize current song and sub-tune */ - gboolean xs_sidplay1_initsong(t_xs_status * myStatus) - { - t_xs_sidplay1 *myEngine; - assert(myStatus); +gboolean xs_sidplay1_initsong(t_xs_status * myStatus) +{ + t_xs_sidplay1 *myEngine; + assert(myStatus); - myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; - if (!myEngine) - return FALSE; + myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; + if (!myEngine) return FALSE; - if (!myEngine->currTune) { - XSERR("Tune was NULL\n"); - return FALSE; - } + if (!myEngine->currTune) { + XSERR("Tune was NULL\n"); + return FALSE; + } - if (!myEngine->currTune->getStatus()) { - XSERR("Tune status check failed\n"); - return FALSE; - } + if (!myEngine->currTune->getStatus()) { + XSERR("Tune status check failed\n"); + return FALSE; + } - return sidEmuInitializeSong(*myEngine->currEng, *myEngine->currTune, myStatus->currSong); - } + return sidEmuInitializeSong(*myEngine->currEng, *myEngine->currTune, myStatus->currSong); +} /* Emulate and render audio data to given buffer */ - guint xs_sidplay1_fillbuffer(t_xs_status * myStatus, gchar * audioBuffer, guint audioBufSize) - { - t_xs_sidplay1 *myEngine; - assert(myStatus); +guint xs_sidplay1_fillbuffer(t_xs_status * myStatus, gchar * audioBuffer, guint audioBufSize) +{ + t_xs_sidplay1 *myEngine; + assert(myStatus); - myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; - if (!myEngine) - return 0; + myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; + if (!myEngine) return 0; - sidEmuFillBuffer(*myEngine->currEng, *myEngine->currTune, audioBuffer, audioBufSize); + sidEmuFillBuffer(*myEngine->currEng, *myEngine->currTune, audioBuffer, audioBufSize); - return audioBufSize; - } + return audioBufSize; +} /* Load a given SID-tune file */ - gboolean xs_sidplay1_loadsid(t_xs_status * myStatus, gchar * pcFilename) - { - t_xs_sidplay1 *myEngine; - sidTune *newTune; - assert(myStatus); +gboolean xs_sidplay1_loadsid(t_xs_status * myStatus, gchar * pcFilename) +{ + t_xs_sidplay1 *myEngine; + sidTune *newTune; + assert(myStatus); - myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; + myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; - /* Try to get the tune */ - if (!pcFilename) - return FALSE; + /* Try to get the tune */ + if (!pcFilename) return FALSE; - newTune = new sidTune(pcFilename); - if (!newTune) - return FALSE; + newTune = new sidTune(pcFilename); + if (!newTune) return FALSE; - myEngine->currTune = newTune; + myEngine->currTune = newTune; - return TRUE; - } + return TRUE; +} /* Delete INTERNAL information */ - void xs_sidplay1_deletesid(t_xs_status * myStatus) - { - t_xs_sidplay1 *myEngine; - assert(myStatus); +void xs_sidplay1_deletesid(t_xs_status * myStatus) +{ + t_xs_sidplay1 *myEngine; + assert(myStatus); - myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; - if (!myEngine) - return; + myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; + if (!myEngine) + return; - if (myEngine->currTune) { - delete myEngine->currTune; - myEngine->currTune = NULL; - } + if (myEngine->currTune) { + delete myEngine->currTune; + myEngine->currTune = NULL; } +} /* Return song information diff -r a89064a9c3ba -r 421e4fc13bce src/xs_sidplay1.h --- a/src/xs_sidplay1.h Tue Nov 08 04:09:00 2005 +0000 +++ b/src/xs_sidplay1.h Tue Nov 08 08:31:01 2005 +0000 @@ -3,6 +3,9 @@ #include "xmms-sid.h" +/* Maximum audio frequency supported by libSIDPlay v1 */ +#define SIDPLAY1_MAX_FREQ (48000) + #ifdef __cplusplus extern "C" { #endif diff -r a89064a9c3ba -r 421e4fc13bce src/xs_sidplay2.cc --- a/src/xs_sidplay2.cc Tue Nov 08 04:09:00 2005 +0000 +++ b/src/xs_sidplay2.cc Tue Nov 08 08:31:01 2005 +0000 @@ -56,351 +56,345 @@ /* Check if we can play the given file */ - gboolean xs_sidplay2_isourfile(gchar * pcFilename) - { - SidTune *testTune = new SidTune(pcFilename); +gboolean xs_sidplay2_isourfile(gchar * pcFilename) +{ + SidTune *testTune = new SidTune(pcFilename); + + if (!testTune) return FALSE; - if (!testTune) - return FALSE; - if (!testTune->getStatus()) - { - delete testTune; - return FALSE; - } + if (!testTune->getStatus()) { + delete testTune; + return FALSE; + } - delete testTune; - return TRUE; - } + delete testTune; + return TRUE; +} /* Initialize SIDPlay2 */ - gboolean xs_sidplay2_init(t_xs_status * myStatus) - { - gint tmpFreq; - t_xs_sidplay2 *myEngine; - assert(myStatus); +gboolean xs_sidplay2_init(t_xs_status * myStatus) +{ + gint tmpFreq; + t_xs_sidplay2 *myEngine; + assert(myStatus); - /* Allocate internal structures */ - myEngine = (t_xs_sidplay2 *) g_malloc0(sizeof(t_xs_sidplay2)); - myStatus->sidEngine = myEngine; - if (!myEngine) - return FALSE; - + /* Allocate internal structures */ + myEngine = (t_xs_sidplay2 *) g_malloc0(sizeof(t_xs_sidplay2)); + myStatus->sidEngine = myEngine; + if (!myEngine) return FALSE; - /* Initialize the engine */ - myEngine->currEng = new sidplay2; - if (!myEngine->currEng) { - XSERR("Could not initialize libSIDPlay2 emulation engine\n"); - return FALSE; - } + /* Initialize the engine */ + myEngine->currEng = new sidplay2; + if (!myEngine->currEng) { + XSERR("Could not initialize libSIDPlay2 emulation engine\n"); + return FALSE; + } - /* Get current configuration */ - myEngine->currConfig = myEngine->currEng->config(); + /* Get current configuration */ + myEngine->currConfig = myEngine->currEng->config(); - /* Configure channels and stuff */ - switch (myStatus->audioChannels) { + /* Configure channels and stuff */ + switch (myStatus->audioChannels) { - case XS_CHN_AUTOPAN: - myEngine->currConfig.playback = sid2_stereo; - break; + case XS_CHN_AUTOPAN: + myEngine->currConfig.playback = sid2_stereo; + break; - case XS_CHN_STEREO: - myEngine->currConfig.playback = sid2_stereo; - break; + case XS_CHN_STEREO: + myEngine->currConfig.playback = sid2_stereo; + break; - case XS_CHN_MONO: - default: - myEngine->currConfig.playback = sid2_mono; - myStatus->audioChannels = XS_CHN_MONO; - break; - } + case XS_CHN_MONO: + default: + myEngine->currConfig.playback = sid2_mono; + myStatus->audioChannels = XS_CHN_MONO; + break; + } - /* Memory mode settings */ - switch (xs_cfg.memoryMode) { - case XS_MPU_BANK_SWITCHING: - myEngine->currConfig.environment = sid2_envBS; - break; + /* Memory mode settings */ + switch (xs_cfg.memoryMode) { + case XS_MPU_BANK_SWITCHING: + myEngine->currConfig.environment = sid2_envBS; + break; - case XS_MPU_TRANSPARENT_ROM: - myEngine->currConfig.environment = sid2_envTP; - break; + case XS_MPU_TRANSPARENT_ROM: + myEngine->currConfig.environment = sid2_envTP; + break; - case XS_MPU_PLAYSID_ENVIRONMENT: - myEngine->currConfig.environment = sid2_envPS; - break; + case XS_MPU_PLAYSID_ENVIRONMENT: + myEngine->currConfig.environment = sid2_envPS; + break; - case XS_MPU_REAL: - default: - myEngine->currConfig.environment = sid2_envR; - xs_cfg.memoryMode = XS_MPU_REAL; - break; - } + case XS_MPU_REAL: + default: + myEngine->currConfig.environment = sid2_envR; + xs_cfg.memoryMode = XS_MPU_REAL; + break; + } - /* Clockspeed settings */ - switch (xs_cfg.clockSpeed) { - case XS_CLOCK_NTSC: - myEngine->currConfig.clockSpeed = myEngine->currConfig.clockDefault = SID2_CLOCK_NTSC; - break; + /* Clockspeed settings */ + switch (xs_cfg.clockSpeed) { + case XS_CLOCK_NTSC: + myEngine->currConfig.clockSpeed = myEngine->currConfig.clockDefault = SID2_CLOCK_NTSC; + break; - case XS_CLOCK_PAL: - default: - myEngine->currConfig.clockSpeed = myEngine->currConfig.clockDefault = SID2_CLOCK_PAL; - xs_cfg.clockSpeed = XS_CLOCK_PAL; - break; - } + case XS_CLOCK_PAL: + default: + myEngine->currConfig.clockSpeed = myEngine->currConfig.clockDefault = SID2_CLOCK_PAL; + xs_cfg.clockSpeed = XS_CLOCK_PAL; + break; + } - /* Audio parameters sanity checking and setup */ - myEngine->currConfig.precision = myStatus->audioBitsPerSample; - tmpFreq = myStatus->audioFrequency; + /* Audio parameters sanity checking and setup */ + myEngine->currConfig.precision = myStatus->audioBitsPerSample; + tmpFreq = myStatus->audioFrequency; + + if (myStatus->oversampleEnable) + tmpFreq = (tmpFreq * myStatus->oversampleFactor); + + myEngine->currConfig.frequency = tmpFreq; - if (myStatus->oversampleEnable) - tmpFreq = (tmpFreq * myStatus->oversampleFactor); + switch (myStatus->audioBitsPerSample) { + case XS_RES_8BIT: + myStatus->audioFormat = FMT_U8; + myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED; + break; - myEngine->currConfig.frequency = tmpFreq; - - switch (myStatus->audioBitsPerSample) { - case XS_RES_8BIT: - myStatus->audioFormat = FMT_U8; + case XS_RES_16BIT: + default: + switch (myStatus->audioFormat) { + case FMT_U16_LE: myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED; break; - case XS_RES_16BIT: - default: - switch (myStatus->audioFormat) { - case FMT_U16_LE: - myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED; - break; + case FMT_U16_BE: + myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED; + break; - case FMT_U16_BE: - myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED; - break; - - case FMT_U16_NE: + case FMT_U16_NE: #ifdef WORDS_BIGENDIAN - myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED; + myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED; #else - myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED; + myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED; #endif - break; + break; - case FMT_S16_LE: - myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED; - break; + case FMT_S16_LE: + myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED; + break; - case FMT_S16_BE: - myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED; - break; + case FMT_S16_BE: + myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED; + break; - default: - myStatus->audioFormat = FMT_S16_NE; + default: + myStatus->audioFormat = FMT_S16_NE; #ifdef WORDS_BIGENDIAN - myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED; + myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED; #else - myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED; + myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED; #endif - break; + break; - } - break; } - - /* Initialize builder object */ - XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (myEngine->currEng->info()).maxsids); -#ifdef HAVE_RESID_BUILDER - if (xs_cfg.sid2Builder == XS_BLD_RESID) { - ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder"); - myEngine->currBuilder = (sidbuilder *) rs; - if (rs) { - /* Builder object created, initialize it */ - rs->create((myEngine->currEng->info()).maxsids); - if (!*rs) { - XSERR("rs->create() failed. SIDPlay2 suxx again.\n"); - return FALSE; - } + break; + } - rs->filter(xs_cfg.emulateFilters); - if (!*rs) { - XSERR("rs->filter(%d) failed.\n", xs_cfg.emulateFilters); - return FALSE; - } + /* Initialize builder object */ + XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (myEngine->currEng->info()).maxsids); +#ifdef HAVE_RESID_BUILDER + if (xs_cfg.sid2Builder == XS_BLD_RESID) { + ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder"); + myEngine->currBuilder = (sidbuilder *) rs; + if (rs) { + /* Builder object created, initialize it */ + rs->create((myEngine->currEng->info()).maxsids); + if (!*rs) { + XSERR("rs->create() failed. SIDPlay2 suxx again.\n"); + return FALSE; + } - rs->sampling(tmpFreq); - if (!*rs) { - XSERR("rs->sampling(%d) failed.\n", tmpFreq); - return FALSE; - } + rs->filter(xs_cfg.emulateFilters); + if (!*rs) { + XSERR("rs->filter(%d) failed.\n", xs_cfg.emulateFilters); + return FALSE; + } - rs->filter((sid_filter_t *) NULL); - if (!*rs) { - XSERR("rs->filter(NULL) failed.\n"); - return FALSE; - } + rs->sampling(tmpFreq); + if (!*rs) { + XSERR("rs->sampling(%d) failed.\n", tmpFreq); + return FALSE; + } + + rs->filter((sid_filter_t *) NULL); + if (!*rs) { + XSERR("rs->filter(NULL) failed.\n"); + return FALSE; } } + } #endif #ifdef HAVE_HARDSID_BUILDER - if (xs_cfg.sid2Builder == XS_BLD_HARDSID) { - HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder"); - myEngine->currBuilder = (sidbuilder *) hs; - if (hs) { - /* Builder object created, initialize it */ - hs->create((myEngine->currEng->info()).maxsids); - if (!*hs) { - XSERR("hs->create() failed. SIDPlay2 suxx again.\n"); - return FALSE; - } + if (xs_cfg.sid2Builder == XS_BLD_HARDSID) { + HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder"); + myEngine->currBuilder = (sidbuilder *) hs; + if (hs) { + /* Builder object created, initialize it */ + hs->create((myEngine->currEng->info()).maxsids); + if (!*hs) { + XSERR("hs->create() failed. SIDPlay2 suxx again.\n"); + return FALSE; + } - hs->filter(xs_cfg.emulateFilters); - if (!*hs) { - XSERR("hs->filter(%d) failed.\n", xs_cfg.emulateFilters); - return FALSE; - } + hs->filter(xs_cfg.emulateFilters); + if (!*hs) { + XSERR("hs->filter(%d) failed.\n", xs_cfg.emulateFilters); + return FALSE; } } + } #endif - if (!myEngine->currBuilder) { - XSERR("Could not initialize SIDBuilder object.\n"); - return FALSE; - } + if (!myEngine->currBuilder) { + XSERR("Could not initialize SIDBuilder object.\n"); + return FALSE; + } - XSDEBUG("%s\n", myEngine->currBuilder->credits()); + XSDEBUG("%s\n", myEngine->currBuilder->credits()); - /* Configure rest of the emulation */ - myEngine->currConfig.sidEmulation = myEngine->currBuilder; - myEngine->currConfig.clockForced = xs_cfg.forceSpeed; - myEngine->currConfig.optimisation = (xs_cfg.sid2OptLevel) ? 1 : 0; - if (xs_cfg.mos8580) - myEngine->currConfig.sidDefault = SID2_MOS8580; - else - myEngine->currConfig.sidDefault = SID2_MOS6581; + /* Configure rest of the emulation */ + myEngine->currConfig.sidEmulation = myEngine->currBuilder; + myEngine->currConfig.clockForced = xs_cfg.forceSpeed; + myEngine->currConfig.optimisation = (xs_cfg.sid2OptLevel) ? 1 : 0; + if (xs_cfg.mos8580) + myEngine->currConfig.sidDefault = SID2_MOS8580; + else + myEngine->currConfig.sidDefault = SID2_MOS6581; - myEngine->currConfig.sidModel = myEngine->currConfig.sidDefault; - myEngine->currConfig.sidSamples = TRUE; // FIXME FIX ME, make configurable! + myEngine->currConfig.sidModel = myEngine->currConfig.sidDefault; + myEngine->currConfig.sidSamples = TRUE; // FIXME FIX ME, make configurable! - /* Now set the emulator configuration */ - if (myEngine->currEng->config(myEngine->currConfig) < 0) { - XSERR("Emulator engine configuration failed!\n"); - return FALSE; - } + /* Now set the emulator configuration */ + if (myEngine->currEng->config(myEngine->currConfig) < 0) { + XSERR("Emulator engine configuration failed!\n"); + return FALSE; + } - /* Create the sidtune */ - myEngine->currTune = new SidTune(0); - if (!myEngine->currTune) { - XSERR("Could not initialize SIDTune object.\n"); - return FALSE; - } + /* Create the sidtune */ + myEngine->currTune = new SidTune(0); + if (!myEngine->currTune) { + XSERR("Could not initialize SIDTune object.\n"); + return FALSE; + } - return TRUE; - } + return TRUE; +} /* Close SIDPlay2 engine */ - void xs_sidplay2_close(t_xs_status * myStatus) - { - t_xs_sidplay2 *myEngine; - assert(myStatus); +void xs_sidplay2_close(t_xs_status * myStatus) +{ + t_xs_sidplay2 *myEngine; + assert(myStatus); - myEngine = (t_xs_sidplay2 *) myStatus->sidEngine; + myEngine = (t_xs_sidplay2 *) myStatus->sidEngine; - /* Free internals */ - if (myEngine->currBuilder) { - delete myEngine->currBuilder; - myEngine->currBuilder = NULL; - } + /* Free internals */ + if (myEngine->currBuilder) { + delete myEngine->currBuilder; + myEngine->currBuilder = NULL; + } - if (myEngine->currEng) { - delete myEngine->currEng; - myEngine->currEng = NULL; - } + if (myEngine->currEng) { + delete myEngine->currEng; + myEngine->currEng = NULL; + } - if (myEngine->currTune) { - delete myEngine->currTune; - myEngine->currTune = NULL; - } + if (myEngine->currTune) { + delete myEngine->currTune; + myEngine->currTune = NULL; + } - xs_sidplay2_deletesid(myStatus); + xs_sidplay2_deletesid(myStatus); - g_free(myEngine); - myStatus->sidEngine = NULL; - } + g_free(myEngine); + myStatus->sidEngine = NULL; +} /* Initialize current song and sub-tune */ - gboolean xs_sidplay2_initsong(t_xs_status * myStatus) - { - t_xs_sidplay2 *myEngine; - assert(myStatus); +gboolean xs_sidplay2_initsong(t_xs_status * myStatus) +{ + t_xs_sidplay2 *myEngine; + assert(myStatus); - myEngine = (t_xs_sidplay2 *) myStatus->sidEngine; - if (!myEngine) - return FALSE; + myEngine = (t_xs_sidplay2 *) myStatus->sidEngine; + if (!myEngine) return FALSE; - if (!myEngine->currTune->selectSong(myStatus->currSong)) { - XSERR("currTune->selectSong() failed\n"); - return FALSE; - } + if (!myEngine->currTune->selectSong(myStatus->currSong)) { + XSERR("currTune->selectSong() failed\n"); + return FALSE; + } - if (myEngine->currEng->load(myEngine->currTune) < 0) { - XSERR("currEng->load() failed\n"); - return FALSE; - } + if (myEngine->currEng->load(myEngine->currTune) < 0) { + XSERR("currEng->load() failed\n"); + return FALSE; + } - return TRUE; - } + return TRUE; +} /* Emulate and render audio data to given buffer */ - guint xs_sidplay2_fillbuffer(t_xs_status * myStatus, gchar * audioBuffer, guint audioBufSize) - { - t_xs_sidplay2 *myEngine; - assert(myStatus); +guint xs_sidplay2_fillbuffer(t_xs_status * myStatus, gchar * audioBuffer, guint audioBufSize) +{ + t_xs_sidplay2 *myEngine; + assert(myStatus); - myEngine = (t_xs_sidplay2 *) myStatus->sidEngine; - if (!myEngine) - return 0; + myEngine = (t_xs_sidplay2 *) myStatus->sidEngine; + if (!myEngine) return 0; - return myEngine->currEng->play(audioBuffer, audioBufSize); - } + return myEngine->currEng->play(audioBuffer, audioBufSize); +} /* Load a given SID-tune file */ - gboolean xs_sidplay2_loadsid(t_xs_status * myStatus, gchar * pcFilename) - { - t_xs_sidplay2 *myEngine; - assert(myStatus); +gboolean xs_sidplay2_loadsid(t_xs_status * myStatus, gchar * pcFilename) +{ + t_xs_sidplay2 *myEngine; + assert(myStatus); - myEngine = (t_xs_sidplay2 *) myStatus->sidEngine; + myEngine = (t_xs_sidplay2 *) myStatus->sidEngine; - /* Try to get the tune */ - if (!pcFilename) - return FALSE; - if (!myEngine->currTune->load(pcFilename)) - return FALSE; + /* Try to get the tune */ + if (!pcFilename) return FALSE; + if (!myEngine->currTune->load(pcFilename)) + return FALSE; - return TRUE; - } + return TRUE; +} /* Delete INTERNAL information */ - void xs_sidplay2_deletesid(t_xs_status * myStatus) - { - assert(myStatus); +void xs_sidplay2_deletesid(t_xs_status * myStatus) +{ + assert(myStatus); - /* With the current scheme of handling sidtune-loading, we don't do anything here. */ - } + /* With the current scheme of handling sidtune-loading, we don't do anything here. */ +} /* Return song information