line |
true |
false |
branch |
330
|
0 |
11 |
if (!f)
|
343
|
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; }
|
344
|
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; }
|
450
|
107 |
12 |
static float tsf_decibelsToGain(float db) { return (db > -100.f ? TSF_POWF(10.0f, db * 0.05f) : 0); }
|
451
|
0 |
105 |
static float tsf_gainToDecibels(float gain) { return (gain <= .00001f ? -100.f : (float)(20.0 * TSF_LOG10(gain))); }
|
456
|
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;
|
457
|
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;
|
458
|
0 |
183 |
if (!stream->read(stream->data, &chunk->size, sizeof(tsf_u32))) return TSF_FALSE;
|
459
|
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;
|
460
|
169 |
14 |
if (parent) parent->size -= sizeof(tsf_fourcc) + sizeof(tsf_u32) + chunk->size;
|
461
|
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");
|
462
|
13 |
170 |
if (IsRiff && parent) return TSF_FALSE; //not allowed
|
|
0 |
13 |
if (IsRiff && parent) return TSF_FALSE; //not allowed
|
463
|
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
|
464
|
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;
|
474
|
26 |
26 |
if (for_relative) return;
|
587
|
26 |
26 |
if (amount)
|
590
|
0 |
26 |
if (genOper >= _GEN_MAX) return;
|
600
|
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;
|
607
|
1534 |
26 |
for (genOper = 0; genOper != _GEN_MAX; genOper++)
|
628
|
0 |
520 |
if (*val < vmin) *val = vmin;
|
629
|
0 |
520 |
else if (*val > vmax) *val = vmax;
|
645
|
0 |
260 |
if (*val < vmin) *val = vmin;
|
646
|
0 |
260 |
else if (*val > vmax) *val = vmax;
|
664
|
52 |
0 |
p->delay = (p->delay < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->delay));
|
665
|
52 |
0 |
p->attack = (p->attack < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->attack));
|
666
|
52 |
0 |
p->release = (p->release < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->release));
|
670
|
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));
|
671
|
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));
|
673
|
0 |
52 |
if (p->sustain < 0.0f) p->sustain = 0.0f;
|
674
|
26 |
26 |
else if (sustainIsGain) p->sustain = tsf_decibelsToGain(-p->sustain / 10.0f);
|
683
|
26 |
13 |
for (pphdr = hydra->phdrs, pphdrMax = pphdr + hydra->phdrNum - 1; pphdr != pphdrMax; pphdr++)
|
690
|
52 |
26 |
for (otherphdr = hydra->phdrs; otherphdr != pphdrMax; otherphdr++)
|
692
|
26 |
26 |
if (otherphdr == pphdr || otherphdr->bank > pphdr->bank) continue;
|
|
0 |
26 |
if (otherphdr == pphdr || otherphdr->bank > pphdr->bank) continue;
|
693
|
0 |
26 |
else if (otherphdr->bank < pphdr->bank) sortedIndex++;
|
694
|
0 |
26 |
else if (otherphdr->preset > pphdr->preset) continue;
|
695
|
0 |
26 |
else if (otherphdr->preset < pphdr->preset) sortedIndex++;
|
696
|
13 |
13 |
else if (otherphdr < pphdr) sortedIndex++;
|
707
|
26 |
26 |
for (ppbag = hydra->pbags + pphdr->presetBagNdx, ppbagEnd = hydra->pbags + pphdr[1].presetBagNdx; ppbag != ppbagEnd; ppbag++)
|
711
|
26 |
26 |
for (ppgen = hydra->pgens + ppbag->genNdx, ppgenEnd = hydra->pgens + ppbag[1].genNdx; ppgen != ppgenEnd; ppgen++)
|
713
|
0 |
26 |
if (ppgen->genOper == GenKeyRange) { plokey = ppgen->genAmount.range.lo; phikey = ppgen->genAmount.range.hi; continue; }
|
714
|
0 |
26 |
if (ppgen->genOper == GenVelRange) { plovel = ppgen->genAmount.range.lo; phivel = ppgen->genAmount.range.hi; continue; }
|
715
|
0 |
26 |
if (ppgen->genOper != GenInstrument) continue;
|
716
|
0 |
26 |
if (ppgen->genAmount.wordAmount >= hydra->instNum) continue;
|
718
|
26 |
26 |
for (pibag = hydra->ibags + pinst->instBagNdx, pibagEnd = hydra->ibags + pinst[1].instBagNdx; pibag != pibagEnd; pibag++)
|
721
|
52 |
26 |
for (pigen = hydra->igens + pibag->instGenNdx, pigenEnd = hydra->igens + pibag[1].instGenNdx; pigen != pigenEnd; pigen++)
|
723
|
0 |
52 |
if (pigen->genOper == GenKeyRange) { ilokey = pigen->genAmount.range.lo; ihikey = pigen->genAmount.range.hi; continue; }
|
724
|
0 |
52 |
if (pigen->genOper == GenVelRange) { ilovel = pigen->genAmount.range.lo; ihivel = pigen->genAmount.range.hi; continue; }
|
725
|
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++;
|
735
|
26 |
26 |
for (ppbag = hydra->pbags + pphdr->presetBagNdx, ppbagEnd = hydra->pbags + pphdr[1].presetBagNdx; ppbag != ppbagEnd; ppbag++)
|
742
|
26 |
26 |
for (ppgen = hydra->pgens + ppbag->genNdx, ppgenEnd = hydra->pgens + ppbag[1].genNdx; ppgen != ppgenEnd; ppgen++)
|
745
|
26 |
0 |
if (ppgen->genOper == GenInstrument)
|
749
|
0 |
26 |
if (whichInst >= hydra->instNum) continue;
|
753
|
26 |
26 |
for (pibag = hydra->ibags + pinst->instBagNdx, pibagEnd = hydra->ibags + pinst[1].instBagNdx; pibag != pibagEnd; pibag++)
|
758
|
52 |
26 |
for (pigen = hydra->igens + pibag->instGenNdx, pigenEnd = hydra->igens + pibag[1].instGenNdx; pigen != pigenEnd; pigen++)
|
760
|
26 |
26 |
if (pigen->genOper == GenSampleID)
|
765
|
26 |
0 |
if (zoneRegion.hikey < presetRegion.lokey || zoneRegion.lokey > presetRegion.hikey) continue;
|
|
0 |
26 |
if (zoneRegion.hikey < presetRegion.lokey || zoneRegion.lokey > presetRegion.hikey) continue;
|
766
|
26 |
0 |
if (zoneRegion.hivel < presetRegion.lovel || zoneRegion.lovel > presetRegion.hivel) continue;
|
|
0 |
26 |
if (zoneRegion.hivel < presetRegion.lovel || zoneRegion.lovel > presetRegion.hivel) continue;
|
767
|
0 |
26 |
if (presetRegion.lokey > zoneRegion.lokey) zoneRegion.lokey = presetRegion.lokey;
|
768
|
0 |
26 |
if (presetRegion.hikey < zoneRegion.hikey) zoneRegion.hikey = presetRegion.hikey;
|
769
|
0 |
26 |
if (presetRegion.lovel > zoneRegion.lovel) zoneRegion.lovel = presetRegion.lovel;
|
770
|
0 |
26 |
if (presetRegion.hivel < zoneRegion.hivel) zoneRegion.hivel = presetRegion.hivel;
|
780
|
26 |
0 |
zoneRegion.delayModLFO = (zoneRegion.delayModLFO < -11950.0f ? 0.0f : tsf_timecents2Secsf(zoneRegion.delayModLFO));
|
781
|
26 |
0 |
zoneRegion.delayVibLFO = (zoneRegion.delayVibLFO < -11950.0f ? 0.0f : tsf_timecents2Secsf(zoneRegion.delayVibLFO));
|
789
|
26 |
0 |
if (pshdr->endLoop > 0) zoneRegion.loop_end -= 1;
|
790
|
26 |
0 |
if (zoneRegion.pitch_keycenter == -1) zoneRegion.pitch_keycenter = pshdr->originalPitch;
|
793
|
26 |
0 |
if (zoneRegion.end && zoneRegion.end < fontSampleCount) zoneRegion.end++;
|
|
0 |
26 |
if (zoneRegion.end && zoneRegion.end < fontSampleCount) zoneRegion.end++;
|
804
|
26 |
0 |
if (pibag == hydra->ibags + pinst->instBagNdx && !hadSampleID)
|
|
0 |
26 |
if (pibag == hydra->ibags + pinst->instBagNdx && !hadSampleID)
|
819
|
26 |
0 |
if (ppbag == hydra->pbags + pphdr->presetBagNdx && !hadGenInstrument)
|
|
0 |
26 |
if (ppbag == hydra->pbags + pphdr->presetBagNdx && !hadGenInstrument)
|
831
|
13 |
13 |
for (; samplesLeft; samplesLeft -= samplesToRead)
|
838
|
650 |
13 |
for (samplesToConvert = samplesToRead; samplesToConvert > 0; --samplesToConvert)
|
850
|
0 |
110 |
if (e->samplesUntilNextSegment > 0)
|
861
|
0 |
110 |
if (e->samplesUntilNextSegment > 0)
|
863
|
0 |
0 |
if (!e->isAmpEnv)
|
877
|
0 |
110 |
if (e->samplesUntilNextSegment > 0)
|
888
|
0 |
110 |
if (e->samplesUntilNextSegment > 0)
|
892
|
0 |
0 |
if (e->isAmpEnv)
|
898
|
0 |
0 |
if (e->parameters.sustain > 0.0f)
|
926
|
106 |
0 |
e->samplesUntilNextSegment = (int)((e->parameters.release <= 0 ? TSF_FASTRELEASETIME : e->parameters.release) * outSampleRate);
|
927
|
53 |
53 |
if (e->isAmpEnv)
|
952
|
0 |
110 |
if (e->parameters.keynumToHold)
|
955
|
0 |
0 |
e->parameters.hold = (e->parameters.hold < -10000.0f ? 0.0f : tsf_timecents2Secsf(e->parameters.hold));
|
957
|
0 |
110 |
if (e->parameters.keynumToDecay)
|
960
|
0 |
0 |
e->parameters.decay = (e->parameters.decay < -10000.0f ? 0.0f : tsf_timecents2Secsf(e->parameters.decay));
|
969
|
371 |
38278 |
if (e->slope)
|
971
|
371 |
0 |
if (e->segmentIsExponential) e->level *= TSF_POWF(e->slope, (float)numSamples);
|
974
|
53 |
38596 |
if ((e->samplesUntilNextSegment -= numSamples) <= 0)
|
1003
|
0 |
0 |
if (e->samplesUntil > blockSamples) { e->samplesUntil -= blockSamples; return; }
|
1005
|
0 |
0 |
if (e->level > 1.0f) { e->delta = -e->delta; e->level = 2.0f - e->level; }
|
1006
|
0 |
0 |
else if (e->level < -1.0f) { e->delta = -e->delta; e->level = -2.0f - e->level; }
|
1019
|
0 |
53 |
int repeats = (f->maxVoiceNum ? 2 : 1);
|
1020
|
53 |
53 |
while (repeats--)
|
1024
|
0 |
53 |
if (v->region->loop_mode == TSF_LOOPMODE_SUSTAIN)
|
1037
|
0 |
0 |
int repeats = (f->maxVoiceNum ? 2 : 1);
|
1038
|
0 |
0 |
while (repeats--)
|
1049
|
0 |
55 |
if (pitchShift) adjustedPitch += pitchShift;
|
1059
|
0 |
93 |
float* outR = (f->outputmode == TSF_STEREO_UNWEAVED ? outL + numSamples : TSF_NULL);
|
1062
|
93 |
0 |
TSF_BOOL updateModEnv = (region->modEnvToPitch || region->modEnvToFilterFc);
|
|
0 |
93 |
TSF_BOOL updateModEnv = (region->modEnvToPitch || region->modEnvToFilterFc);
|
1063
|
93 |
0 |
TSF_BOOL updateModLFO = (v->modlfo.delta && (region->modLfoToPitch || region->modLfoToFilterFc || region->modLfoToVolume));
|
|
93 |
0 |
TSF_BOOL updateModLFO = (v->modlfo.delta && (region->modLfoToPitch || region->modLfoToFilterFc || region->modLfoToVolume));
|
|
93 |
0 |
TSF_BOOL updateModLFO = (v->modlfo.delta && (region->modLfoToPitch || region->modLfoToFilterFc || region->modLfoToVolume));
|
|
0 |
93 |
TSF_BOOL updateModLFO = (v->modlfo.delta && (region->modLfoToPitch || region->modLfoToFilterFc || region->modLfoToVolume));
|
1064
|
93 |
0 |
TSF_BOOL updateVibLFO = (v->viblfo.delta && (region->vibLfoToPitch));
|
|
0 |
93 |
TSF_BOOL updateVibLFO = (v->viblfo.delta && (region->vibLfoToPitch));
|
1071
|
93 |
0 |
TSF_BOOL dynamicLowpass = (region->modLfoToFilterFc || region->modEnvToFilterFc);
|
|
0 |
93 |
TSF_BOOL dynamicLowpass = (region->modLfoToFilterFc || region->modEnvToFilterFc);
|
1074
|
93 |
0 |
TSF_BOOL dynamicPitchRatio = (region->modLfoToPitch || region->modEnvToPitch || region->vibLfoToPitch);
|
|
93 |
0 |
TSF_BOOL dynamicPitchRatio = (region->modLfoToPitch || region->modEnvToPitch || region->vibLfoToPitch);
|
|
0 |
93 |
TSF_BOOL dynamicPitchRatio = (region->modLfoToPitch || region->modEnvToPitch || region->vibLfoToPitch);
|
1081
|
0 |
93 |
if (dynamicLowpass) tmpInitialFilterFc = (float)region->initialFilterFc, tmpModLfoToFilterFc = (float)region->modLfoToFilterFc, tmpModEnvToFilterFc = (float)region->modEnvToFilterFc;
|
1084
|
0 |
93 |
if (dynamicPitchRatio) pitchRatio = 0, tmpModLfoToPitch = (float)region->modLfoToPitch, tmpVibLfoToPitch = (float)region->vibLfoToPitch, tmpModEnvToPitch = (float)region->modEnvToPitch;
|
1087
|
0 |
93 |
if (dynamicGain) tmpModLfoToVolume = (float)region->modLfoToVolume * 0.1f;
|
1090
|
38649 |
40 |
while (numSamples)
|
1096
|
0 |
38649 |
if (dynamicLowpass)
|
1099
|
0 |
0 |
float lowpassFc = (fres <= 13500 ? tsf_cents2Hertz(fres) / tmpSampleRate : 1.0f);
|
1101
|
0 |
0 |
if (tmpLowpass.active) tsf_voice_lowpass_setup(&tmpLowpass, lowpassFc);
|
1104
|
0 |
38649 |
if (dynamicPitchRatio)
|
1107
|
0 |
38649 |
if (dynamicGain)
|
1114
|
0 |
38649 |
if (updateModEnv) tsf_voice_envelope_process(&v->modenv, blockSamples, tmpSampleRate);
|
1117
|
0 |
38649 |
if (updateModLFO) tsf_voice_lfo_process(&v->modlfo, blockSamples);
|
1118
|
0 |
38649 |
if (updateVibLFO) tsf_voice_lfo_process(&v->viblfo, blockSamples);
|
1124
|
0 |
0 |
while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
|
|
0 |
0 |
while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
|
1126
|
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);
|
1132
|
0 |
0 |
if (tmpLowpass.active) val = tsf_voice_lowpass_process(&tmpLowpass, val);
|
1139
|
0 |
0 |
if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
|
|
0 |
0 |
if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
|
1145
|
0 |
0 |
while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
|
|
0 |
0 |
while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
|
1147
|
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);
|
1153
|
0 |
0 |
if (tmpLowpass.active) val = tsf_voice_lowpass_process(&tmpLowpass, val);
|
1160
|
0 |
0 |
if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
|
|
0 |
0 |
if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
|
1165
|
2471294 |
38649 |
while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
|
|
2471294 |
0 |
while (blockSamples-- && tmpSourceSamplePosition < tmpSampleEndDbl)
|
1167
|
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);
|
1173
|
2471294 |
0 |
if (tmpLowpass.active) val = tsf_voice_lowpass_process(&tmpLowpass, val);
|
1179
|
66865 |
2404429 |
if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
|
|
66865 |
0 |
if (tmpSourceSamplePosition >= tmpLoopEndDbl && isLooping) tmpSourceSamplePosition -= (tmpLoopEnd - tmpLoopStart + 1.0);
|
1184
|
38649 |
0 |
if (tmpSourceSamplePosition >= tmpSampleEndDbl || v->ampenv.segment == TSF_SEGMENT_DONE)
|
|
53 |
38596 |
if (tmpSourceSamplePosition >= tmpSampleEndDbl || v->ampenv.segment == TSF_SEGMENT_DONE)
|
1192
|
0 |
40 |
if (tmpLowpass.active || dynamicLowpass) v->lowpass = tmpLowpass;
|
|
0 |
0 |
if (tmpLowpass.active || dynamicLowpass) v->lowpass = tmpLowpass;
|
1204
|
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"))
|
1212
|
39 |
13 |
while (tsf_riffchunk_read(&chunkHead, &chunkList, stream))
|
1215
|
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"))
|
1217
|
117 |
13 |
while (tsf_riffchunk_read(&chunkList, &chunk, stream))
|
1232
|
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)
|
|
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)
|
|
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)
|
|
13 |
13 |
if HandleChunk(phdr) else if HandleChunk(pbag) else if HandleChunk(pmod)
|
1233
|
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)
|
|
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)
|
|
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)
|
|
26 |
13 |
else if HandleChunk(pgen) else if HandleChunk(inst) else if HandleChunk(ibag)
|
1234
|
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)
|
|
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)
|
|
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)
|
|
26 |
13 |
else if HandleChunk(imod) else if HandleChunk(igen) else if HandleChunk(shdr)
|
1239
|
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"))
|
1241
|
13 |
13 |
while (tsf_riffchunk_read(&chunkList, &chunk, stream))
|
1243
|
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"))
|
1252
|
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)
|
1256
|
13 |
0 |
else if (fontSamples == TSF_NULL)
|
1281
|
0 |
0 |
if (!f) return;
|
1282
|
0 |
0 |
for (preset = f->presets, presetEnd = preset + f->presetNum; preset != presetEnd; preset++)
|
1287
|
0 |
0 |
if (f->channels) { TSF_FREE(f->channels->channels); TSF_FREE(f->channels); }
|
1295
|
0 |
0 |
for (; v != vEnd; v++)
|
1296
|
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))
|
1298
|
0 |
0 |
if (f->channels) { TSF_FREE(f->channels->channels); TSF_FREE(f->channels); f->channels = TSF_NULL; }
|
1305
|
0 |
0 |
for (presets = f->presets, i = 0, iMax = f->presetNum; i < iMax; i++)
|
1306
|
0 |
0 |
if (presets[i].preset == preset_number && presets[i].bank == bank)
|
|
0 |
0 |
if (presets[i].preset == preset_number && presets[i].bank == bank)
|
1318
|
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);
|
1329
|
13 |
0 |
f->outSampleRate = (float)(samplerate >= 1 ? samplerate : 44100.0f);
|
1335
|
50 |
7 |
f->globalGainDB = (global_volume == 1.0f ? 0 : -tsf_gainToDecibels(1.0f / global_volume));
|
1343
|
0 |
0 |
for (; i != max_voices; i++)
|
1353
|
57 |
0 |
if (preset_index < 0 || preset_index >= f->presetNum) return;
|
|
0 |
57 |
if (preset_index < 0 || preset_index >= f->presetNum) return;
|
1354
|
2 |
55 |
if (vel <= 0.0f) { tsf_note_off(f, preset_index, key); return; }
|
1358
|
55 |
55 |
for (region = f->presets[preset_index].regions, regionEnd = region + f->presets[preset_index].regionNum; region != regionEnd; region++)
|
1361
|
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;
|
1364
|
0 |
55 |
if (region->group)
|
1366
|
0 |
0 |
for (; v != vEnd; v++)
|
1367
|
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);
|
1368
|
0 |
0 |
else if (v->playingPreset == -1 && !voice) voice = v;
|
|
0 |
0 |
else if (v->playingPreset == -1 && !voice) voice = v;
|
1370
|
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; }
|
1372
|
7 |
48 |
if (!voice)
|
1374
|
0 |
7 |
if (f->maxVoiceNum)
|
1391
|
0 |
55 |
if (f->channels)
|
1407
|
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);
|
1408
|
55 |
0 |
voice->loopStart = (doLoop ? region->loop_start : 0);
|
1409
|
55 |
0 |
voice->loopEnd = (doLoop ? region->loop_end : 0);
|
1416
|
55 |
0 |
lowpassFc = (region->initialFilterFc <= 13500 ? tsf_cents2Hertz((float)region->initialFilterFc) / f->outSampleRate : 1.0f);
|
1421
|
55 |
0 |
if (voice->lowpass.active) tsf_voice_lowpass_setup(&voice->lowpass, lowpassFc);
|
1432
|
0 |
0 |
if (preset_index == -1) return 0;
|
1440
|
228 |
57 |
for (; v != vEnd; v++)
|
1443
|
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;
|
1444
|
0 |
53 |
else if (!vMatchFirst || v->playIndex < vMatchFirst->playIndex) vMatchFirst = vMatchLast = v;
|
|
0 |
0 |
else if (!vMatchFirst || v->playIndex < vMatchFirst->playIndex) vMatchFirst = vMatchLast = v;
|
1445
|
0 |
0 |
else if (v->playIndex == vMatchFirst->playIndex) vMatchLast = v;
|
1447
|
4 |
53 |
if (!vMatchFirst) return;
|
1448
|
53 |
53 |
for (v = vMatchFirst; v <= vMatchLast; v++)
|
1451
|
0 |
53 |
if (v != vMatchFirst && v != vMatchLast &&
|
|
0 |
0 |
if (v != vMatchFirst && v != vMatchLast &&
|
|
0 |
0 |
if (v != vMatchFirst && v != vMatchLast &&
|
1452
|
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;
|
1460
|
0 |
0 |
if (preset_index == -1) return 0;
|
1468
|
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)
|
1476
|
41 |
423 |
for (; v != vEnd; v++) if (v->playingPreset != -1) count++;
|
|
464 |
121 |
for (; v != vEnd; v++) if (v->playingPreset != -1) count++;
|
1483
|
90 |
0 |
int channelSamples = (f->outputmode == TSF_MONO ? 1 : 2) * samples, floatBufferSize = channelSamples * sizeof(float);
|
1485
|
8 |
82 |
if (floatBufferSize > f->outputSampleSize)
|
1495
|
0 |
90 |
if (flag_mixing)
|
1496
|
0 |
0 |
while (buffer != bufferEnd)
|
1499
|
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)));
|
1500
|
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));
|
1503
|
3843664 |
90 |
while (buffer != bufferEnd)
|
1506
|
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)));
|
1513
|
90 |
0 |
if (!flag_mixing) TSF_MEMSET(buffer, 0, (f->outputmode == TSF_MONO ? 1 : 2) * sizeof(float) * samples);
|
|
90 |
0 |
if (!flag_mixing) TSF_MEMSET(buffer, 0, (f->outputmode == TSF_MONO ? 1 : 2) * sizeof(float) * samples);
|
1514
|
360 |
90 |
for (; v != vEnd; v++)
|
1515
|
93 |
267 |
if (v->playingPreset != -1)
|
1525
|
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);
|
1526
|
0 |
0 |
if (newpan <= -0.5f) { v->panFactorLeft = 1.0f; v->panFactorRight = 0.0f; }
|
1527
|
0 |
0 |
else if (newpan >= 0.5f) { v->panFactorLeft = 0.0f; v->panFactorRight = 1.0f; }
|
1534
|
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];
|
1535
|
0 |
0 |
if (!f->channels)
|
1546
|
0 |
0 |
for (; i <= channel; i++)
|
1565
|
0 |
0 |
float pitchShift = (c->pitchWheel == 8192 ? c->tuning : ((c->pitchWheel / 16383.0f * c->pitchRange * 2.0f) - c->pitchRange + c->tuning));
|
1566
|
0 |
0 |
for (v = f->voices, vEnd = v + f->voiceNum; v != vEnd; v++)
|
1567
|
0 |
0 |
if (v->playingChannel == channel && v->playingPreset != -1)
|
|
0 |
0 |
if (v->playingChannel == channel && v->playingPreset != -1)
|
1580
|
0 |
0 |
if (flag_mididrums)
|
1583
|
0 |
0 |
if (preset_index == -1) preset_index = tsf_get_presetindex(f, 128, preset_number);
|
1584
|
0 |
0 |
if (preset_index == -1) preset_index = tsf_get_presetindex(f, 128, 0);
|
1585
|
0 |
0 |
if (preset_index == -1) preset_index = tsf_get_presetindex(f, (c->bank & 0x7FFF), preset_number);
|
1588
|
0 |
0 |
if (preset_index == -1) preset_index = tsf_get_presetindex(f, 0, preset_number);
|
1589
|
0 |
0 |
if (preset_index != -1)
|
1606
|
0 |
0 |
if (preset_index == -1) return 0;
|
1615
|
0 |
0 |
for (v = f->voices, vEnd = v + f->voiceNum; v != vEnd; v++)
|
1616
|
0 |
0 |
if (v->playingChannel == channel && v->playingPreset != -1)
|
|
0 |
0 |
if (v->playingChannel == channel && v->playingPreset != -1)
|
1619
|
0 |
0 |
if (newpan <= -0.5f) { v->panFactorLeft = 1.0f; v->panFactorRight = 0.0f; }
|
1620
|
0 |
0 |
else if (newpan >= 0.5f) { v->panFactorLeft = 0.0f; v->panFactorRight = 1.0f; }
|
1631
|
0 |
0 |
if (gainDBChange == 0) return;
|
1632
|
0 |
0 |
for (v = f->voices, vEnd = v + f->voiceNum; v != vEnd; v++)
|
1633
|
0 |
0 |
if (v->playingChannel == channel && v->playingPreset != -1)
|
|
0 |
0 |
if (v->playingChannel == channel && v->playingPreset != -1)
|
1641
|
0 |
0 |
if (c->pitchWheel == pitch_wheel) return;
|
1649
|
0 |
0 |
if (c->pitchRange == pitch_range) return;
|
1651
|
0 |
0 |
if (c->pitchWheel != 8192) tsf_channel_applypitch(f, channel, c);
|
1657
|
0 |
0 |
if (c->tuning == tuning) return;
|
1664
|
0 |
0 |
if (!f->channels || channel >= f->channels->channelNum) return;
|
|
0 |
0 |
if (!f->channels || channel >= f->channels->channelNum) return;
|
1672
|
0 |
0 |
for (; v != vEnd; v++)
|
1675
|
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;
|
1676
|
0 |
0 |
else if (!vMatchFirst || v->playIndex < vMatchFirst->playIndex) vMatchFirst = vMatchLast = v;
|
|
0 |
0 |
else if (!vMatchFirst || v->playIndex < vMatchFirst->playIndex) vMatchFirst = vMatchLast = v;
|
1677
|
0 |
0 |
else if (v->playIndex == vMatchFirst->playIndex) vMatchLast = v;
|
1679
|
0 |
0 |
if (!vMatchFirst) return;
|
1680
|
0 |
0 |
for (v = vMatchFirst; v <= vMatchLast; v++)
|
1683
|
0 |
0 |
if (v != vMatchFirst && v != vMatchLast &&
|
|
0 |
0 |
if (v != vMatchFirst && v != vMatchLast &&
|
|
0 |
0 |
if (v != vMatchFirst && v != vMatchLast &&
|
1684
|
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;
|
1692
|
0 |
0 |
for (; v != vEnd; v++)
|
1693
|
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)
|
1700
|
0 |
0 |
for (; v != vEnd; v++)
|
1701
|
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))
|
1719
|
0 |
0 |
case 32 /*BANK_SELECT_LSB*/ : c->bank = (unsigned short)((c->bank & 0x8000 ? ((c->bank & 0x7F) << 7) : 0) | control_value); return;
|
1720
|
0 |
0 |
case 101 /*RPN_MSB*/ : c->midiRPN = (unsigned short)(((c->midiRPN == 0xFFFF ? 0 : c->midiRPN) & 0x7F ) | (control_value << 7)); return;
|
1721
|
0 |
0 |
case 100 /*RPN_LSB*/ : c->midiRPN = (unsigned short)(((c->midiRPN == 0xFFFF ? 0 : c->midiRPN) & 0x3F80) | control_value); return;
|
1744
|
0 |
0 |
if (c->midiRPN == 0) tsf_channel_set_pitchrange(f, channel, (c->midiData >> 7) + 0.01f * (c->midiData & 0x7F));
|
1745
|
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
|
1746
|
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
|
1752
|
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);
|
1757
|
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);
|
1762
|
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);
|
1767
|
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);
|
1772
|
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);
|
1777
|
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);
|
1782
|
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);
|
1787
|
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);
|