Mercurial > hg > dmlib
changeset 188:47c327fb321a
Another cleanup, remove the "future player" data prediction hack, it is not needed.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 06 Oct 2012 16:36:39 +0300 |
parents | e59ea366b13d |
children | 06da4e365dc9 |
files | jssplr.c jssplr.h |
diffstat | 2 files changed, 13 insertions(+), 79 deletions(-) [+] |
line wrap: on
line diff
--- a/jssplr.c Sat Oct 06 16:28:04 2012 +0300 +++ b/jssplr.c Sat Oct 06 16:36:39 2012 +0300 @@ -118,24 +118,10 @@ //fprintf(stderr, "chn %d: vol=%d, fad=%d, env=%d\n", channel, volume, chn->fadeOutVol, chn->volumeEnv.value); - if (mp->future == NULL) - { - jvmSetVolume(mp->device, channel, - (chn->fadeOutVol * chn->volumeEnv.value * volume) / (16 * 65536)); - } - else - if (init) - { - jvmSetVolumeRamp(mp->device, channel, - 0, - jvmGetVolume(mp->future->device, channel), 5); - } - else - { - jvmSetVolumeRamp(mp->device, channel, - (chn->fadeOutVol * chn->volumeEnv.value * volume) / (16 * 65536), - jvmGetVolume(mp->future->device, channel), 0); - } + jvmSetVolumeRamp(mp->device, channel, + init ? 0 : jvmGetVolume(mp->device, channel), + (chn->fadeOutVol * chn->volumeEnv.value * volume) / (16 * 65536), + init ? 5 : 0); } @@ -144,17 +130,10 @@ assert(mp != NULL); assert(mp->device != NULL); - if (mp->future == NULL) - { - jvmSetPan(mp->device, channel, - panning + (((chn->panningEnv.value - 32) * (128 - abs(panning - 128))) / 32)); - } - else - { - jvmSetPanRamp(mp->device, channel, - panning + (((chn->panningEnv.value - 32) * (128 - abs(panning - 128))) / 32), - jvmGetPan(mp->future->device, channel), 0); - } + jvmSetPanRamp(mp->device, channel, + jvmGetPan(mp->device, channel), + panning + (((chn->panningEnv.value - 32) * (128 - abs(panning - 128))) / 32), + 0); } @@ -298,19 +277,11 @@ if (mp == NULL) JSSERROR(DMERR_MALLOC, NULL, "Could not allocate memory for player structure.\n"); - mp->future = dmMalloc0(sizeof(JSSPlayer)); - if (mp->future == NULL) - JSSERROR(DMERR_MALLOC, NULL, "Could not allocate memory for player structure.\n"); - // Set variables mp->device = pDevice; - mp->future->device = jvmInit(pDevice->outFormat, pDevice->outChannels, pDevice->outFreq, JMIX_AUTO); - if (mp->future->device == NULL) - JSSERROR(DMERR_INIT_FAIL, NULL, "Could not initialize shadow mixing device.\n"); #ifdef JSS_SUP_THREADS mp->mutex = dmCreateMutex(); - mp->future->mutex = dmCreateMutex(); #endif return mp; @@ -330,15 +301,6 @@ dmDestroyMutex(mp->mutex); #endif - if (mp->future != NULL) - { -#ifdef JSS_SUP_THREADS - dmDestroyMutex(mp->future->mutex); -#endif - jvmClose(mp->future->device); - dmFree(mp->future); - } - // Clear structure memset(mp, 0, sizeof(JSSPlayer)); dmFree(mp); @@ -402,7 +364,7 @@ jmpStop(mp); jmpClearPlayer(mp); - mp->future->module = mp->module = module; + mp->module = module; JSS_UNLOCK(mp); } @@ -419,9 +381,6 @@ { jvmRemoveCallback(mp->device); mp->isPlaying = FALSE; - - if (mp->future != NULL) - jmpStop(mp->future); } JSS_UNLOCK(mp); @@ -442,8 +401,6 @@ JSSERROR(result,, "Could not initialize callback for player.\n"); mp->isPlaying = TRUE; - if (mp->future != NULL) - jmpResume(mp->future); } JSS_UNLOCK(mp); @@ -567,12 +524,6 @@ "Could not start playing from given order #%i\n", order); } - if (mp->future != NULL) - { - jmpChangeOrder(mp->future, order); - jmpExec(mp->future->device, mp->future); - } - JSS_UNLOCK(mp); return DMERR_OK; } @@ -606,12 +557,6 @@ return result; } - if (mp->future != NULL) - { - jmpPlayOrder(mp->future, order); - jmpExec(mp->future->device, mp->future); - } - JSS_UNLOCK(mp); return DMERR_OK; } @@ -638,12 +583,6 @@ return result; } - if (mp->future != NULL) - { - jmpPlayPattern(mp->future, pattern); - jmpExec(mp->future->device, mp->future); - } - JSS_UNLOCK(mp); return DMERR_OK; } @@ -1199,9 +1138,12 @@ chn->volume = inst->volume; chn->panning = inst->EPanning; chn->position = 0; - JMPSETNDFLAGS(cdfPlay | cdfNewPos | cdfNewInstr | cdfNewVolume | cdfNewPanPos); + JMPSETNDFLAGS(cdfPlay | cdfNewPos | cdfNewInstr | cdfNewPanPos); } } + + // XXX possibly wrong? + JMPSETNDFLAGS(cdfNewVolume); } if (newNote && chn->instrument != NULL) @@ -1395,12 +1337,6 @@ dev = (JSSMixer *) pDEV; - // Futures - if (mp->future != NULL) - { - jmpExec(mp->future->device, mp->future); - } - // Check if we are playing if (!mp->isPlaying) goto out;