Branch Coverage

TinySoundFont/tsf.h
Criterion Covered Total %
branch 383 926 41.3


line true false branch
358 0 11 if (!f)
371 0 0 static int tsf_stream_memory_read(struct tsf_stream_memory* m, void* ptr, unsigned int size) { if (size > m->total - m->pos) size = m->total - m->pos; TSF_MEMCPY(ptr, m->buffer+m->pos, size); m->pos += size; return size; }
372 0 0 static int tsf_stream_memory_skip(struct tsf_stream_memory* m, unsigned int count) { if (m->pos + count > m->total) return 0; m->pos += count; return 1; }
478 4536 356 static float tsf_decibelsToGain(float db) { return (db > -100.f ? TSF_POWF(10.0f, db * 0.05f) : 0); }
479 0 105 static float tsf_gainToDecibels(float gain) { return (gain <= .00001f ? -100.f : (float)(20.0 * TSF_LOG10(gain))); }
484 208 15 if (parent && sizeof(tsf_fourcc) + sizeof(tsf_u32) > parent->size) return TSF_FALSE;
39 169 if (parent && sizeof(tsf_fourcc) + sizeof(tsf_u32) > parent->size) return TSF_FALSE;
485 183 1 if (!stream->read(stream->data, &chunk->id, sizeof(tsf_fourcc)) || *chunk->id <= ' ' || *chunk->id >= 'z') return TSF_FALSE;
183 0 if (!stream->read(stream->data, &chunk->id, sizeof(tsf_fourcc)) || *chunk->id <= ' ' || *chunk->id >= 'z') return TSF_FALSE;
0 183 if (!stream->read(stream->data, &chunk->id, sizeof(tsf_fourcc)) || *chunk->id <= ' ' || *chunk->id >= 'z') return TSF_FALSE;
486 0 183 if (!stream->read(stream->data, &chunk->size, sizeof(tsf_u32))) return TSF_FALSE;
487 169 14 if (parent && sizeof(tsf_fourcc) + sizeof(tsf_u32) + chunk->size > parent->size) return TSF_FALSE;
0 169 if (parent && sizeof(tsf_fourcc) + sizeof(tsf_u32) + chunk->size > parent->size) return TSF_FALSE;
488 169 14 if (parent) parent->size -= sizeof(tsf_fourcc) + sizeof(tsf_u32) + chunk->size;
489 13 170 IsRiff = TSF_FourCCEquals(chunk->id, "RIFF"), IsList = TSF_FourCCEquals(chunk->id, "LIST");
13 0 IsRiff = TSF_FourCCEquals(chunk->id, "RIFF"), IsList = TSF_FourCCEquals(chunk->id, "LIST");
13 0 IsRiff = TSF_FourCCEquals(chunk->id, "RIFF"), IsList = TSF_FourCCEquals(chunk->id, "LIST");
13 0 IsRiff = TSF_FourCCEquals(chunk->id, "RIFF"), IsList = TSF_FourCCEquals(chunk->id, "LIST");
39 144 IsRiff = TSF_FourCCEquals(chunk->id, "RIFF"), IsList = TSF_FourCCEquals(chunk->id, "LIST");
39 0 IsRiff = TSF_FourCCEquals(chunk->id, "RIFF"), IsList = TSF_FourCCEquals(chunk->id, "LIST");
39 0 IsRiff = TSF_FourCCEquals(chunk->id, "RIFF"), IsList = TSF_FourCCEquals(chunk->id, "LIST");
39 0 IsRiff = TSF_FourCCEquals(chunk->id, "RIFF"), IsList = TSF_FourCCEquals(chunk->id, "LIST");
490 13 170 if (IsRiff && parent) return TSF_FALSE; //not allowed
0 13 if (IsRiff && parent) return TSF_FALSE; //not allowed
491 170 13 if (!IsRiff && !IsList) return TSF_TRUE; //custom type without sub type
131 39 if (!IsRiff && !IsList) return TSF_TRUE; //custom type without sub type
492 52 0 if (!stream->read(stream->data, &chunk->id, sizeof(tsf_fourcc)) || *chunk->id <= ' ' || *chunk->id >= 'z') return TSF_FALSE;
52 0 if (!stream->read(stream->data, &chunk->id, sizeof(tsf_fourcc)) || *chunk->id <= ' ' || *chunk->id >= 'z') return TSF_FALSE;
0 52 if (!stream->read(stream->data, &chunk->id, sizeof(tsf_fourcc)) || *chunk->id <= ' ' || *chunk->id >= 'z') return TSF_FALSE;
502 26 26 if (for_relative) return;
615 26 26 if (amount)
618 0 26 if (genOper >= _GEN_MAX) return;
628 26 0 case GEN_LOOPMODE: region->loop_mode = ((amount->wordAmount&3) == 3 ? TSF_LOOPMODE_SUSTAIN : ((amount->wordAmount&3) == 1 ? TSF_LOOPMODE_CONTINUOUS : TSF_LOOPMODE_NONE)); return;
635 1534 26 for (genOper = 0; genOper != _GEN_MAX; genOper++)
656 0 520 if (*val < vmin) *val = vmin;
657 0 520 else if (*val > vmax) *val = vmax;
673 0 260 if (*val < vmin) *val = vmin;
674 0 260 else if (*val > vmax) *val = vmax;
692 52 0 p->delay = (p->delay < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->delay));
693 52 0 p->attack = (p->attack < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->attack));
694 52 0 p->release = (p->release < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->release));
698 52 0 if (!p->keynumToHold) p->hold = (p->hold < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->hold));
52 0 if (!p->keynumToHold) p->hold = (p->hold < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->hold));
699 52 0 if (!p->keynumToDecay) p->decay = (p->decay < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->decay));
52 0 if (!p->keynumToDecay) p->decay = (p->decay < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->decay));
701 0 52 if (p->sustain < 0.0f) p->sustain = 0.0f;
702 26 26 else if (sustainIsGain) p->sustain = tsf_decibelsToGain(-p->sustain / 10.0f);
713 0 13 if (!res->presets) return 0;
714 26 13 else { int i; for (i = 0; i != res->presetNum; i++) res->presets[i].regions = TSF_NULL; }
715 26 13 for (pphdr = hydra->phdrs, pphdrMax = pphdr + hydra->phdrNum - 1; pphdr != pphdrMax; pphdr++)
722 52 26 for (otherphdr = hydra->phdrs; otherphdr != pphdrMax; otherphdr++)
724 26 26 if (otherphdr == pphdr || otherphdr->bank > pphdr->bank) continue;
0 26 if (otherphdr == pphdr || otherphdr->bank > pphdr->bank) continue;
725 0 26 else if (otherphdr->bank < pphdr->bank) sortedIndex++;
726 0 26 else if (otherphdr->preset > pphdr->preset) continue;
727 0 26 else if (otherphdr->preset < pphdr->preset) sortedIndex++;
728 13 13 else if (otherphdr < pphdr) sortedIndex++;
739 26 26 for (ppbag = hydra->pbags + pphdr->presetBagNdx, ppbagEnd = hydra->pbags + pphdr[1].presetBagNdx; ppbag != ppbagEnd; ppbag++)
743 26 26 for (ppgen = hydra->pgens + ppbag->genNdx, ppgenEnd = hydra->pgens + ppbag[1].genNdx; ppgen != ppgenEnd; ppgen++)
745 0 26 if (ppgen->genOper == GenKeyRange) { plokey = ppgen->genAmount.range.lo; phikey = ppgen->genAmount.range.hi; continue; }
746 0 26 if (ppgen->genOper == GenVelRange) { plovel = ppgen->genAmount.range.lo; phivel = ppgen->genAmount.range.hi; continue; }
747 0 26 if (ppgen->genOper != GenInstrument) continue;
748 0 26 if (ppgen->genAmount.wordAmount >= hydra->instNum) continue;
750 26 26 for (pibag = hydra->ibags + pinst->instBagNdx, pibagEnd = hydra->ibags + pinst[1].instBagNdx; pibag != pibagEnd; pibag++)
753 52 26 for (pigen = hydra->igens + pibag->instGenNdx, pigenEnd = hydra->igens + pibag[1].instGenNdx; pigen != pigenEnd; pigen++)
755 0 52 if (pigen->genOper == GenKeyRange) { ilokey = pigen->genAmount.range.lo; ihikey = pigen->genAmount.range.hi; continue; }
756 0 52 if (pigen->genOper == GenVelRange) { ilovel = pigen->genAmount.range.lo; ihivel = pigen->genAmount.range.hi; continue; }
757 26 26 if (pigen->genOper == GenSampleID && ihikey >= plokey && ilokey <= phikey && ihivel >= plovel && ilovel <= phivel) preset->regionNum++;
26 0 if (pigen->genOper == GenSampleID && ihikey >= plokey && ilokey <= phikey && ihivel >= plovel && ilovel <= phivel) preset->regionNum++;
26 0 if (pigen->genOper == GenSampleID && ihikey >= plokey && ilokey <= phikey && ihivel >= plovel && ilovel <= phivel) preset->regionNum++;
26 0 if (pigen->genOper == GenSampleID && ihikey >= plokey && ilokey <= phikey && ihivel >= plovel && ilovel <= phivel) preset->regionNum++;
26 0 if (pigen->genOper == GenSampleID && ihikey >= plokey && ilokey <= phikey && ihivel >= plovel && ilovel <= phivel) preset->regionNum++;
764 0 26 if (!preset->regions)
766 0 0 int i; for (i = 0; i != res->presetNum; i++) TSF_FREE(res->presets[i].regions);
773 26 26 for (ppbag = hydra->pbags + pphdr->presetBagNdx, ppbagEnd = hydra->pbags + pphdr[1].presetBagNdx; ppbag != ppbagEnd; ppbag++)
780 26 26 for (ppgen = hydra->pgens + ppbag->genNdx, ppgenEnd = hydra->pgens + ppbag[1].genNdx; ppgen != ppgenEnd; ppgen++)
783 26 0 if (ppgen->genOper == GenInstrument)
787 0 26 if (whichInst >= hydra->instNum) continue;
791 26 26 for (pibag = hydra->ibags + pinst->instBagNdx, pibagEnd = hydra->ibags + pinst[1].instBagNdx; pibag != pibagEnd; pibag++)
796 52 26 for (pigen = hydra->igens + pibag->instGenNdx, pigenEnd = hydra->igens + pibag[1].instGenNdx; pigen != pigenEnd; pigen++)
798 26 26 if (pigen->genOper == GenSampleID)
803 26 0 if (zoneRegion.hikey < presetRegion.lokey || zoneRegion.lokey > presetRegion.hikey) continue;
0 26 if (zoneRegion.hikey < presetRegion.lokey || zoneRegion.lokey > presetRegion.hikey) continue;
804 26 0 if (zoneRegion.hivel < presetRegion.lovel || zoneRegion.lovel > presetRegion.hivel) continue;
0 26 if (zoneRegion.hivel < presetRegion.lovel || zoneRegion.lovel > presetRegion.hivel) continue;
805 0 26 if (presetRegion.lokey > zoneRegion.lokey) zoneRegion.lokey = presetRegion.lokey;
806 0 26 if (presetRegion.hikey < zoneRegion.hikey) zoneRegion.hikey = presetRegion.hikey;
807 0 26 if (presetRegion.lovel > zoneRegion.lovel) zoneRegion.lovel = presetRegion.lovel;
808 0 26 if (presetRegion.hivel < zoneRegion.hivel) zoneRegion.hivel = presetRegion.hivel;
818 26 0 zoneRegion.delayModLFO = (zoneRegion.delayModLFO < -11950.0f ? 0.0f : tsf_timecents2Secsf(zoneRegion.delayModLFO));
819 26 0 zoneRegion.delayVibLFO = (zoneRegion.delayVibLFO < -11950.0f ? 0.0f : tsf_timecents2Secsf(zoneRegion.delayVibLFO));
827 26 0 if (pshdr->endLoop > 0) zoneRegion.loop_end -= 1;
828 0 26 if (zoneRegion.loop_end > fontSampleCount) zoneRegion.loop_end = fontSampleCount;
829 26 0 if (zoneRegion.pitch_keycenter == -1) zoneRegion.pitch_keycenter = pshdr->originalPitch;
832 26 0 if (zoneRegion.end && zoneRegion.end < fontSampleCount) zoneRegion.end++;
0 26 if (zoneRegion.end && zoneRegion.end < fontSampleCount) zoneRegion.end++;
843 26 0 if (pibag == hydra->ibags + pinst->instBagNdx && !hadSampleID)
0 26 if (pibag == hydra->ibags + pinst->instBagNdx && !hadSampleID)
858 26 0 if (ppbag == hydra->pbags + pphdr->presetBagNdx && !hadGenInstrument)
0 26 if (ppbag == hydra->pbags + pphdr->presetBagNdx && !hadGenInstrument)
993 13 0 if (!*pFloatBuffer || !stream->read(stream->data, *pFloatBuffer, chunkSmpl->size)) return 0;
0 13 if (!*pFloatBuffer || !stream->read(stream->data, *pFloatBuffer, chunkSmpl->size)) return 0;
994 650 13 for (res = *pFloatBuffer, out = res + *pSmplCount, in = (short*)res + *pSmplCount; out != res;)
1002 106 0 return (int)((e->parameters.release <= 0 ? TSF_FASTRELEASETIME : e->parameters.release) * outSampleRate);
1011 0 110 if (e->samplesUntilNextSegment > 0)
1022 0 110 if (e->samplesUntilNextSegment > 0)
1024 0 0 if (!e->isAmpEnv)
1038 0 110 if (e->samplesUntilNextSegment > 0)
1049 0 110 if (e->samplesUntilNextSegment > 0)
1053 0 0 if (e->isAmpEnv)
1059 0 0 if (e->parameters.sustain > 0.0f)
1088 53 53 if (e->isAmpEnv)
1113 0 110 if (e->parameters.keynumToHold)
1116 0 0 e->parameters.hold = (e->parameters.hold < -10000.0f ? 0.0f : tsf_timecents2Secsf(e->parameters.hold));
1118 0 110 if (e->parameters.keynumToDecay)
1121 0 0 e->parameters.decay = (e->parameters.decay < -10000.0f ? 0.0f : tsf_timecents2Secsf(e->parameters.decay));
1130 371 38278 if (e->slope)
1132 371 0 if (e->segmentIsExponential) e->level *= TSF_POWF(e->slope, (float)numSamples);
1135 53 38596 if ((e->samplesUntilNextSegment -= numSamples) <= 0)
1164 0 0 if (e->samplesUntil > blockSamples) { e->samplesUntil -= blockSamples; return; }
1166 0 0 if (e->level > 1.0f) { e->delta = -e->delta; e->level = 2.0f - e->level; }
1167 0 0 else if (e->level < -1.0f) { e->delta = -e->delta; e->level = -2.0f - e->level; }
1180 0 53 int repeats = (f->maxVoiceNum ? 2 : 1);
1181 53 53 while (repeats--)
1185 0 53 if (v->region->loop_mode == TSF_LOOPMODE_SUSTAIN)
1198 0 0 int repeats = (f->maxVoiceNum ? 2 : 1);
1199 0 0 while (repeats--)
1210 0 55 if (pitchShift) adjustedPitch += pitchShift;
1220 0 4866 float* outR = (f->outputmode == TSF_STEREO_UNWEAVED ? outL + numSamples : TSF_NULL);
1223 4866 0 TSF_BOOL updateModEnv = (region->modEnvToPitch || region->modEnvToFilterFc);
0 4866 TSF_BOOL updateModEnv = (region->modEnvToPitch || region->modEnvToFilterFc);
1224 4866 0 TSF_BOOL updateModLFO = (v->modlfo.delta && (region->modLfoToPitch || region->modLfoToFilterFc || region->modLfoToVolume));
4866 0 TSF_BOOL updateModLFO = (v->modlfo.delta && (region->modLfoToPitch || region->modLfoToFilterFc || region->modLfoToVolume));
4866 0 TSF_BOOL updateModLFO = (v->modlfo.delta && (region->modLfoToPitch || region->modLfoToFilterFc || region->modLfoToVolume));
0 4866 TSF_BOOL updateModLFO = (v->modlfo.delta && (region->modLfoToPitch || region->modLfoToFilterFc || region->modLfoToVolume));
1225 4866 0 TSF_BOOL updateVibLFO = (v->viblfo.delta && (region->vibLfoToPitch));
0 4866 TSF_BOOL updateVibLFO = (v->viblfo.delta && (region->vibLfoToPitch));
1232 4866 0 TSF_BOOL dynamicLowpass = (region->modLfoToFilterFc || region->modEnvToFilterFc);
0 4866 TSF_BOOL dynamicLowpass = (region->modLfoToFilterFc || region->modEnvToFilterFc);
1235 4866 0 TSF_BOOL dynamicPitchRatio = (region->modLfoToPitch || region->modEnvToPitch || region->vibLfoToPitch);
4866 0 TSF_BOOL dynamicPitchRatio = (region->modLfoToPitch || region->modEnvToPitch || region->vibLfoToPitch);
0 4866 TSF_BOOL dynamicPitchRatio = (region->modLfoToPitch || region->modEnvToPitch || region->vibLfoToPitch);
1242 0 4866 if (dynamicLowpass) tmpInitialFilterFc = (float)region->initialFilterFc, tmpModLfoToFilterFc = (float)region->modLfoToFilterFc, tmpModEnvToFilterFc = (float)region->modEnvToFilterFc;
1245 0 4866 if (dynamicPitchRatio) pitchRatio = 0, tmpModLfoToPitch = (float)region->modLfoToPitch, tmpVibLfoToPitch = (float)region->vibLfoToPitch, tmpModEnvToPitch = (float)region->modEnvToPitch;
1248 0 4866 if (dynamicGain) tmpModLfoToVolume = (float)region->modLfoToVolume * 0.1f;
1251 38649 4813 while (numSamples)
1257 0 38649 if (dynamicLowpass)
1260 0 0 float lowpassFc = (fres <= 13500 ? tsf_cents2Hertz(fres) / tmpSampleRate : 1.0f);
1262 0 0 if (tmpLowpass.active) tsf_voice_lowpass_setup(&tmpLowpass, lowpassFc);
1265 0 38649 if (dynamicPitchRatio)
1268 0 38649 if (dynamicGain)
1275 0 38649 if (updateModEnv) tsf_voice_envelope_process(&v->modenv, blockSamples, tmpSampleRate);
1278 0 38649 if (updateModLFO) tsf_voice_lfo_process(&v->modlfo, blockSamples);
1279 0 38649 if (updateVibLFO) tsf_voice_lfo_process(&v->viblfo, blockSamples);
1285 0 0 while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
0 0 while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
1287 0 0 unsigned int pos = (unsigned int)tmpSourceSamplePosition, nextPos = (pos >= tmpLoopEnd && isLooping ? tmpLoopStart : pos + 1);
0 0 unsigned int pos = (unsigned int)tmpSourceSamplePosition, nextPos = (pos >= tmpLoopEnd && isLooping ? tmpLoopStart : pos + 1);
1293 0 0 if (tmpLowpass.active) val = tsf_voice_lowpass_process(&tmpLowpass, val);
1300 0 0 if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
0 0 if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
1306 0 0 while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
0 0 while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
1308 0 0 unsigned int pos = (unsigned int)tmpSourceSamplePosition, nextPos = (pos >= tmpLoopEnd && isLooping ? tmpLoopStart : pos + 1);
0 0 unsigned int pos = (unsigned int)tmpSourceSamplePosition, nextPos = (pos >= tmpLoopEnd && isLooping ? tmpLoopStart : pos + 1);
1314 0 0 if (tmpLowpass.active) val = tsf_voice_lowpass_process(&tmpLowpass, val);
1321 0 0 if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
0 0 if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
1326 2471294 38649 while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
2471294 0 while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
1328 50340 2420954 unsigned int pos = (unsigned int)tmpSourceSamplePosition, nextPos = (pos >= tmpLoopEnd && isLooping ? tmpLoopStart : pos + 1);
0 50340 unsigned int pos = (unsigned int)tmpSourceSamplePosition, nextPos = (pos >= tmpLoopEnd && isLooping ? tmpLoopStart : pos + 1);
1334 2471294 0 if (tmpLowpass.active) val = tsf_voice_lowpass_process(&tmpLowpass, val);
1340 66865 2404429 if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
66865 0 if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
1345 38649 0 if (tmpSourceSamplePosition >= tmpSampleEndDbl || v->ampenv.segment == TSF_SEGMENT_DONE)
53 38596 if (tmpSourceSamplePosition >= tmpSampleEndDbl || v->ampenv.segment == TSF_SEGMENT_DONE)
1353 0 4813 if (tmpLowpass.active || dynamicLowpass) v->lowpass = tmpLowpass;
0 0 if (tmpLowpass.active || dynamicLowpass) v->lowpass = tmpLowpass;
1366 14 1 if (!tsf_riffchunk_read(TSF_NULL, &chunkHead, stream) || !TSF_FourCCEquals(chunkHead.id, "sfbk"))
13 1 if (!tsf_riffchunk_read(TSF_NULL, &chunkHead, stream) || !TSF_FourCCEquals(chunkHead.id, "sfbk"))
13 0 if (!tsf_riffchunk_read(TSF_NULL, &chunkHead, stream) || !TSF_FourCCEquals(chunkHead.id, "sfbk"))
13 0 if (!tsf_riffchunk_read(TSF_NULL, &chunkHead, stream) || !TSF_FourCCEquals(chunkHead.id, "sfbk"))
0 13 if (!tsf_riffchunk_read(TSF_NULL, &chunkHead, stream) || !TSF_FourCCEquals(chunkHead.id, "sfbk"))
1374 39 13 while (tsf_riffchunk_read(&chunkHead, &chunkList, stream))
1377 13 26 if (TSF_FourCCEquals(chunkList.id, "pdta"))
13 0 if (TSF_FourCCEquals(chunkList.id, "pdta"))
13 0 if (TSF_FourCCEquals(chunkList.id, "pdta"))
13 0 if (TSF_FourCCEquals(chunkList.id, "pdta"))
1379 117 13 while (tsf_riffchunk_read(&chunkList, &chunk, stream))
1395 52 65 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 39 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 0 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 0 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 0 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
0 13 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
39 13 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
39 65 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 26 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 0 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 0 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 0 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
0 13 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
39 13 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
26 65 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 13 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 0 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 0 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 0 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
0 13 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
13 13 if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
1396 13 65 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 0 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 0 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 0 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 0 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
0 13 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
39 13 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
52 13 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 39 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 0 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 0 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 0 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
0 13 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
26 13 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
39 13 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 26 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 0 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 0 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
13 0 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
0 13 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
26 13 else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
1397 26 13 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 13 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
0 13 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 13 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 13 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
0 13 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
39 13 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
13 0 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
0 13 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
26 13 else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
1402 13 13 else if (TSF_FourCCEquals(chunkList.id, "sdta"))
13 0 else if (TSF_FourCCEquals(chunkList.id, "sdta"))
13 0 else if (TSF_FourCCEquals(chunkList.id, "sdta"))
13 0 else if (TSF_FourCCEquals(chunkList.id, "sdta"))
1404 13 13 while (tsf_riffchunk_read(&chunkList, &chunk, stream))
1406 13 0 if ((TSF_FourCCEquals(chunk.id, "smpl")
13 0 if ((TSF_FourCCEquals(chunk.id, "smpl")
13 0 if ((TSF_FourCCEquals(chunk.id, "smpl")
13 0 if ((TSF_FourCCEquals(chunk.id, "smpl")
1410 13 0 ) && !rawBuffer && !floatBuffer && chunk.size >= sizeof(short))
13 0 ) && !rawBuffer && !floatBuffer && chunk.size >= sizeof(short))
13 0 ) && !rawBuffer && !floatBuffer && chunk.size >= sizeof(short))
1412 0 13 if (!tsf_load_samples(&rawBuffer, &floatBuffer, &smplCount, &chunk, stream)) goto out_of_memory;
1419 13 0 if (!hydra.phdrs || !hydra.pbags || !hydra.pmods || !hydra.pgens || !hydra.insts || !hydra.ibags || !hydra.imods || !hydra.igens || !hydra.shdrs)
13 0 if (!hydra.phdrs || !hydra.pbags || !hydra.pmods || !hydra.pgens || !hydra.insts || !hydra.ibags || !hydra.imods || !hydra.igens || !hydra.shdrs)
13 0 if (!hydra.phdrs || !hydra.pbags || !hydra.pmods || !hydra.pgens || !hydra.insts || !hydra.ibags || !hydra.imods || !hydra.igens || !hydra.shdrs)
13 0 if (!hydra.phdrs || !hydra.pbags || !hydra.pmods || !hydra.pgens || !hydra.insts || !hydra.ibags || !hydra.imods || !hydra.igens || !hydra.shdrs)
13 0 if (!hydra.phdrs || !hydra.pbags || !hydra.pmods || !hydra.pgens || !hydra.insts || !hydra.ibags || !hydra.imods || !hydra.igens || !hydra.shdrs)
13 0 if (!hydra.phdrs || !hydra.pbags || !hydra.pmods || !hydra.pgens || !hydra.insts || !hydra.ibags || !hydra.imods || !hydra.igens || !hydra.shdrs)
13 0 if (!hydra.phdrs || !hydra.pbags || !hydra.pmods || !hydra.pgens || !hydra.insts || !hydra.ibags || !hydra.imods || !hydra.igens || !hydra.shdrs)
13 0 if (!hydra.phdrs || !hydra.pbags || !hydra.pmods || !hydra.pgens || !hydra.insts || !hydra.ibags || !hydra.imods || !hydra.igens || !hydra.shdrs)
13 0 if (!hydra.phdrs || !hydra.pbags || !hydra.pmods || !hydra.pgens || !hydra.insts || !hydra.ibags || !hydra.imods || !hydra.igens || !hydra.shdrs)
1423 13 0 else if (!rawBuffer && !floatBuffer)
0 13 else if (!rawBuffer && !floatBuffer)
1433 13 0 if (res) TSF_MEMSET(res, 0, sizeof(tsf));
1434 13 0 if (!res || !tsf_load_presets(res, &hydra, smplCount)) goto out_of_memory;
0 13 if (!res || !tsf_load_presets(res, &hydra, smplCount)) goto out_of_memory;
1456 0 0 if (!f) return TSF_NULL;
1457 0 0 if (!f->refCount)
1460 0 0 if (!f->refCount) return TSF_NULL;
1464 0 0 if (!res) return TSF_NULL;
1475 0 0 if (!f) return;
1476 0 0 if (!f->refCount || !--(*f->refCount))
0 0 if (!f->refCount || !--(*f->refCount))
1479 0 0 for (; preset != presetEnd; preset++) TSF_FREE(preset->regions);
1492 0 0 for (; v != vEnd; v++)
1493 0 0 if (v->playingPreset != -1 && (v->ampenv.segment < TSF_SEGMENT_RELEASE || v->ampenv.parameters.release))
0 0 if (v->playingPreset != -1 && (v->ampenv.segment < TSF_SEGMENT_RELEASE || v->ampenv.parameters.release))
0 0 if (v->playingPreset != -1 && (v->ampenv.segment < TSF_SEGMENT_RELEASE || v->ampenv.parameters.release))
1495 0 0 if (f->channels) { TSF_FREE(f->channels); f->channels = TSF_NULL; }
1502 0 0 for (presets = f->presets, i = 0, iMax = f->presetNum; i < iMax; i++)
1503 0 0 if (presets[i].preset == preset_number && presets[i].bank == bank)
0 0 if (presets[i].preset == preset_number && presets[i].bank == bank)
1515 39 0 return (preset < 0 || preset >= f->presetNum ? TSF_NULL : f->presets[preset].presetName);
27 12 return (preset < 0 || preset >= f->presetNum ? TSF_NULL : f->presets[preset].presetName);
1526 13 0 f->outSampleRate = (float)(samplerate >= 1 ? samplerate : 44100.0f);
1532 50 7 f->globalGainDB = (global_volume == 1.0f ? 0 : -tsf_gainToDecibels(1.0f / global_volume));
1540 0 0 if (!newVoices) return 0;
1543 0 0 for (; i < max_voices; i++)
1554 57 0 if (preset_index < 0 || preset_index >= f->presetNum) return 1;
0 57 if (preset_index < 0 || preset_index >= f->presetNum) return 1;
1555 2 55 if (vel <= 0.0f) { tsf_note_off(f, preset_index, key); return 1; }
1559 55 55 for (region = f->presets[preset_index].regions, regionEnd = region + f->presets[preset_index].regionNum; region != regionEnd; region++)
1562 55 0 if (key < region->lokey || key > region->hikey || midiVelocity < region->lovel || midiVelocity > region->hivel) continue;
55 0 if (key < region->lokey || key > region->hikey || midiVelocity < region->lovel || midiVelocity > region->hivel) continue;
55 0 if (key < region->lokey || key > region->hikey || midiVelocity < region->lovel || midiVelocity > region->hivel) continue;
0 55 if (key < region->lokey || key > region->hikey || midiVelocity < region->lovel || midiVelocity > region->hivel) continue;
1565 0 55 if (region->group)
1567 0 0 for (; v != vEnd; v++)
1568 0 0 if (v->playingPreset == preset_index && v->region->group == region->group) tsf_voice_endquick(f, v);
0 0 if (v->playingPreset == preset_index && v->region->group == region->group) tsf_voice_endquick(f, v);
1569 0 0 else if (v->playingPreset == -1 && !voice) voice = v;
0 0 else if (v->playingPreset == -1 && !voice) voice = v;
1571 48 4 else for (; v != vEnd; v++) if (v->playingPreset == -1) { voice = v; break; }
52 7 else for (; v != vEnd; v++) if (v->playingPreset == -1) { voice = v; break; }
1573 7 48 if (!voice)
1575 0 7 if (f->maxVoiceNum)
1579 0 0 for (v = f->voices; v != vEnd; v++)
1581 0 0 if (v->ampenv.segment == TSF_SEGMENT_RELEASE)
1585 0 0 if (releaseSamplesDone > bestKillReleaseSamplePos)
1592 0 0 if (!voice)
1602 0 7 if (!newVoices) return 0;
1615 0 55 if (f->channels)
1631 55 0 doLoop = (region->loop_mode != TSF_LOOPMODE_NONE && region->loop_start < region->loop_end);
55 0 doLoop = (region->loop_mode != TSF_LOOPMODE_NONE && region->loop_start < region->loop_end);
1632 55 0 voice->loopStart = (doLoop ? region->loop_start : 0);
1633 55 0 voice->loopEnd = (doLoop ? region->loop_end : 0);
1640 55 0 lowpassFc = (region->initialFilterFc <= 13500 ? tsf_cents2Hertz((float)region->initialFilterFc) / f->outSampleRate : 1.0f);
1645 55 0 if (voice->lowpass.active) tsf_voice_lowpass_setup(&voice->lowpass, lowpassFc);
1657 0 0 if (preset_index == -1) return 0;
1664 228 57 for (; v != vEnd; v++)
1667 58 170 if (v->playingPreset != preset_index || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE) continue;
53 5 if (v->playingPreset != preset_index || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE) continue;
0 53 if (v->playingPreset != preset_index || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE) continue;
1668 0 53 else if (!vMatchFirst || v->playIndex < vMatchFirst->playIndex) vMatchFirst = vMatchLast = v;
0 0 else if (!vMatchFirst || v->playIndex < vMatchFirst->playIndex) vMatchFirst = vMatchLast = v;
1669 0 0 else if (v->playIndex == vMatchFirst->playIndex) vMatchLast = v;
1671 4 53 if (!vMatchFirst) return;
1672 53 53 for (v = vMatchFirst; v <= vMatchLast; v++)
1675 0 53 if (v != vMatchFirst && v != vMatchLast &&
0 0 if (v != vMatchFirst && v != vMatchLast &&
1676 0 0 (v->playIndex != vMatchFirst->playIndex || v->playingPreset != preset_index || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE)) continue;
0 0 (v->playIndex != vMatchFirst->playIndex || v->playingPreset != preset_index || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE)) continue;
0 0 (v->playIndex != vMatchFirst->playIndex || v->playingPreset != preset_index || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE)) continue;
0 0 (v->playIndex != vMatchFirst->playIndex || v->playingPreset != preset_index || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE)) continue;
1684 0 0 if (preset_index == -1) return 0;
1692 0 0 for (; v != vEnd; v++) if (v->playingPreset != -1 && v->ampenv.segment < TSF_SEGMENT_RELEASE)
0 0 for (; v != vEnd; v++) if (v->playingPreset != -1 && v->ampenv.segment < TSF_SEGMENT_RELEASE)
0 0 for (; v != vEnd; v++) if (v->playingPreset != -1 && v->ampenv.segment < TSF_SEGMENT_RELEASE)
1700 41 423 for (; v != vEnd; v++) if (v->playingPreset != -1) count++;
464 121 for (; v != vEnd; v++) if (v->playingPreset != -1) count++;
1707 90 0 int channels = (f->outputmode == TSF_MONO ? 1 : 2), maxChannelSamples = TSF_RENDER_SHORTBUFFERBLOCK / channels;
1708 7552 90 while (samples > 0)
1716 0 7552 if (flag_mixing)
1717 0 0 while (buffer != bufferEnd)
1720 0 0 int vi = *buffer + (v < -1.00004566f ? (int)-32768 : (v > 1.00001514f ? (int)32767 : (int)(v * 32767.5f)));
0 0 int vi = *buffer + (v < -1.00004566f ? (int)-32768 : (v > 1.00001514f ? (int)32767 : (int)(v * 32767.5f)));
1721 0 0 *buffer++ = (vi < -32768 ? (short)-32768 : (vi > 32767 ? (short)32767 : (short)vi));
0 0 *buffer++ = (vi < -32768 ? (short)-32768 : (vi > 32767 ? (short)32767 : (short)vi));
1724 3843664 7552 while (buffer != bufferEnd)
1727 0 3843664 *buffer++ = (v < -1.00004566f ? (short)-32768 : (v > 1.00001514f ? (short)32767 : (short)(v * 32767.5f)));
0 3843664 *buffer++ = (v < -1.00004566f ? (short)-32768 : (v > 1.00001514f ? (short)32767 : (short)(v * 32767.5f)));
1735 7552 0 if (!flag_mixing) TSF_MEMSET(buffer, 0, (f->outputmode == TSF_MONO ? 1 : 2) * sizeof(float) * samples);
7552 0 if (!flag_mixing) TSF_MEMSET(buffer, 0, (f->outputmode == TSF_MONO ? 1 : 2) * sizeof(float) * samples);
1736 30208 7552 for (; v != vEnd; v++)
1737 4866 25342 if (v->playingPreset != -1)
1747 0 0 tsf_voice_calcpitchratio(v, (c->pitchWheel == 8192 ? c->tuning : ((c->pitchWheel / 16383.0f * c->pitchRange * 2.0f) - c->pitchRange + c->tuning)), f->outSampleRate);
1748 0 0 if (newpan <= -0.5f) { v->panFactorLeft = 1.0f; v->panFactorRight = 0.0f; }
1749 0 0 else if (newpan >= 0.5f) { v->panFactorLeft = 0.0f; v->panFactorRight = 1.0f; }
1756 0 0 if (f->channels && channel < f->channels->channelNum) return &f->channels->channels[channel];
0 0 if (f->channels && channel < f->channels->channelNum) return &f->channels->channels[channel];
1757 0 0 if (!f->channels)
1760 0 0 if (!f->channels) return TSF_NULL;
1768 0 0 if (!newChannels) return TSF_NULL;
1773 0 0 for (; i <= channel; i++)
1792 0 0 float pitchShift = (c->pitchWheel == 8192 ? c->tuning : ((c->pitchWheel / 16383.0f * c->pitchRange * 2.0f) - c->pitchRange + c->tuning));
1793 0 0 for (v = f->voices, vEnd = v + f->voiceNum; v != vEnd; v++)
1794 0 0 if (v->playingPreset != -1 && v->playingChannel == channel)
0 0 if (v->playingPreset != -1 && v->playingChannel == channel)
1801 0 0 if (!c) return 0;
1810 0 0 if (!c) return 0;
1811 0 0 if (flag_mididrums)
1814 0 0 if (preset_index == -1) preset_index = tsf_get_presetindex(f, 128, preset_number);
1815 0 0 if (preset_index == -1) preset_index = tsf_get_presetindex(f, 128, 0);
1816 0 0 if (preset_index == -1) preset_index = tsf_get_presetindex(f, (c->bank & 0x7FFF), preset_number);
1819 0 0 if (preset_index == -1) preset_index = tsf_get_presetindex(f, 0, preset_number);
1820 0 0 if (preset_index != -1)
1831 0 0 if (!c) return 0;
1840 0 0 if (!c) return 0;
1842 0 0 if (preset_index == -1) return 0;
1852 0 0 if (!c) return 0;
1853 0 0 for (v = f->voices, vEnd = v + f->voiceNum; v != vEnd; v++)
1854 0 0 if (v->playingChannel == channel && v->playingPreset != -1)
0 0 if (v->playingChannel == channel && v->playingPreset != -1)
1857 0 0 if (newpan <= -0.5f) { v->panFactorLeft = 1.0f; v->panFactorRight = 0.0f; }
1858 0 0 else if (newpan >= 0.5f) { v->panFactorLeft = 0.0f; v->panFactorRight = 1.0f; }
1870 0 0 if (!c) return 0;
1871 0 0 if (gainDB == c->gainDB) return 1;
1872 0 0 for (v = f->voices, vEnd = v + f->voiceNum, gainDBChange = gainDB - c->gainDB; v != vEnd; v++)
1873 0 0 if (v->playingPreset != -1 && v->playingChannel == channel)
0 0 if (v->playingPreset != -1 && v->playingChannel == channel)
1882 0 0 if (!c) return 0;
1883 0 0 if (c->pitchWheel == pitch_wheel) return 1;
1892 0 0 if (!c) return 0;
1893 0 0 if (c->pitchRange == pitch_range) return 1;
1895 0 0 if (c->pitchWheel != 8192) tsf_channel_applypitch(f, channel, c);
1902 0 0 if (!c) return 0;
1903 0 0 if (c->tuning == tuning) return 1;
1911 0 0 if (!f->channels || channel >= f->channels->channelNum) return 1;
0 0 if (!f->channels || channel >= f->channels->channelNum) return 1;
1919 0 0 for (; v != vEnd; v++)
1922 0 0 if (v->playingPreset == -1 || v->playingChannel != channel || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE) continue;
0 0 if (v->playingPreset == -1 || v->playingChannel != channel || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE) continue;
0 0 if (v->playingPreset == -1 || v->playingChannel != channel || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE) continue;
0 0 if (v->playingPreset == -1 || v->playingChannel != channel || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE) continue;
1923 0 0 else if (!vMatchFirst || v->playIndex < vMatchFirst->playIndex) vMatchFirst = vMatchLast = v;
0 0 else if (!vMatchFirst || v->playIndex < vMatchFirst->playIndex) vMatchFirst = vMatchLast = v;
1924 0 0 else if (v->playIndex == vMatchFirst->playIndex) vMatchLast = v;
1926 0 0 if (!vMatchFirst) return;
1927 0 0 for (v = vMatchFirst; v <= vMatchLast; v++)
1930 0 0 if (v != vMatchFirst && v != vMatchLast &&
0 0 if (v != vMatchFirst && v != vMatchLast &&
1931 0 0 (v->playIndex != vMatchFirst->playIndex || v->playingPreset == -1 || v->playingChannel != channel || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE)) continue;
0 0 (v->playIndex != vMatchFirst->playIndex || v->playingPreset == -1 || v->playingChannel != channel || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE)) continue;
0 0 (v->playIndex != vMatchFirst->playIndex || v->playingPreset == -1 || v->playingChannel != channel || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE)) continue;
0 0 (v->playIndex != vMatchFirst->playIndex || v->playingPreset == -1 || v->playingChannel != channel || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE)) continue;
0 0 (v->playIndex != vMatchFirst->playIndex || v->playingPreset == -1 || v->playingChannel != channel || v->playingKey != key || v->ampenv.segment >= TSF_SEGMENT_RELEASE)) continue;
1939 0 0 for (; v != vEnd; v++)
1940 0 0 if (v->playingPreset != -1 && v->playingChannel == channel && v->ampenv.segment < TSF_SEGMENT_RELEASE)
0 0 if (v->playingPreset != -1 && v->playingChannel == channel && v->ampenv.segment < TSF_SEGMENT_RELEASE)
0 0 if (v->playingPreset != -1 && v->playingChannel == channel && v->ampenv.segment < TSF_SEGMENT_RELEASE)
1947 0 0 for (; v != vEnd; v++)
1948 0 0 if (v->playingPreset != -1 && v->playingChannel == channel && (v->ampenv.segment < TSF_SEGMENT_RELEASE || v->ampenv.parameters.release))
0 0 if (v->playingPreset != -1 && v->playingChannel == channel && (v->ampenv.segment < TSF_SEGMENT_RELEASE || v->ampenv.parameters.release))
0 0 if (v->playingPreset != -1 && v->playingChannel == channel && (v->ampenv.segment < TSF_SEGMENT_RELEASE || v->ampenv.parameters.release))
0 0 if (v->playingPreset != -1 && v->playingChannel == channel && (v->ampenv.segment < TSF_SEGMENT_RELEASE || v->ampenv.parameters.release))
1955 0 0 if (!c) return 0;
1967 0 0 case 32 /*BANK_SELECT_LSB*/ : c->bank = (unsigned short)((c->bank & 0x8000 ? ((c->bank & 0x7F) << 7) : 0) | control_value); return 1;
1968 0 0 case 101 /*RPN_MSB*/ : c->midiRPN = (unsigned short)(((c->midiRPN == 0xFFFF ? 0 : c->midiRPN) & 0x7F ) | (control_value << 7)); return 1;
1969 0 0 case 100 /*RPN_LSB*/ : c->midiRPN = (unsigned short)(((c->midiRPN == 0xFFFF ? 0 : c->midiRPN) & 0x3F80) | control_value); return 1;
1995 0 0 if (c->midiRPN == 0) tsf_channel_set_pitchrange(f, channel, (c->midiData >> 7) + 0.01f * (c->midiData & 0x7F));
1996 0 0 else if (c->midiRPN == 1) tsf_channel_set_tuning(f, channel, (int)c->tuning + ((float)c->midiData - 8192.0f) / 8192.0f); //fine tune
1997 0 0 else if (c->midiRPN == 2 && controller == 6) tsf_channel_set_tuning(f, channel, ((float)control_value - 64.0f) + (c->tuning - (int)c->tuning)); //coarse tune
0 0 else if (c->midiRPN == 2 && controller == 6) tsf_channel_set_tuning(f, channel, ((float)control_value - 64.0f) + (c->tuning - (int)c->tuning)); //coarse tune
2003 0 0 return (f->channels && channel < f->channels->channelNum ? f->channels->channels[channel].presetIndex : 0);
0 0 return (f->channels && channel < f->channels->channelNum ? f->channels->channels[channel].presetIndex : 0);
2008 0 0 return (f->channels && channel < f->channels->channelNum ? (f->channels->channels[channel].bank & 0x7FFF) : 0);
0 0 return (f->channels && channel < f->channels->channelNum ? (f->channels->channels[channel].bank & 0x7FFF) : 0);
2013 0 0 return (f->channels && channel < f->channels->channelNum ? f->presets[f->channels->channels[channel].presetIndex].preset : 0);
0 0 return (f->channels && channel < f->channels->channelNum ? f->presets[f->channels->channels[channel].presetIndex].preset : 0);
2018 0 0 return (f->channels && channel < f->channels->channelNum ? f->channels->channels[channel].panOffset - 0.5f : 0.5f);
0 0 return (f->channels && channel < f->channels->channelNum ? f->channels->channels[channel].panOffset - 0.5f : 0.5f);
2023 0 0 return (f->channels && channel < f->channels->channelNum ? tsf_decibelsToGain(f->channels->channels[channel].gainDB) : 1.0f);
0 0 return (f->channels && channel < f->channels->channelNum ? tsf_decibelsToGain(f->channels->channels[channel].gainDB) : 1.0f);
2028 0 0 return (f->channels && channel < f->channels->channelNum ? f->channels->channels[channel].pitchWheel : 8192);
0 0 return (f->channels && channel < f->channels->channelNum ? f->channels->channels[channel].pitchWheel : 8192);
2033 0 0 return (f->channels && channel < f->channels->channelNum ? f->channels->channels[channel].pitchRange : 2.0f);
0 0 return (f->channels && channel < f->channels->channelNum ? f->channels->channels[channel].pitchRange : 2.0f);
2038 0 0 return (f->channels && channel < f->channels->channelNum ? f->channels->channels[channel].tuning : 0.0f);
0 0 return (f->channels && channel < f->channels->channelNum ? f->channels->channels[channel].tuning : 0.0f);