Mercurial > hg > dmlib
diff minijss/jssmix.c @ 1127:e22d4ceb6414
Cosmetics pass, remove excess and trailing whitespace.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 04 Mar 2015 06:11:37 +0200 |
parents | 68453f04964d |
children | aa3738b121d1 |
line wrap: on
line diff
--- a/minijss/jssmix.c Wed Mar 04 06:08:22 2015 +0200 +++ b/minijss/jssmix.c Wed Mar 04 06:11:37 2015 +0200 @@ -70,7 +70,7 @@ static int jvmFindMixRoutine(int outFormat, int outChannels, int mixerID) { int i; - + for (i = 0; i < jvmNMixRoutines; i++) { if (jvmMixRoutines[i].outFormat == outFormat && @@ -78,7 +78,7 @@ (mixerID == JMIX_AUTO || jvmMixRoutines[i].mixerID == mixerID)) return i; } - + return -1; } @@ -102,13 +102,13 @@ JSSERROR(DMERR_INVALID_ARGS, NULL, "Invalid number of channels %d\n", outChannels); } - + if (outFreq < 4000) { JSSERROR(DMERR_INVALID_ARGS, NULL, "Invalid mixing frequency %d\n", outFreq); } - + /* Select mixing routines: * Here we try to choose the most fitting mixing routines * from the compiled in routines, unless caller is forcing @@ -134,7 +134,7 @@ outFormat, outChannels, outFreq); return NULL; } - + // Allocate a mixer device structure mixer = dmMalloc0(sizeof(JSSMixer)); if (mixer == NULL) @@ -150,11 +150,11 @@ mixer->outFormat = outFormat; mixer->outFreq = outFreq; mixer->outChannels = outChannels; - + mixer->jvmMixChannel_FW = jvmMixRoutines[mixerIdx].jvmMixChannel_FW; mixer->jvmMixChannel_BW = jvmMixRoutines[mixerIdx].jvmMixChannel_BW; mixer->jvmPostProcess = jvmMixRoutines[mixerIdx].jvmPostProcess; - + // Allocate addBuffer mixer->addBufSize = outChannels * outFreq * 2; mixer->addBuffer = dmMalloc(mixer->addBufSize * sizeof(JMIXER_ADDBUF_TYPE)); @@ -163,7 +163,7 @@ JSSERROR(DMERR_MALLOC, NULL, "Could not allocate mixing addition buffer.\n"); } - + return mixer; } @@ -190,7 +190,7 @@ { int sampSize = 1; assert(mixer); - + switch (mixer->outChannels) { case JSS_AUDIO_STEREO: @@ -202,7 +202,7 @@ "outChannels=%d not stereo or mono!\n", mixer->outChannels); break; } - + switch (mixer->outFormat) { case JSS_AUDIO_U16: sampSize *= sizeof(Uint16); break; @@ -213,7 +213,7 @@ JSSERROR(DMERR_INVALID_ARGS, -1, "outFormat=%d is not supported!\n", mixer->outFormat); } - + return sampSize; } @@ -221,9 +221,9 @@ int jvmGetSampleRes(JSSMixer *mixer) { int sampRes = 0; - + assert(mixer); - + switch (mixer->outFormat) { case JSS_AUDIO_U16: case JSS_AUDIO_S16: sampRes = 16; break; @@ -232,7 +232,7 @@ JSSERROR(DMERR_INVALID_ARGS, -1, "outFormat=%d is not supported!\n", mixer->outFormat); } - + return sampRes; } @@ -241,12 +241,12 @@ { int mixDone = mixLength, mixResult; JMIXER_ADDBUF_TYPE *ab = addBuffer; - + if (!chn->chPlaying || chn->chMute) return; DBG("%s(%p, %d)\n", __FUNCTION__, chn, mixLength); - + while (mixDone > 0) { if (chn->chDirection) @@ -325,7 +325,7 @@ } } } - + // Call the mixing innerloop functions if (chn->chDirection) { @@ -360,7 +360,7 @@ ab, mixDone, zero); } } - + mixDone -= mixResult; ab += mixResult * mixer->outChannels; } @@ -386,7 +386,7 @@ // Clear mixer->addBuffer memset(mixer->addBuffer, 0, mixLength * mixer->outChannels * sizeof(JMIXER_ADDBUF_TYPE)); - + ab = mixer->addBuffer; mixLeft = mixLength; while (mixLeft > 0) @@ -423,7 +423,7 @@ jvmAdvanceChannel(mixer, chn, blockLength); } */ - + ab += blockLength * mixer->outChannels; mixLeft -= blockLength; mixer->cbCounter -= blockLength; @@ -473,12 +473,12 @@ assert(mixer); JSS_LOCK(mixer); - + mixer->cbFreq = cbFreq; mixer->cbCounter = 0; //fprintf(stderr, "set(outFreq = %d, cbFreq = %d) = %d\n", mixer->outFreq, cbFreq, mixer->cbFreq); - + JSS_UNLOCK(mixer); return DMERR_OK; } @@ -505,7 +505,7 @@ void jvmReset(JSSMixer * mixer, const int channel) { JSSChannel *c; - + JSS_LOCK(mixer); c = &mixer->channels[channel]; @@ -521,10 +521,10 @@ const Sint32 loopE, const int flags) { JSSChannel *c; - + JSS_LOCK(mixer); c = &mixer->channels[channel]; - + FP_SETHL(c->chSize, size, 0); FP_SETHL(c->chLoopS, loopS, 0); FP_SETHL(c->chLoopE, loopE, 0); @@ -532,7 +532,7 @@ c->chFlags = flags; c->chDirection = TRUE; c->chPos.dw = c->chDeltaO.dw = 0; - + JSS_UNLOCK(mixer); } @@ -542,7 +542,7 @@ JSS_LOCK(mixer); mixer->channels[channel].chFreq = freq; - + if (mixer->outFreq > 0) { DMFixedPoint a, b; @@ -588,7 +588,7 @@ JSS_LOCK(mixer); FP_SETHL(mixer->channels[channel].chVolume, start, 0); - tmp = mixer->channels[channel].chVolumeD = + tmp = mixer->channels[channel].chVolumeD = len > 0 ? ((mixer->outFreq * len) / 1000) : mixer->cbFreq; FP_SETHL(a, (end - start), 0); @@ -649,7 +649,7 @@ FP_SETHL(mixer->channels[channel].chPanning, start, 0); - tmp = mixer->channels[channel].chPanningD = + tmp = mixer->channels[channel].chPanningD = len > 0 ? ((mixer->outFreq * len) / 1000) : mixer->cbFreq; FP_SETHL(a, (end - start), 0);