comparison minijss/jssmix.c @ 1403:6aa0897265e8

Modernization cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 30 Oct 2017 18:15:11 +0200
parents 4b22da2a309f
children 69a5af2eb1ea
comparison
equal deleted inserted replaced
1402:b47109fce375 1403:6aa0897265e8
66 static const int jvmNMixRoutines = sizeof(jvmMixRoutines) / sizeof(jvmMixRoutines[0]); 66 static const int jvmNMixRoutines = sizeof(jvmMixRoutines) / sizeof(jvmMixRoutines[0]);
67 67
68 68
69 static int jvmFindMixRoutine(int outFormat, int outChannels, int mixerID) 69 static int jvmFindMixRoutine(int outFormat, int outChannels, int mixerID)
70 { 70 {
71 int i; 71 for (int i = 0; i < jvmNMixRoutines; i++)
72
73 for (i = 0; i < jvmNMixRoutines; i++)
74 { 72 {
75 if (jvmMixRoutines[i].outFormat == outFormat && 73 if (jvmMixRoutines[i].outFormat == outFormat &&
76 jvmMixRoutines[i].outChannels == outChannels && 74 jvmMixRoutines[i].outChannels == outChannels &&
77 (mixerID == JMIX_AUTO || jvmMixRoutines[i].mixerID == mixerID)) 75 (mixerID == JMIX_AUTO || jvmMixRoutines[i].mixerID == mixerID))
78 return i; 76 return i;
371 } 369 }
372 370
373 371
374 void jvmRenderAudio(JSSMixer *mixer, void *mixBuffer, const int mixLength) 372 void jvmRenderAudio(JSSMixer *mixer, void *mixBuffer, const int mixLength)
375 { 373 {
376 int i, blockLength, mixLeft; 374 int blockLength, mixLeft;
377 JMIXER_ADDBUF_TYPE *ab; 375 JMIXER_ADDBUF_TYPE *ab;
378 376
379 JSS_LOCK(mixer); 377 JSS_LOCK(mixer);
380 378
381 assert(mixer != NULL); 379 assert(mixer != NULL);
404 if (mixer->cbCounter < blockLength) 402 if (mixer->cbCounter < blockLength)
405 blockLength = mixer->cbCounter; 403 blockLength = mixer->cbCounter;
406 } 404 }
407 405
408 // Do mixing 406 // Do mixing
409 for (i = 0; i < jsetNChannels; i++) 407 for (int i = 0; i < jsetNChannels; i++)
410 { 408 {
411 JSSChannel *chn = &(mixer->channels[i]); 409 JSSChannel *chn = &(mixer->channels[i]);
412 if (chn->chPlaying && !chn->chMute) 410 if (chn->chPlaying && !chn->chMute)
413 jvmMixChannel(mixer, chn, ab, blockLength); 411 jvmMixChannel(mixer, chn, ab, blockLength);
414 } 412 }