Mercurial > hg > xmms-sid
changeset 768:f145ba458acd
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 06 Nov 2012 01:15:28 +0200 |
parents | cf644ac89b54 |
children | 120d6f247f1b |
files | src/xs_sidplay2.cc |
diffstat | 1 files changed, 30 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xs_sidplay2.cc Tue Nov 06 01:13:51 2012 +0200 +++ b/src/xs_sidplay2.cc Tue Nov 06 01:15:28 2012 +0200 @@ -458,11 +458,10 @@ */ gboolean xs_sidplay2_initsong(XSEngineState * state) { - XSSIDPlay2 *engine; - assert(state); + XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal; - engine = (XSSIDPlay2 *) state->internal; - if (!engine) return FALSE; + if (!engine) + return FALSE; if (!engine->tune->selectSong(state->currSong)) { xs_error("[SIDPlay2] tune->selectSong() failed\n"); @@ -484,13 +483,12 @@ */ guint xs_sidplay2_fillbuffer(XSEngineState * state, gchar * audioBuffer, guint audioBufSize) { - XSSIDPlay2 *engine; - assert(state); + XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal; - engine = (XSSIDPlay2 *) state->internal; - if (!engine) return 0; + if (!engine) + return 0; - return engine->emu->play((short *) audioBuffer, audioBufSize / sizeof(short)); + return engine->emu.play((short *) audioBuffer, (audioBufSize / sizeof(short))); } @@ -498,12 +496,12 @@ */ gboolean xs_sidplay2_load(XSEngineState * state, gchar * filename) { - XSSIDPlay2 *engine; - assert(state); + XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal; + state->isInitialized = FALSE; - engine = (XSSIDPlay2 *) state->internal; - if (!engine) return FALSE; + if (!engine) + return FALSE; if (xs_fload_buffer(filename, &(engine->buf), &(engine->bufSize)) != 0) return FALSE; @@ -519,22 +517,20 @@ */ void xs_sidplay2_delete(XSEngineState * state) { - XSSIDPlay2 *engine; - assert(state); + XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal; - engine = (XSSIDPlay2 *) state->internal; - if (!engine) - return; + if (engine) + { + if (engine->tune) + { + delete engine->tune; + engine->tune = NULL; + } - if (engine->tune) - { - delete engine->tune; - engine->tune = NULL; + g_free(engine->buf); + engine->buf = NULL; + engine->bufSize = 0; } - - g_free(engine->buf); - engine->buf = NULL; - engine->bufSize = 0; } @@ -542,17 +538,19 @@ */ void xs_sidplay2_flush(XSEngineState * state) { - assert(state); + (void) state; #ifdef HAVE_HARDSID_BUILDER + if (xs_cfg.sid2Builder == XS_BLD_HARDSID) + { #ifdef HSID_SID2_COM - IfPtr<HardSIDBuilder> hs(state->builder); - if (hs) - hs->flush(); + IfPtr<HardSIDBuilder> hs(state->config.sidEmulation); + if (hs) + hs->flush(); #else - if (xs_cfg.sid2Builder == XS_BLD_HARDSID) - ((HardSIDBuilder *) state->builder)->flush(); + ((HardSIDBuilder *) state->config.sidEmulation)->flush(); #endif + } #endif }