History

Pushed v1.39 code

- Fixed yet another issue where junk could be drawn after the loop end point in the sample data's waveform in the sample editor (if zoomed out) - Fixed an issue with loading XMs with more than 128 instruments (OpenMPT etc). This only worked if the extra instruments were empty. Now it will properly load the extra instruments and discard them after the loading was complete (since we only support up to 128 instruments) - Small code cleanup

Olav Sørensen committed 6 years ago

Commit ee4c8981 parent a58a77611 files · +350 −316Browse files

Unified · Split

11 files
  1. src/ft2_audio.c +18 −20
  2. src/ft2_header.h +1 −1
  3. src/ft2_module_loader.c +191 −163
  4. src/ft2_replayer.c +3 −3
  5. src/ft2_sample_ed.c +20 −14
  6. src/ft2_scopes.c +2 −0
  7. src/mixer/ft2_center_mix.c +36 −36
  8. src/mixer/ft2_center_mix.h +36 −36
  9. src/mixer/ft2_mix.c +36 −36
  10. src/mixer/ft2_mix.h +1 −1
  11. src/mixer/ft2_mix_macros.h +6 −6
src/ft2_audio.c+18−20
@@ -545,7 +545,7 @@ static void sendSamples32BitMultiChan(uint8_t *stream, uint32_t sampleBlockLengt · 544 unmodified lines
545545 }
546546 }
547547
548−static void doChannelMixing(int32_t samplesToMix)
548+static void doChannelMixing(int32_t bufferPosition, int32_t samplesToMix)
549549 {
550550 voice_t *v = voice; // normal voices
551551 voice_t *r = &voice[MAX_VOICES]; // volume ramp fadeout-voices
@@ -572,29 +572,17 @@ static void doChannelMixing(int32_t samplesToMix) · 20 unmodified lines
572572 centerMixFlag = v->dVolL == v->dVolR;
573573 }
574574
575− mixFuncTab[(centerMixFlag * 36) + (volRampFlag * 18) + v->mixFuncOffset](v, samplesToMix);
575+ mixFuncTab[(centerMixFlag * 36) + (volRampFlag * 18) + v->mixFuncOffset](v, bufferPosition, samplesToMix);
576576 }
577577
578578 if (r->active) // volume ramp fadeout-voice
579579 {
580580 const bool centerMixFlag = (r->dDestVolL == r->dDestVolR) && (r->dVolDeltaL == r->dVolDeltaR);
581− mixFuncTab[(centerMixFlag * 36) + 18 + r->mixFuncOffset](r, samplesToMix);
581+ mixFuncTab[(centerMixFlag * 36) + 18 + r->mixFuncOffset](r, bufferPosition, samplesToMix);
582582 }
583583 }
584584 }
585585
586−static void mixAudio(uint8_t *stream, uint32_t sampleBlockLength, uint8_t numAudioChannels)
587−{
588− assert(sampleBlockLength <= MAX_WAV_RENDER_SAMPLES_PER_TICK);
589− memset(audio.dMixBufferL, 0, sampleBlockLength * sizeof (double));
590− memset(audio.dMixBufferR, 0, sampleBlockLength * sizeof (double));
591−
592− doChannelMixing(sampleBlockLength);
593−
594− // normalize mix buffer and send to audio stream
595− sendAudSamplesFunc(stream, sampleBlockLength, numAudioChannels);
596−}
597−
598586 // used for song-to-WAV renderer
599587 void mixReplayerTickToBuffer(uint32_t samplesToMix, uint8_t *stream, uint8_t bitDepth)
600588 {
@@ -602,7 +590,7 @@ void mixReplayerTickToBuffer(uint32_t samplesToMix, uint8_t *stream, uint8_t bit · 1 unmodified line
602590 memset(audio.dMixBufferL, 0, samplesToMix * sizeof (double));
603591 memset(audio.dMixBufferR, 0, samplesToMix * sizeof (double));
604592
605− doChannelMixing(samplesToMix);
593+ doChannelMixing(0, samplesToMix);
606594
607595 // normalize mix buffer and send to audio stream
608596 if (bitDepth == 16)
@@ -932,10 +920,17 @@ static void SDLCALL audioCallback(void *userdata, Uint8 *stream, int len) · 323 unmodified lines
932920 if (editor.wavIsRendering)
933921 return;
934922
935− int32_t samplesLeft = len / pmpCountDiv;
936− if (samplesLeft <= 0)
923+ len /= pmpCountDiv; // bytes -> samples
924+ if (len <= 0)
937925 return;
938926
927+ assert(len <= MAX_WAV_RENDER_SAMPLES_PER_TICK);
928+ memset(audio.dMixBufferL, 0, len * sizeof (double));
929+ memset(audio.dMixBufferR, 0, len * sizeof (double));
930+
931+ int32_t bufferPosition = 0;
932+
933+ int32_t samplesLeft = len;
939934 while (samplesLeft > 0)
940935 {
941936 if (audio.dTickSampleCounter <= 0.0)
@@ -962,13 +957,16 @@ static void SDLCALL audioCallback(void *userdata, Uint8 *stream, int len) · 20 unmodified lines
962957 if (samplesToMix > remainingTick)
963958 samplesToMix = remainingTick;
964959
965− mixAudio(stream, samplesToMix, pmpChannels);
966− stream += samplesToMix * pmpCountDiv;
960+ doChannelMixing(bufferPosition, samplesToMix);
967961
962+ bufferPosition += samplesToMix;
968963 samplesLeft -= samplesToMix;
969964 audio.dTickSampleCounter -= samplesToMix;
970965 }
971966
967+ // normalize mix buffer and send to audio stream
968+ sendAudSamplesFunc(stream, len, pmpChannels);
969+
972970 (void)userdata; // make compiler not complain
973971 }
974972
src/ft2_header.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212 #endif
1313 #include "ft2_replayer.h"
1414
15−#define PROG_VER_STR "1.38"
15+#define PROG_VER_STR "1.39"
1616
1717 // do NOT change these! It will only mess things up...
1818
src/ft2_module_loader.c+191−163
@@ -138,7 +138,7 @@ static SDL_Thread *thread; · 137 unmodified lines
138138 static int16_t pattLensTmp[MAX_PATTERNS];
139139 static uint32_t extraSampleLengths[32-MAX_SMP_PER_INST]; // ModPlug Tracker & OpenMPT supports up to 32 samples per instrument in .XM
140140 static tonTyp *pattTmp[MAX_PATTERNS];
141−static instrTyp *instrTmp[1+MAX_INST];
141+static instrTyp *instrTmp[1+256];
142142 static songTyp songTmp;
143143
144144 static void setupLoadedModule(void);
@@ -1724,6 +1724,12 @@ bool doLoadMusic(bool externalThreadFlag) · 1579 unmodified lines
17241724 goto xmLoadError;
17251725 }
17261726
1727+ if (h.antInstrs > 256) // if >128 instruments, we fake-load up to 128 extra instruments and discard them
1728+ {
1729+ showMsg(0, "System message", "Error loading XM: This file is corrupt.");
1730+ goto xmLoadError;
1731+ }
1732+
17271733 fseek(f, 60 + h.headerSize, SEEK_SET);
17281734 if (filelength != 336 && feof(f)) // 336 in length at this point = empty XM
17291735 {
@@ -1806,8 +1812,24 @@ bool doLoadMusic(bool externalThreadFlag) · 76 unmodified lines
18061812
18071813 for (i = 1; i <= h.antInstrs; i++)
18081814 {
1809− if (!loadInstrHeader(f, i, externalThreadFlag)) goto xmLoadError;
1810− if (!loadInstrSample(f, i, externalThreadFlag)) goto xmLoadError;
1815+ if (!loadInstrHeader(f, i, externalThreadFlag))
1816+ goto xmLoadError;
1817+
1818+ if (!loadInstrSample(f, i, externalThreadFlag))
1819+ goto xmLoadError;
1820+ }
1821+ }
1822+
1823+ // if we temporarily loaded more than 128 instruments, clear the extra allocated memory
1824+ if (h.antInstrs > MAX_INST)
1825+ {
1826+ for (i = MAX_INST+1; i <= h.antInstrs; i++)
1827+ {
1828+ if (instrTmp[i] != NULL)
1829+ {
1830+ free(instrTmp[i]);
1831+ instrTmp[i] = NULL;
1832+ }
18111833 }
18121834 }
18131835
@@ -1937,8 +1959,8 @@ static void freeTmpModule(void) // called on module load error · 123 unmodified lines
19371959 }
19381960 }
19391961
1940− // free all samples
1941− for (i = 1; i <= MAX_INST; i++)
1962+ // free all instruments and samples
1963+ for (i = 1; i <= 256; i++) // if >128 instruments, we fake-load up to 128 extra (and discard them later)
19421964 {
19431965 if (instrTmp[i] != NULL)
19441966 {
@@ -1996,7 +2018,7 @@ static bool loadInstrHeader(FILE *f, uint16_t i, bool externalThreadFlag) · 51 unmodified lines
19962018 return false;
19972019 }
19982020
1999− if (i <= MAX_INST)
2021+ if (i <= MAX_INST) // copy over instrument names
20002022 {
20012023 // trim off spaces at end of name
20022024 for (k = 21; k >= 0; k--)
@@ -2013,73 +2035,70 @@ static bool loadInstrHeader(FILE *f, uint16_t i, bool externalThreadFlag) · 10 unmodified lines
20132035
20142036 if (ih.antSamp > 0)
20152037 {
2016− if (i <= MAX_INST)
2038+ if (!allocateTmpInstr(i))
20172039 {
2018− if (!allocateTmpInstr(i))
2019− {
2020− showMsg(0, "System message", "Not enough memory!");
2021− return false;
2022− }
2040+ showMsg(0, "System message", "Not enough memory!");
2041+ return false;
2042+ }
20232043
2024− // copy instrument header elements to our instrument struct
2025−
2026− ins = instrTmp[i];
2027− memcpy(ins->ta, ih.ta, 96);
2028− memcpy(ins->envVP, ih.envVP, 12*2*sizeof(int16_t));
2029− memcpy(ins->envPP, ih.envPP, 12*2*sizeof(int16_t));
2030− ins->envVPAnt = ih.envVPAnt;
2031− ins->envPPAnt = ih.envPPAnt;
2032− ins->envVSust = ih.envVSust;
2033− ins->envVRepS = ih.envVRepS;
2034− ins->envVRepE = ih.envVRepE;
2035− ins->envPSust = ih.envPSust;
2036− ins->envPRepS = ih.envPRepS;
2037− ins->envPRepE = ih.envPRepE;
2038− ins->envVTyp = ih.envVTyp;
2039− ins->envPTyp = ih.envPTyp;
2040− ins->vibTyp = ih.vibTyp;
2041− ins->vibSweep = ih.vibSweep;
2042− ins->vibDepth = ih.vibDepth;
2043− ins->vibRate = ih.vibRate;
2044− ins->fadeOut = ih.fadeOut;
2045− ins->midiOn = (ih.midiOn == 1) ? true : false;
2046− ins->midiChannel = ih.midiChannel;
2047− ins->midiProgram = ih.midiProgram;
2048− ins->midiBend = ih.midiBend;
2049− ins->mute = (ih.mute == 1) ? true : false;
2050− ins->antSamp = ih.antSamp; // used in loadInstrSample()
2051−
2052− // sanitize stuff for broken/unsupported instruments
2053− ins->midiProgram = CLAMP(ins->midiProgram, 0, 127);
2054− ins->midiBend = CLAMP(ins->midiBend, 0, 36);
2055−
2056− if (ins->midiChannel > 15) ins->midiChannel = 15;
2057− if (ins->vibDepth > 0x0F) ins->vibDepth = 0x0F;
2058− if (ins->vibRate > 0x3F) ins->vibRate = 0x3F;
2059− if (ins->vibTyp > 3) ins->vibTyp = 0;
2060−
2061− for (j = 0; j < 96; j++)
2062− {
2063− if (ins->ta[j] >= MAX_SMP_PER_INST)
2064− ins->ta[j] = MAX_SMP_PER_INST-1;
2065− }
2044+ // copy instrument header elements to our instrument struct
2045+
2046+ ins = instrTmp[i];
2047+ memcpy(ins->ta, ih.ta, 96);
2048+ memcpy(ins->envVP, ih.envVP, 12*2*sizeof(int16_t));
2049+ memcpy(ins->envPP, ih.envPP, 12*2*sizeof(int16_t));
2050+ ins->envVPAnt = ih.envVPAnt;
2051+ ins->envPPAnt = ih.envPPAnt;
2052+ ins->envVSust = ih.envVSust;
2053+ ins->envVRepS = ih.envVRepS;
2054+ ins->envVRepE = ih.envVRepE;
2055+ ins->envPSust = ih.envPSust;
2056+ ins->envPRepS = ih.envPRepS;
2057+ ins->envPRepE = ih.envPRepE;
2058+ ins->envVTyp = ih.envVTyp;
2059+ ins->envPTyp = ih.envPTyp;
2060+ ins->vibTyp = ih.vibTyp;
2061+ ins->vibSweep = ih.vibSweep;
2062+ ins->vibDepth = ih.vibDepth;
2063+ ins->vibRate = ih.vibRate;
2064+ ins->fadeOut = ih.fadeOut;
2065+ ins->midiOn = (ih.midiOn == 1) ? true : false;
2066+ ins->midiChannel = ih.midiChannel;
2067+ ins->midiProgram = ih.midiProgram;
2068+ ins->midiBend = ih.midiBend;
2069+ ins->mute = (ih.mute == 1) ? true : false;
2070+ ins->antSamp = ih.antSamp; // used in loadInstrSample()
2071+
2072+ // sanitize stuff for broken/unsupported instruments
2073+ ins->midiProgram = CLAMP(ins->midiProgram, 0, 127);
2074+ ins->midiBend = CLAMP(ins->midiBend, 0, 36);
2075+
2076+ if (ins->midiChannel > 15) ins->midiChannel = 15;
2077+ if (ins->vibDepth > 0x0F) ins->vibDepth = 0x0F;
2078+ if (ins->vibRate > 0x3F) ins->vibRate = 0x3F;
2079+ if (ins->vibTyp > 3) ins->vibTyp = 0;
2080+
2081+ for (j = 0; j < 96; j++)
2082+ {
2083+ if (ins->ta[j] >= MAX_SMP_PER_INST)
2084+ ins->ta[j] = MAX_SMP_PER_INST-1;
2085+ }
20662086
2067− if (ins->envVPAnt > 12) ins->envVPAnt = 12;
2068− if (ins->envVRepS > 11) ins->envVRepS = 11;
2069− if (ins->envVRepE > 11) ins->envVRepE = 11;
2070− if (ins->envVSust > 11) ins->envVSust = 11;
2071− if (ins->envPPAnt > 12) ins->envPPAnt = 12;
2072− if (ins->envPRepS > 11) ins->envPRepS = 11;
2073− if (ins->envPRepE > 11) ins->envPRepE = 11;
2074− if (ins->envPSust > 11) ins->envPSust = 11;
2087+ if (ins->envVPAnt > 12) ins->envVPAnt = 12;
2088+ if (ins->envVRepS > 11) ins->envVRepS = 11;
2089+ if (ins->envVRepE > 11) ins->envVRepE = 11;
2090+ if (ins->envVSust > 11) ins->envVSust = 11;
2091+ if (ins->envPPAnt > 12) ins->envPPAnt = 12;
2092+ if (ins->envPRepS > 11) ins->envPRepS = 11;
2093+ if (ins->envPRepE > 11) ins->envPRepE = 11;
2094+ if (ins->envPSust > 11) ins->envPSust = 11;
20752095
2076− for (j = 0; j < 12; j++)
2077− {
2078− if ((uint16_t)ins->envVP[j][0] > 32767) ins->envVP[j][0] = 32767;
2079− if ((uint16_t)ins->envPP[j][0] > 32767) ins->envPP[j][0] = 32767;
2080− if ((uint16_t)ins->envVP[j][1] > 64) ins->envVP[j][1] = 64;
2081− if ((uint16_t)ins->envPP[j][1] > 63) ins->envPP[j][1] = 63;
2082− }
2096+ for (j = 0; j < 12; j++)
2097+ {
2098+ if ((uint16_t)ins->envVP[j][0] > 32767) ins->envVP[j][0] = 32767;
2099+ if ((uint16_t)ins->envPP[j][0] > 32767) ins->envPP[j][0] = 32767;
2100+ if ((uint16_t)ins->envVP[j][1] > 64) ins->envVP[j][1] = 64;
2101+ if ((uint16_t)ins->envPP[j][1] > 63) ins->envPP[j][1] = 63;
20832102 }
20842103
20852104 int32_t sampleHeadersToRead = ih.antSamp;
@@ -2103,43 +2122,40 @@ static bool loadInstrHeader(FILE *f, uint16_t i, bool externalThreadFlag) · 17 unmodified lines
21032122 }
21042123 }
21052124
2106− if (i <= MAX_INST)
2125+ for (j = 0; j < sampleHeadersToRead; j++)
21072126 {
2108− for (j = 0; j < sampleHeadersToRead; j++)
2109− {
2110− s = &instrTmp[i]->samp[j];
2111− src = &ih.samp[j];
2112−
2113− // copy sample header elements to our sample struct
2114−
2115− s->len = src->len;
2116− s->repS = src->repS;
2117− s->repL = src->repL;
2118− s->vol = src->vol;
2119− s->fine = src->fine;
2120− s->typ = src->typ;
2121− s->pan = src->pan;
2122− s->relTon = src->relTon;
2123− memcpy(s->name, src->name, 22);
2124− s->name[22] = '\0';
2125−
2126− // dst->pek is set up later
2127−
2128− // trim off spaces at end of name
2129− for (k = 21; k >= 0; k--)
2130− {
2131− if (s->name[k] == ' ' || s->name[k] == 0x1A)
2132− s->name[k] = '\0';
2133− else
2134− break;
2135− }
2127+ s = &instrTmp[i]->samp[j];
2128+ src = &ih.samp[j];
21362129
2137− // sanitize stuff broken/unsupported samples
2138− if (s->vol > 64)
2139− s->vol = 64;
2130+ // copy sample header elements to our sample struct
21402131
2141− s->relTon = CLAMP(s->relTon, -48, 71);
2132+ s->len = src->len;
2133+ s->repS = src->repS;
2134+ s->repL = src->repL;
2135+ s->vol = src->vol;
2136+ s->fine = src->fine;
2137+ s->typ = src->typ;
2138+ s->pan = src->pan;
2139+ s->relTon = src->relTon;
2140+ memcpy(s->name, src->name, 22);
2141+ s->name[22] = '\0';
2142+
2143+ // dst->pek is set up later
2144+
2145+ // trim off spaces at end of name
2146+ for (k = 21; k >= 0; k--)
2147+ {
2148+ if (s->name[k] == ' ' || s->name[k] == 0x1A)
2149+ s->name[k] = '\0';
2150+ else
2151+ break;
21422152 }
2153+
2154+ // sanitize stuff broken/unsupported samples
2155+ if (s->vol > 64)
2156+ s->vol = 64;
2157+
2158+ s->relTon = CLAMP(s->relTon, -48, 71);
21432159 }
21442160 }
21452161
@@ -2165,90 +2181,102 @@ static bool loadInstrSample(FILE *f, uint16_t i, bool externalThreadFlag) · 19 unmodified lines
21652181
21662182 showMsg = externalThreadFlag ? okBoxThreadSafe : okBox;
21672183
2168− if (i > MAX_INST || instrTmp[i] == NULL)
2169− return true; // yes, let's just pretend they got loaded
2184+ if (instrTmp[i] == NULL)
2185+ return true; // empty instrument, let's just pretend it got loaded successfully
21702186
21712187 k = instrTmp[i]->antSamp;
21722188 if (k > MAX_SMP_PER_INST)
21732189 k = MAX_SMP_PER_INST;
21742190
2175− for (j = 0; j < k; j++)
2191+ if (i > MAX_INST) // insNum > 128, just skip sample data
21762192 {
2177− s = &instrTmp[i]->samp[j];
2178−
2179− // if a sample has both forward loop and pingpong loop set, make it pingpong loop only (FT2 mixer behavior)
2180− if ((s->typ & 3) == 3)
2181− s->typ &= 0xFE;
2182−
2183− l = s->len;
2184− if (l <= 0)
2193+ for (j = 0; j < k; j++)
21852194 {
2186− s->pek = NULL;
2187− s->len = 0;
2188− s->repL = 0;
2189− s->repS = 0;
2190−
2191− if (s->typ & 32)
2192− s->typ &= ~32; // remove stereo flag
2195+ s = &instrTmp[i]->samp[j];
2196+ if (s->len > 0)
2197+ fseek(f, s->len, SEEK_CUR);
21932198 }
2194− else
2199+ }
2200+ else
2201+ {
2202+ for (j = 0; j < k; j++)
21952203 {
2196− bytesToSkip = 0;
2197− if (l > MAX_SAMPLE_LEN)
2198− {
2199− bytesToSkip = l - MAX_SAMPLE_LEN;
2200− l = MAX_SAMPLE_LEN;
2201− }
2204+ s = &instrTmp[i]->samp[j];
22022205
2203− s->pek = NULL;
2204− s->origPek = (int8_t *)malloc(l + LOOP_FIX_LEN);
2205− if (s->origPek == NULL)
2206− {
2207− showMsg(0, "System message", "Not enough memory!");
2208− return false;
2209− }
2206+ // if a sample has both forward loop and pingpong loop set, make it pingpong loop only (FT2 mixer behavior)
2207+ if ((s->typ & 3) == 3)
2208+ s->typ &= 0xFE;
22102209
2211− s->pek = s->origPek + SMP_DAT_OFFSET;
2212−
2213− const int32_t bytesRead = (int32_t)fread(s->pek, 1, l, f);
2214− if (bytesRead < l)
2210+ l = s->len;
2211+ if (l <= 0)
22152212 {
2216− const int32_t bytesToClear = l - bytesRead;
2217− memset(&s->pek[bytesRead], 0, bytesToClear);
2213+ s->pek = NULL;
2214+ s->len = 0;
2215+ s->repL = 0;
2216+ s->repS = 0;
2217+
2218+ if (s->typ & 32)
2219+ s->typ &= ~32; // remove stereo flag
22182220 }
2221+ else
2222+ {
2223+ bytesToSkip = 0;
2224+ if (l > MAX_SAMPLE_LEN)
2225+ {
2226+ bytesToSkip = l - MAX_SAMPLE_LEN;
2227+ l = MAX_SAMPLE_LEN;
2228+ }
2229+
2230+ s->pek = NULL;
2231+ s->origPek = (int8_t *)malloc(l + LOOP_FIX_LEN);
2232+ if (s->origPek == NULL)
2233+ {
2234+ showMsg(0, "System message", "Not enough memory!");
2235+ return false;
2236+ }
22192237
2220− if (bytesToSkip > 0)
2221− fseek(f, bytesToSkip, SEEK_CUR);
2238+ s->pek = s->origPek + SMP_DAT_OFFSET;
22222239
2223− delta2Samp(s->pek, l, s->typ);
2240+ const int32_t bytesRead = (int32_t)fread(s->pek, 1, l, f);
2241+ if (bytesRead < l)
2242+ {
2243+ const int32_t bytesToClear = l - bytesRead;
2244+ memset(&s->pek[bytesRead], 0, bytesToClear);
2245+ }
22242246
2225− if (s->typ & 32) // stereo sample - already downmixed to mono in delta2samp()
2226− {
2227− s->typ &= ~32; // remove stereo flag
2247+ if (bytesToSkip > 0)
2248+ fseek(f, bytesToSkip, SEEK_CUR);
22282249
2229− s->len >>= 1;
2230− s->repL >>= 1;
2231− s->repS >>= 1;
2250+ delta2Samp(s->pek, l, s->typ);
22322251
2233− newPtr = (int8_t *)realloc(s->origPek, s->len + LOOP_FIX_LEN);
2234− if (newPtr != NULL)
2252+ if (s->typ & 32) // stereo sample - already downmixed to mono in delta2samp()
22352253 {
2236− s->origPek = newPtr;
2237− s->pek = s->origPek + SMP_DAT_OFFSET;
2254+ s->typ &= ~32; // remove stereo flag
2255+
2256+ s->len >>= 1;
2257+ s->repL >>= 1;
2258+ s->repS >>= 1;
2259+
2260+ newPtr = (int8_t *)realloc(s->origPek, s->len + LOOP_FIX_LEN);
2261+ if (newPtr != NULL)
2262+ {
2263+ s->origPek = newPtr;
2264+ s->pek = s->origPek + SMP_DAT_OFFSET;
2265+ }
22382266 }
22392267 }
2240− }
22412268
2242− // NON-FT2 FIX: Align to 2-byte if 16-bit sample
2243− if (s->typ & 16)
2244− {
2245− s->repL &= 0xFFFFFFFE;
2246− s->repS &= 0xFFFFFFFE;
2247− s->len &= 0xFFFFFFFE;
2248− }
2269+ // NON-FT2 FIX: Align to 2-byte if 16-bit sample
2270+ if (s->typ & 16)
2271+ {
2272+ s->repL &= 0xFFFFFFFE;
2273+ s->repS &= 0xFFFFFFFE;
2274+ s->len &= 0xFFFFFFFE;
2275+ }
22492276
2250− checkSampleRepeat(s);
2251− fixSample(s);
2277+ checkSampleRepeat(s);
2278+ fixSample(s);
2279+ }
22522280 }
22532281
22542282 if (instrTmp[i]->antSamp > MAX_SMP_PER_INST)
src/ft2_replayer.c+3−3
@@ -2943,7 +2943,7 @@ void playTone(uint8_t stmm, uint8_t inst, uint8_t ton, int8_t vol, uint16_t midi · 2942 unmodified lines
29432943 if (ins == NULL)
29442944 return;
29452945
2946− assert(stmm < MAX_VOICES && inst < MAX_INST && ton <= 97);
2946+ assert(stmm < MAX_VOICES && inst <= MAX_INST && ton <= 97);
29472947 ch = &stm[stmm];
29482948
29492949 // FT2 bugfix: Don't play tone if certain requirements are not met
@@ -3010,7 +3010,7 @@ void playSample(uint8_t stmm, uint8_t inst, uint8_t smpNr, uint8_t ton, uint16_t · 60 unmodified lines
30103010 editor.curPlayInstr = 255;
30113011 editor.curPlaySmp = 255;
30123012
3013− assert(stmm < MAX_VOICES && inst < MAX_INST && smpNr < MAX_SMP_PER_INST && ton <= 97);
3013+ assert(stmm < MAX_VOICES && inst <= MAX_INST && smpNr < MAX_SMP_PER_INST && ton <= 97);
30143014 ch = &stm[stmm];
30153015
30163016 memcpy(&instr[130]->samp[0], &instr[inst]->samp[smpNr], sizeof (sampleTyp));
@@ -3066,7 +3066,7 @@ void playRange(uint8_t stmm, uint8_t inst, uint8_t smpNr, uint8_t ton, uint16_t · 49 unmodified lines
30663066 editor.curPlayInstr = 255;
30673067 editor.curPlaySmp = 255;
30683068
3069− assert(stmm < MAX_VOICES && inst < MAX_INST && smpNr < MAX_SMP_PER_INST && ton <= 97);
3069+ assert(stmm < MAX_VOICES && inst <= MAX_INST && smpNr < MAX_SMP_PER_INST && ton <= 97);
30703070
30713071 ch = &stm[stmm];
30723072 s = &instr[130]->samp[0];
src/ft2_sample_ed.c+20−14
@@ -1069,7 +1069,7 @@ static void getMinMax8(const void *p, uint32_t scanLen, int8_t *min8, int8_t *ma · 1068 unmodified lines
10691069 }
10701070 }
10711071
1072−// for scanning sample data peak where loopEnd+NUM_FIXED_TAP_SAMPLES is within scan range (fixed interpolation tap samples)
1072+// for scanning sample data peak where loopEnd+SINC_RIGHT_TAPS is within scan range (fixed interpolation tap samples)
10731073 static void getSpecialMinMax16(sampleTyp *s, int32_t index, int32_t scanEnd, int16_t *min16, int16_t *max16)
10741074 {
10751075 int16_t minVal, maxVal, minVal2, maxVal2;
@@ -1079,19 +1079,22 @@ static void getSpecialMinMax16(sampleTyp *s, int32_t index, int32_t scanEnd, int · 3 unmodified lines
10791079 minVal = 32767;
10801080 maxVal = -32768;
10811081
1082− // read peak samples before fixed samples
1082+ // read samples before fixed samples (if needed)
10831083 if (index < s->fixedPos)
10841084 {
10851085 getMinMax16(&ptr16[index], s->fixedPos-index, &minVal, &maxVal);
1086− index += s->fixedPos-index;
1086+ index = s->fixedPos;
10871087 }
10881088
1089− // read fixed samples
1090− int32_t tmpScanEnd = index+SINC_RIGHT_TAPS;
1089+ // read fixed samples (we are guaranteed to be within the fixed samples here)
1090+ const int32_t tapIndex = index-s->fixedPos;
1091+ const int32_t scanLength = SINC_RIGHT_TAPS-tapIndex;
1092+
1093+ int32_t tmpScanEnd = index+scanLength;
10911094 if (tmpScanEnd > scanEnd)
10921095 tmpScanEnd = scanEnd;
10931096
1094− const int16_t *smpReadPtr = s->fixedSmp;
1097+ const int16_t *smpReadPtr = s->fixedSmp + tapIndex;
10951098 for (; index < tmpScanEnd; index++)
10961099 {
10971100 const int16_t smp16 = *smpReadPtr++;
@@ -1099,7 +1102,7 @@ static void getSpecialMinMax16(sampleTyp *s, int32_t index, int32_t scanEnd, int · 1 unmodified line
10991102 if (smp16 > maxVal) maxVal = smp16;
11001103 }
11011104
1102− // read peak samples after fixed samples
1105+ // read samples after fixed samples (if needed)
11031106 if (index < scanEnd)
11041107 {
11051108 getMinMax16(&ptr16[index], scanEnd-index, &minVal2, &maxVal2);
@@ -1111,7 +1114,7 @@ static void getSpecialMinMax16(sampleTyp *s, int32_t index, int32_t scanEnd, int · 5 unmodified lines
11111114 *max16 = maxVal;
11121115 }
11131116
1114−// for scanning sample data peak where loopEnd+NUM_FIXED_TAP_SAMPLES is within scan range (fixed interpolation tap samples)
1117+// for scanning sample data peak where loopEnd+SINC_RIGHT_TAPS is within scan range (fixed interpolation tap samples)
11151118 static void getSpecialMinMax8(sampleTyp *s, int32_t index, int32_t scanEnd, int8_t *min8, int8_t *max8)
11161119 {
11171120 int8_t minVal, maxVal, minVal2, maxVal2;
@@ -1121,19 +1124,22 @@ static void getSpecialMinMax8(sampleTyp *s, int32_t index, int32_t scanEnd, int8 · 3 unmodified lines
11211124 minVal = 127;
11221125 maxVal = -128;
11231126
1124− // read peak samples before fixed samples
1127+ // read samples before fixed samples (if needed)
11251128 if (index < s->fixedPos)
11261129 {
11271130 getMinMax8(&ptr8[index], s->fixedPos-index, &minVal, &maxVal);
1128− index += s->fixedPos-index;
1131+ index = s->fixedPos;
11291132 }
11301133
1131− // read fixed samples
1132− int32_t tmpScanEnd = index+SINC_RIGHT_TAPS;
1134+ // read fixed samples (we are guaranteed to be within the fixed samples here)
1135+ const int32_t tapIndex = index-s->fixedPos;
1136+ const int32_t scanLength = SINC_RIGHT_TAPS-tapIndex;
1137+
1138+ int32_t tmpScanEnd = index+scanLength;
11331139 if (tmpScanEnd > scanEnd)
11341140 tmpScanEnd = scanEnd;
11351141
1136− const int16_t *smpReadPtr = (const int16_t *)s->fixedSmp;
1142+ const int16_t *smpReadPtr = (const int16_t *)s->fixedSmp + tapIndex;
11371143 for (; index < tmpScanEnd; index++)
11381144 {
11391145 const int8_t smp8 = (int8_t)(*smpReadPtr++);
@@ -1141,7 +1147,7 @@ static void getSpecialMinMax8(sampleTyp *s, int32_t index, int32_t scanEnd, int8 · 1 unmodified line
11411147 if (smp8 > maxVal) maxVal = smp8;
11421148 }
11431149
1144− // read peak samples after fixed samples
1150+ // read samples after fixed samples (if needed)
11451151 if (index < scanEnd)
11461152 {
11471153 getMinMax8(&ptr8[index], scanEnd-index, &minVal2, &maxVal2);
src/ft2_scopes.c+2−0
@@ -153,6 +153,8 @@ static void redrawScope(int32_t ch) · 152 unmodified lines
153153 chanLookup = chansPerRow - 1;
154154 scopeLens = scopeLenTab[chanLookup];
155155
156+ // get x,y,len for scope according to channel (we must do it this way since 'len' can differ!)
157+
156158 x = 2;
157159 y = 94;
158160
src/mixer/ft2_center_mix.c+36−36
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 /* 8-BIT CENTER MIXING ROUTINES */
1111 /* ----------------------------------------------------------------------- */
1212
13−void centerMix8bNoLoop(voice_t *v, uint32_t numSamples)
13+void centerMix8bNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
1414 {
1515 const int8_t *base, *smpPtr;
1616 double dSample, *dMixBufferL, *dMixBufferR;
@@ -52,7 +52,7 @@ void centerMix8bNoLoop(voice_t *v, uint32_t numSamples) · 35 unmodified lines
5252 SET_BACK_MIXER_POS
5353 }
5454
55−void centerMix8bLoop(voice_t *v, uint32_t numSamples)
55+void centerMix8bLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
5656 {
5757 const int8_t *base, *smpPtr;
5858 double dSample, *dMixBufferL, *dMixBufferR;
@@ -94,7 +94,7 @@ void centerMix8bLoop(voice_t *v, uint32_t numSamples) · 35 unmodified lines
9494 SET_BACK_MIXER_POS
9595 }
9696
97−void centerMix8bBidiLoop(voice_t *v, uint32_t numSamples)
97+void centerMix8bBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
9898 {
9999 const int8_t *base, *revBase, *smpPtr;
100100 double dSample, *dMixBufferL, *dMixBufferR;
@@ -138,7 +138,7 @@ void centerMix8bBidiLoop(voice_t *v, uint32_t numSamples) · 37 unmodified lines
138138 SET_BACK_MIXER_POS
139139 }
140140
141−void centerMix8bNoLoopSIntrp(voice_t *v, uint32_t numSamples)
141+void centerMix8bNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
142142 {
143143 const int8_t *base, *smpPtr;
144144 double dSample, *dMixBufferL, *dMixBufferR;
@@ -180,7 +180,7 @@ void centerMix8bNoLoopSIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
180180 SET_BACK_MIXER_POS
181181 }
182182
183−void centerMix8bLoopSIntrp(voice_t *v, uint32_t numSamples)
183+void centerMix8bLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
184184 {
185185 const int8_t *base, *smpPtr;
186186 int8_t *smpTapPtr;
@@ -247,7 +247,7 @@ void centerMix8bLoopSIntrp(voice_t *v, uint32_t numSamples) · 60 unmodified lines
247247 SET_BACK_MIXER_POS
248248 }
249249
250−void centerMix8bBidiLoopSIntrp(voice_t *v, uint32_t numSamples)
250+void centerMix8bBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
251251 {
252252 const int8_t *base, *revBase, *smpPtr;
253253 int8_t *smpTapPtr;
@@ -317,7 +317,7 @@ void centerMix8bBidiLoopSIntrp(voice_t *v, uint32_t numSamples) · 63 unmodified lines
317317 SET_BACK_MIXER_POS
318318 }
319319
320−void centerMix8bNoLoopLIntrp(voice_t *v, uint32_t numSamples)
320+void centerMix8bNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
321321 {
322322 const int8_t *base, *smpPtr;
323323 double dSample, *dMixBufferL, *dMixBufferR;
@@ -359,7 +359,7 @@ void centerMix8bNoLoopLIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
359359 SET_BACK_MIXER_POS
360360 }
361361
362−void centerMix8bLoopLIntrp(voice_t *v, uint32_t numSamples)
362+void centerMix8bLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
363363 {
364364 const int8_t *base, *smpPtr;
365365 double dSample, *dMixBufferL, *dMixBufferR;
@@ -401,7 +401,7 @@ void centerMix8bLoopLIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
401401 SET_BACK_MIXER_POS
402402 }
403403
404−void centerMix8bBidiLoopLIntrp(voice_t *v, uint32_t numSamples)
404+void centerMix8bBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
405405 {
406406 const int8_t *base, *revBase, *smpPtr;
407407 double dSample, *dMixBufferL, *dMixBufferR;
@@ -445,7 +445,7 @@ void centerMix8bBidiLoopLIntrp(voice_t *v, uint32_t numSamples) · 37 unmodified lines
445445 SET_BACK_MIXER_POS
446446 }
447447
448−void centerMix8bRampNoLoop(voice_t *v, uint32_t numSamples)
448+void centerMix8bRampNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
449449 {
450450 const int8_t *base, *smpPtr;
451451 double dSample, *dMixBufferL, *dMixBufferR;
@@ -495,7 +495,7 @@ void centerMix8bRampNoLoop(voice_t *v, uint32_t numSamples) · 43 unmodified lines
495495 SET_BACK_MIXER_POS
496496 }
497497
498−void centerMix8bRampLoop(voice_t *v, uint32_t numSamples)
498+void centerMix8bRampLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
499499 {
500500 const int8_t *base, *smpPtr;
501501 double dSample, *dMixBufferL, *dMixBufferR;
@@ -545,7 +545,7 @@ void centerMix8bRampLoop(voice_t *v, uint32_t numSamples) · 43 unmodified lines
545545 SET_BACK_MIXER_POS
546546 }
547547
548−void centerMix8bRampBidiLoop(voice_t *v, uint32_t numSamples)
548+void centerMix8bRampBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
549549 {
550550 const int8_t *base, *revBase, *smpPtr;
551551 double dSample, *dMixBufferL, *dMixBufferR;
@@ -597,7 +597,7 @@ void centerMix8bRampBidiLoop(voice_t *v, uint32_t numSamples) · 45 unmodified lines
597597 SET_BACK_MIXER_POS
598598 }
599599
600−void centerMix8bRampNoLoopSIntrp(voice_t *v, uint32_t numSamples)
600+void centerMix8bRampNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
601601 {
602602 const int8_t *base, *smpPtr;
603603 double dSample, *dMixBufferL, *dMixBufferR;
@@ -647,7 +647,7 @@ void centerMix8bRampNoLoopSIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
647647 SET_BACK_MIXER_POS
648648 }
649649
650−void centerMix8bRampLoopSIntrp(voice_t *v, uint32_t numSamples)
650+void centerMix8bRampLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
651651 {
652652 const int8_t *base, *smpPtr;
653653 int8_t *smpTapPtr;
@@ -727,7 +727,7 @@ void centerMix8bRampLoopSIntrp(voice_t *v, uint32_t numSamples) · 73 unmodified lines
727727 SET_BACK_MIXER_POS
728728 }
729729
730−void centerMix8bRampBidiLoopSIntrp(voice_t *v, uint32_t numSamples)
730+void centerMix8bRampBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
731731 {
732732 const int8_t *base, *revBase, *smpPtr;
733733 int8_t *smpTapPtr;
@@ -809,7 +809,7 @@ void centerMix8bRampBidiLoopSIntrp(voice_t *v, uint32_t numSamples) · 75 unmodified lines
809809 SET_BACK_MIXER_POS
810810 }
811811
812−void centerMix8bRampNoLoopLIntrp(voice_t *v, uint32_t numSamples)
812+void centerMix8bRampNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
813813 {
814814 const int8_t *base, *smpPtr;
815815 double dSample, *dMixBufferL, *dMixBufferR;
@@ -859,7 +859,7 @@ void centerMix8bRampNoLoopLIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
859859 SET_BACK_MIXER_POS
860860 }
861861
862−void centerMix8bRampLoopLIntrp(voice_t *v, uint32_t numSamples)
862+void centerMix8bRampLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
863863 {
864864 const int8_t *base, *smpPtr;
865865 double dSample, *dMixBufferL, *dMixBufferR;
@@ -909,7 +909,7 @@ void centerMix8bRampLoopLIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
909909 SET_BACK_MIXER_POS
910910 }
911911
912−void centerMix8bRampBidiLoopLIntrp(voice_t *v, uint32_t numSamples)
912+void centerMix8bRampBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
913913 {
914914 const int8_t *base, *revBase, *smpPtr;
915915 double dSample, *dMixBufferL, *dMixBufferR;
@@ -965,7 +965,7 @@ void centerMix8bRampBidiLoopLIntrp(voice_t *v, uint32_t numSamples) · 49 unmodified lines
965965 /* 16-BIT CENTER MIXING ROUTINES */
966966 /* ----------------------------------------------------------------------- */
967967
968−void centerMix16bNoLoop(voice_t *v, uint32_t numSamples)
968+void centerMix16bNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
969969 {
970970 const int16_t *base, *smpPtr;
971971 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1007,7 +1007,7 @@ void centerMix16bNoLoop(voice_t *v, uint32_t numSamples) · 35 unmodified lines
10071007 SET_BACK_MIXER_POS
10081008 }
10091009
1010−void centerMix16bLoop(voice_t *v, uint32_t numSamples)
1010+void centerMix16bLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
10111011 {
10121012 const int16_t *base, *smpPtr;
10131013 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1049,7 +1049,7 @@ void centerMix16bLoop(voice_t *v, uint32_t numSamples) · 35 unmodified lines
10491049 SET_BACK_MIXER_POS
10501050 }
10511051
1052−void centerMix16bBidiLoop(voice_t *v, uint32_t numSamples)
1052+void centerMix16bBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
10531053 {
10541054 const int16_t *base, *revBase, *smpPtr;
10551055 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1093,7 +1093,7 @@ void centerMix16bBidiLoop(voice_t *v, uint32_t numSamples) · 37 unmodified lines
10931093 SET_BACK_MIXER_POS
10941094 }
10951095
1096−void centerMix16bNoLoopSIntrp(voice_t *v, uint32_t numSamples)
1096+void centerMix16bNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
10971097 {
10981098 const int16_t *base, *smpPtr;
10991099 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1135,7 +1135,7 @@ void centerMix16bNoLoopSIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
11351135 SET_BACK_MIXER_POS
11361136 }
11371137
1138−void centerMix16bLoopSIntrp(voice_t *v, uint32_t numSamples)
1138+void centerMix16bLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
11391139 {
11401140 const int16_t *base, *smpPtr;
11411141 int16_t *smpTapPtr;
@@ -1202,7 +1202,7 @@ void centerMix16bLoopSIntrp(voice_t *v, uint32_t numSamples) · 60 unmodified lines
12021202 SET_BACK_MIXER_POS
12031203 }
12041204
1205−void centerMix16bBidiLoopSIntrp(voice_t *v, uint32_t numSamples)
1205+void centerMix16bBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
12061206 {
12071207 const int16_t *base, *revBase, *smpPtr;
12081208 int16_t *smpTapPtr;
@@ -1271,7 +1271,7 @@ void centerMix16bBidiLoopSIntrp(voice_t *v, uint32_t numSamples) · 62 unmodified lines
12711271 SET_BACK_MIXER_POS
12721272 }
12731273
1274−void centerMix16bNoLoopLIntrp(voice_t *v, uint32_t numSamples)
1274+void centerMix16bNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
12751275 {
12761276 const int16_t *base, *smpPtr;
12771277 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1313,7 +1313,7 @@ void centerMix16bNoLoopLIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
13131313 SET_BACK_MIXER_POS
13141314 }
13151315
1316−void centerMix16bLoopLIntrp(voice_t *v, uint32_t numSamples)
1316+void centerMix16bLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
13171317 {
13181318 const int16_t *base, *smpPtr;
13191319 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1355,7 +1355,7 @@ void centerMix16bLoopLIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
13551355 SET_BACK_MIXER_POS
13561356 }
13571357
1358−void centerMix16bBidiLoopLIntrp(voice_t *v, uint32_t numSamples)
1358+void centerMix16bBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
13591359 {
13601360 const int16_t *base, *revBase, *smpPtr;
13611361 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1400,7 +1400,7 @@ void centerMix16bBidiLoopLIntrp(voice_t *v, uint32_t numSamples) · 38 unmodified lines
14001400 }
14011401
14021402
1403−void centerMix16bRampNoLoop(voice_t *v, uint32_t numSamples)
1403+void centerMix16bRampNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
14041404 {
14051405 const int16_t *base, *smpPtr;
14061406 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1450,7 +1450,7 @@ void centerMix16bRampNoLoop(voice_t *v, uint32_t numSamples) · 43 unmodified lines
14501450 SET_BACK_MIXER_POS
14511451 }
14521452
1453−void centerMix16bRampLoop(voice_t *v, uint32_t numSamples)
1453+void centerMix16bRampLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
14541454 {
14551455 const int16_t *base, *smpPtr;
14561456 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1500,7 +1500,7 @@ void centerMix16bRampLoop(voice_t *v, uint32_t numSamples) · 43 unmodified lines
15001500 SET_BACK_MIXER_POS
15011501 }
15021502
1503−void centerMix16bRampBidiLoop(voice_t *v, uint32_t numSamples)
1503+void centerMix16bRampBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
15041504 {
15051505 const int16_t *base, *revBase, *smpPtr;
15061506 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1552,7 +1552,7 @@ void centerMix16bRampBidiLoop(voice_t *v, uint32_t numSamples) · 45 unmodified lines
15521552 SET_BACK_MIXER_POS
15531553 }
15541554
1555−void centerMix16bRampNoLoopSIntrp(voice_t *v, uint32_t numSamples)
1555+void centerMix16bRampNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
15561556 {
15571557 const int16_t *base, *smpPtr;
15581558 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1602,7 +1602,7 @@ void centerMix16bRampNoLoopSIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
16021602 SET_BACK_MIXER_POS
16031603 }
16041604
1605−void centerMix16bRampLoopSIntrp(voice_t *v, uint32_t numSamples)
1605+void centerMix16bRampLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
16061606 {
16071607 const int16_t *base, *smpPtr;
16081608 int16_t *smpTapPtr;
@@ -1682,7 +1682,7 @@ void centerMix16bRampLoopSIntrp(voice_t *v, uint32_t numSamples) · 73 unmodified lines
16821682 SET_BACK_MIXER_POS
16831683 }
16841684
1685−void centerMix16bRampBidiLoopSIntrp(voice_t *v, uint32_t numSamples)
1685+void centerMix16bRampBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
16861686 {
16871687 const int16_t *base, *revBase, *smpPtr;
16881688 int16_t *smpTapPtr;
@@ -1764,7 +1764,7 @@ void centerMix16bRampBidiLoopSIntrp(voice_t *v, uint32_t numSamples) · 75 unmodified lines
17641764 SET_BACK_MIXER_POS
17651765 }
17661766
1767−void centerMix16bRampNoLoopLIntrp(voice_t *v, uint32_t numSamples)
1767+void centerMix16bRampNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
17681768 {
17691769 const int16_t *base, *smpPtr;
17701770 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1814,7 +1814,7 @@ void centerMix16bRampNoLoopLIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
18141814 SET_BACK_MIXER_POS
18151815 }
18161816
1817−void centerMix16bRampLoopLIntrp(voice_t *v, uint32_t numSamples)
1817+void centerMix16bRampLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
18181818 {
18191819 const int16_t *base, *smpPtr;
18201820 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1864,7 +1864,7 @@ void centerMix16bRampLoopLIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
18641864 SET_BACK_MIXER_POS
18651865 }
18661866
1867−void centerMix16bRampBidiLoopLIntrp(voice_t *v, uint32_t numSamples)
1867+void centerMix16bRampBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
18681868 {
18691869 const int16_t *base, *revBase, *smpPtr;
18701870 double dSample, *dMixBufferL, *dMixBufferR;
src/mixer/ft2_center_mix.h+36−36
@@ -6,47 +6,47 @@ · 5 unmodified lines
66 // no volume ramping
77
88 // 8-bit
9−void centerMix8bNoLoop(voice_t *v, uint32_t numSamples);
10−void centerMix8bLoop(voice_t *v, uint32_t numSamples);
11−void centerMix8bBidiLoop(voice_t *v, uint32_t numSamples);
12−void centerMix8bNoLoopSIntrp(voice_t *v, uint32_t numSamples);
13−void centerMix8bLoopSIntrp(voice_t *v, uint32_t numSamples);
14−void centerMix8bBidiLoopSIntrp(voice_t *v, uint32_t numSamples);
15−void centerMix8bNoLoopLIntrp(voice_t *v, uint32_t numSamples);
16−void centerMix8bLoopLIntrp(voice_t *v, uint32_t numSamples);
17−void centerMix8bBidiLoopLIntrp(voice_t *v, uint32_t numSamples);
9+void centerMix8bNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
10+void centerMix8bLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
11+void centerMix8bBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
12+void centerMix8bNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
13+void centerMix8bLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
14+void centerMix8bBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
15+void centerMix8bNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
16+void centerMix8bLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
17+void centerMix8bBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
1818
1919 // 16-bit
20−void centerMix16bNoLoop(voice_t *v, uint32_t numSamples);
21−void centerMix16bLoop(voice_t *v, uint32_t numSamples);
22−void centerMix16bBidiLoop(voice_t *v, uint32_t numSamples);
23−void centerMix16bNoLoopSIntrp(voice_t *v, uint32_t numSamples);
24−void centerMix16bLoopSIntrp(voice_t *v, uint32_t numSamples);
25−void centerMix16bBidiLoopSIntrp(voice_t *v, uint32_t numSamples);
26−void centerMix16bNoLoopLIntrp(voice_t *v, uint32_t numSamples);
27−void centerMix16bLoopLIntrp(voice_t *v, uint32_t numSamples);
28−void centerMix16bBidiLoopLIntrp(voice_t *v, uint32_t numSamples);
20+void centerMix16bNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
21+void centerMix16bLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
22+void centerMix16bBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
23+void centerMix16bNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
24+void centerMix16bLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
25+void centerMix16bBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
26+void centerMix16bNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
27+void centerMix16bLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
28+void centerMix16bBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
2929
3030 // volume ramping
3131
3232 // 8-bit
33−void centerMix8bRampNoLoop(voice_t *v, uint32_t numSamples);
34−void centerMix8bRampLoop(voice_t *v, uint32_t numSamples);
35−void centerMix8bRampBidiLoop(voice_t *v, uint32_t numSamples);
36−void centerMix8bRampNoLoopSIntrp(voice_t *v, uint32_t numSamples);
37−void centerMix8bRampLoopSIntrp(voice_t *v, uint32_t numSamples);
38−void centerMix8bRampBidiLoopSIntrp(voice_t *v, uint32_t numSamples);
39−void centerMix8bRampNoLoopLIntrp(voice_t *v, uint32_t numSamples);
40−void centerMix8bRampLoopLIntrp(voice_t *v, uint32_t numSamples);
41−void centerMix8bRampBidiLoopLIntrp(voice_t *v, uint32_t numSamples);
33+void centerMix8bRampNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
34+void centerMix8bRampLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
35+void centerMix8bRampBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
36+void centerMix8bRampNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
37+void centerMix8bRampLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
38+void centerMix8bRampBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
39+void centerMix8bRampNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
40+void centerMix8bRampLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
41+void centerMix8bRampBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
4242
4343 // 16bit
44−void centerMix16bRampNoLoop(voice_t *v, uint32_t numSamples);
45−void centerMix16bRampLoop(voice_t *v, uint32_t numSamples);
46−void centerMix16bRampBidiLoop(voice_t *v, uint32_t numSamples);
47−void centerMix16bRampNoLoopSIntrp(voice_t *v, uint32_t numSamples);
48−void centerMix16bRampLoopSIntrp(voice_t *v, uint32_t numSamples);
49−void centerMix16bRampBidiLoopSIntrp(voice_t *v, uint32_t numSamples);
50−void centerMix16bRampNoLoopLIntrp(voice_t *v, uint32_t numSamples);
51−void centerMix16bRampLoopLIntrp(voice_t *v, uint32_t numSamples);
52−void centerMix16bRampBidiLoopLIntrp(voice_t *v, uint32_t numSamples);
44+void centerMix16bRampNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
45+void centerMix16bRampLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
46+void centerMix16bRampBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
47+void centerMix16bRampNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
48+void centerMix16bRampLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
49+void centerMix16bRampBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
50+void centerMix16bRampNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
51+void centerMix16bRampLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
52+void centerMix16bRampBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
src/mixer/ft2_mix.c+36−36
@@ -31,7 +31,7 @@ · 30 unmodified lines
3131 /* 8-BIT MIXING ROUTINES */
3232 /* ----------------------------------------------------------------------- */
3333
34−static void mix8bNoLoop(voice_t *v, uint32_t numSamples)
34+static void mix8bNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
3535 {
3636 const int8_t *base, *smpPtr;
3737 double dSample, *dMixBufferL, *dMixBufferR;
@@ -73,7 +73,7 @@ static void mix8bNoLoop(voice_t *v, uint32_t numSamples) · 35 unmodified lines
7373 SET_BACK_MIXER_POS
7474 }
7575
76−static void mix8bLoop(voice_t *v, uint32_t numSamples)
76+static void mix8bLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
7777 {
7878 const int8_t *base, *smpPtr;
7979 double dSample, *dMixBufferL, *dMixBufferR;
@@ -115,7 +115,7 @@ static void mix8bLoop(voice_t *v, uint32_t numSamples) · 35 unmodified lines
115115 SET_BACK_MIXER_POS
116116 }
117117
118−static void mix8bBidiLoop(voice_t *v, uint32_t numSamples)
118+static void mix8bBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
119119 {
120120 const int8_t *base, *revBase, *smpPtr;
121121 double dSample, *dMixBufferL, *dMixBufferR;
@@ -158,7 +158,7 @@ static void mix8bBidiLoop(voice_t *v, uint32_t numSamples) · 36 unmodified lines
158158 SET_BACK_MIXER_POS
159159 }
160160
161−static void mix8bNoLoopSIntrp(voice_t *v, uint32_t numSamples)
161+static void mix8bNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
162162 {
163163 const int8_t *base, *smpPtr;
164164 double dSample, *dMixBufferL, *dMixBufferR;
@@ -200,7 +200,7 @@ static void mix8bNoLoopSIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
200200 SET_BACK_MIXER_POS
201201 }
202202
203−static void mix8bLoopSIntrp(voice_t *v, uint32_t numSamples)
203+static void mix8bLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
204204 {
205205 const int8_t *base, *smpPtr;
206206 int8_t *smpTapPtr;
@@ -267,7 +267,7 @@ static void mix8bLoopSIntrp(voice_t *v, uint32_t numSamples) · 60 unmodified lines
267267 SET_BACK_MIXER_POS
268268 }
269269
270−static void mix8bBidiLoopSIntrp(voice_t *v, uint32_t numSamples)
270+static void mix8bBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
271271 {
272272 const int8_t *base, *revBase, *smpPtr;
273273 int8_t *smpTapPtr;
@@ -336,7 +336,7 @@ static void mix8bBidiLoopSIntrp(voice_t *v, uint32_t numSamples) · 62 unmodified lines
336336 SET_BACK_MIXER_POS
337337 }
338338
339−static void mix8bNoLoopLIntrp(voice_t *v, uint32_t numSamples)
339+static void mix8bNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
340340 {
341341 const int8_t *base, *smpPtr;
342342 double dSample, *dMixBufferL, *dMixBufferR;
@@ -378,7 +378,7 @@ static void mix8bNoLoopLIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
378378 SET_BACK_MIXER_POS
379379 }
380380
381−static void mix8bLoopLIntrp(voice_t *v, uint32_t numSamples)
381+static void mix8bLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
382382 {
383383 const int8_t *base, *smpPtr;
384384 double dSample, *dMixBufferL, *dMixBufferR;
@@ -420,7 +420,7 @@ static void mix8bLoopLIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
420420 SET_BACK_MIXER_POS
421421 }
422422
423−static void mix8bBidiLoopLIntrp(voice_t *v, uint32_t numSamples)
423+static void mix8bBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
424424 {
425425 const int8_t *base, *revBase, *smpPtr;
426426 double dSample, *dMixBufferL, *dMixBufferR;
@@ -464,7 +464,7 @@ static void mix8bBidiLoopLIntrp(voice_t *v, uint32_t numSamples) · 37 unmodified lines
464464 SET_BACK_MIXER_POS
465465 }
466466
467−static void mix8bRampNoLoop(voice_t *v, uint32_t numSamples)
467+static void mix8bRampNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
468468 {
469469 const int8_t *base, *smpPtr;
470470 double dSample, *dMixBufferL, *dMixBufferR;
@@ -514,7 +514,7 @@ static void mix8bRampNoLoop(voice_t *v, uint32_t numSamples) · 43 unmodified lines
514514 SET_BACK_MIXER_POS
515515 }
516516
517−static void mix8bRampLoop(voice_t *v, uint32_t numSamples)
517+static void mix8bRampLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
518518 {
519519 const int8_t *base, *smpPtr;
520520 double dSample, *dMixBufferL, *dMixBufferR;
@@ -564,7 +564,7 @@ static void mix8bRampLoop(voice_t *v, uint32_t numSamples) · 43 unmodified lines
564564 SET_BACK_MIXER_POS
565565 }
566566
567−static void mix8bRampBidiLoop(voice_t *v, uint32_t numSamples)
567+static void mix8bRampBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
568568 {
569569 const int8_t *base, *revBase, *smpPtr;
570570 double dSample, *dMixBufferL, *dMixBufferR;
@@ -616,7 +616,7 @@ static void mix8bRampBidiLoop(voice_t *v, uint32_t numSamples) · 45 unmodified lines
616616 SET_BACK_MIXER_POS
617617 }
618618
619−static void mix8bRampNoLoopSIntrp(voice_t *v, uint32_t numSamples)
619+static void mix8bRampNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
620620 {
621621 const int8_t *base, *smpPtr;
622622 double dSample, *dMixBufferL, *dMixBufferR;
@@ -666,7 +666,7 @@ static void mix8bRampNoLoopSIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
666666 SET_BACK_MIXER_POS
667667 }
668668
669−static void mix8bRampLoopSIntrp(voice_t *v, uint32_t numSamples)
669+static void mix8bRampLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
670670 {
671671 const int8_t *base, *smpPtr;
672672 int8_t *smpTapPtr;
@@ -746,7 +746,7 @@ static void mix8bRampLoopSIntrp(voice_t *v, uint32_t numSamples) · 73 unmodified lines
746746 SET_BACK_MIXER_POS
747747 }
748748
749−static void mix8bRampBidiLoopSIntrp(voice_t *v, uint32_t numSamples)
749+static void mix8bRampBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
750750 {
751751 const int8_t *base, *revBase, *smpPtr;
752752 int8_t *smpTapPtr;
@@ -828,7 +828,7 @@ static void mix8bRampBidiLoopSIntrp(voice_t *v, uint32_t numSamples) · 75 unmodified lines
828828 SET_BACK_MIXER_POS
829829 }
830830
831−static void mix8bRampNoLoopLIntrp(voice_t *v, uint32_t numSamples)
831+static void mix8bRampNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
832832 {
833833 const int8_t *base, *smpPtr;
834834 double dSample, *dMixBufferL, *dMixBufferR;
@@ -878,7 +878,7 @@ static void mix8bRampNoLoopLIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
878878 SET_BACK_MIXER_POS
879879 }
880880
881−static void mix8bRampLoopLIntrp(voice_t *v, uint32_t numSamples)
881+static void mix8bRampLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
882882 {
883883 const int8_t *base, *smpPtr;
884884 double dSample, *dMixBufferL, *dMixBufferR;
@@ -928,7 +928,7 @@ static void mix8bRampLoopLIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
928928 SET_BACK_MIXER_POS
929929 }
930930
931−static void mix8bRampBidiLoopLIntrp(voice_t *v, uint32_t numSamples)
931+static void mix8bRampBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
932932 {
933933 const int8_t *base, *revBase, *smpPtr;
934934 double dSample, *dMixBufferL, *dMixBufferR;
@@ -984,7 +984,7 @@ static void mix8bRampBidiLoopLIntrp(voice_t *v, uint32_t numSamples) · 49 unmodified lines
984984 /* 16-BIT MIXING ROUTINES */
985985 /* ----------------------------------------------------------------------- */
986986
987−static void mix16bNoLoop(voice_t *v, uint32_t numSamples)
987+static void mix16bNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
988988 {
989989 const int16_t *base, *smpPtr;
990990 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1026,7 +1026,7 @@ static void mix16bNoLoop(voice_t *v, uint32_t numSamples) · 35 unmodified lines
10261026 SET_BACK_MIXER_POS
10271027 }
10281028
1029−static void mix16bLoop(voice_t *v, uint32_t numSamples)
1029+static void mix16bLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
10301030 {
10311031 const int16_t *base, *smpPtr;
10321032 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1068,7 +1068,7 @@ static void mix16bLoop(voice_t *v, uint32_t numSamples) · 35 unmodified lines
10681068 SET_BACK_MIXER_POS
10691069 }
10701070
1071−static void mix16bBidiLoop(voice_t *v, uint32_t numSamples)
1071+static void mix16bBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
10721072 {
10731073 const int16_t *base, *revBase, *smpPtr;
10741074 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1112,7 +1112,7 @@ static void mix16bBidiLoop(voice_t *v, uint32_t numSamples) · 37 unmodified lines
11121112 SET_BACK_MIXER_POS
11131113 }
11141114
1115−static void mix16bNoLoopSIntrp(voice_t *v, uint32_t numSamples)
1115+static void mix16bNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
11161116 {
11171117 const int16_t *base, *smpPtr;
11181118 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1154,7 +1154,7 @@ static void mix16bNoLoopSIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
11541154 SET_BACK_MIXER_POS
11551155 }
11561156
1157−static void mix16bLoopSIntrp(voice_t *v, uint32_t numSamples)
1157+static void mix16bLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
11581158 {
11591159 const int16_t *base, *smpPtr;
11601160 int16_t *smpTapPtr;
@@ -1221,7 +1221,7 @@ static void mix16bLoopSIntrp(voice_t *v, uint32_t numSamples) · 60 unmodified lines
12211221 SET_BACK_MIXER_POS
12221222 }
12231223
1224−static void mix16bBidiLoopSIntrp(voice_t *v, uint32_t numSamples)
1224+static void mix16bBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
12251225 {
12261226 const int16_t *base, *revBase, *smpPtr;
12271227 int16_t *smpTapPtr;
@@ -1290,7 +1290,7 @@ static void mix16bBidiLoopSIntrp(voice_t *v, uint32_t numSamples) · 62 unmodified lines
12901290 SET_BACK_MIXER_POS
12911291 }
12921292
1293−static void mix16bNoLoopLIntrp(voice_t *v, uint32_t numSamples)
1293+static void mix16bNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
12941294 {
12951295 const int16_t *base, *smpPtr;
12961296 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1332,7 +1332,7 @@ static void mix16bNoLoopLIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
13321332 SET_BACK_MIXER_POS
13331333 }
13341334
1335−static void mix16bLoopLIntrp(voice_t *v, uint32_t numSamples)
1335+static void mix16bLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
13361336 {
13371337 const int16_t *base, *smpPtr;
13381338 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1374,7 +1374,7 @@ static void mix16bLoopLIntrp(voice_t *v, uint32_t numSamples) · 35 unmodified lines
13741374 SET_BACK_MIXER_POS
13751375 }
13761376
1377−static void mix16bBidiLoopLIntrp(voice_t *v, uint32_t numSamples)
1377+static void mix16bBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
13781378 {
13791379 const int16_t *base, *revBase, *smpPtr;
13801380 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1418,7 +1418,7 @@ static void mix16bBidiLoopLIntrp(voice_t *v, uint32_t numSamples) · 37 unmodified lines
14181418 SET_BACK_MIXER_POS
14191419 }
14201420
1421−static void mix16bRampNoLoop(voice_t *v, uint32_t numSamples)
1421+static void mix16bRampNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
14221422 {
14231423 const int16_t *base, *smpPtr;
14241424 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1468,7 +1468,7 @@ static void mix16bRampNoLoop(voice_t *v, uint32_t numSamples) · 43 unmodified lines
14681468 SET_BACK_MIXER_POS
14691469 }
14701470
1471−static void mix16bRampLoop(voice_t *v, uint32_t numSamples)
1471+static void mix16bRampLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
14721472 {
14731473 const int16_t *base, *smpPtr;
14741474 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1518,7 +1518,7 @@ static void mix16bRampLoop(voice_t *v, uint32_t numSamples) · 43 unmodified lines
15181518 SET_BACK_MIXER_POS
15191519 }
15201520
1521−static void mix16bRampBidiLoop(voice_t *v, uint32_t numSamples)
1521+static void mix16bRampBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
15221522 {
15231523 const int16_t *base, *revBase, *smpPtr;
15241524 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1570,7 +1570,7 @@ static void mix16bRampBidiLoop(voice_t *v, uint32_t numSamples) · 45 unmodified lines
15701570 SET_BACK_MIXER_POS
15711571 }
15721572
1573−static void mix16bRampNoLoopSIntrp(voice_t *v, uint32_t numSamples)
1573+static void mix16bRampNoLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
15741574 {
15751575 const int16_t *base, *smpPtr;
15761576 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1620,7 +1620,7 @@ static void mix16bRampNoLoopSIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
16201620 SET_BACK_MIXER_POS
16211621 }
16221622
1623−static void mix16bRampLoopSIntrp(voice_t *v, uint32_t numSamples)
1623+static void mix16bRampLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
16241624 {
16251625 const int16_t *base, *smpPtr;
16261626 int16_t *smpTapPtr;
@@ -1700,7 +1700,7 @@ static void mix16bRampLoopSIntrp(voice_t *v, uint32_t numSamples) · 73 unmodified lines
17001700 SET_BACK_MIXER_POS
17011701 }
17021702
1703−static void mix16bRampBidiLoopSIntrp(voice_t *v, uint32_t numSamples)
1703+static void mix16bRampBidiLoopSIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
17041704 {
17051705 const int16_t *base, *revBase, *smpPtr;
17061706 int16_t *smpTapPtr;
@@ -1782,7 +1782,7 @@ static void mix16bRampBidiLoopSIntrp(voice_t *v, uint32_t numSamples) · 75 unmodified lines
17821782 SET_BACK_MIXER_POS
17831783 }
17841784
1785−static void mix16bRampNoLoopLIntrp(voice_t *v, uint32_t numSamples)
1785+static void mix16bRampNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
17861786 {
17871787 const int16_t *base, *smpPtr;
17881788 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1832,7 +1832,7 @@ static void mix16bRampNoLoopLIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
18321832 SET_BACK_MIXER_POS
18331833 }
18341834
1835−static void mix16bRampLoopLIntrp(voice_t *v, uint32_t numSamples)
1835+static void mix16bRampLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
18361836 {
18371837 const int16_t *base, *smpPtr;
18381838 double dSample, *dMixBufferL, *dMixBufferR;
@@ -1882,7 +1882,7 @@ static void mix16bRampLoopLIntrp(voice_t *v, uint32_t numSamples) · 43 unmodified lines
18821882 SET_BACK_MIXER_POS
18831883 }
18841884
1885−static void mix16bRampBidiLoopLIntrp(voice_t *v, uint32_t numSamples)
1885+static void mix16bRampBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
18861886 {
18871887 const int16_t *base, *revBase, *smpPtr;
18881888 double dSample, *dMixBufferL, *dMixBufferR;
src/mixer/ft2_mix.h+1−1
@@ -3,6 +3,6 @@ · 2 unmodified lines
33 #include <stdint.h>
44 #include "../ft2_audio.h"
55
6−typedef void (*mixFunc)(void *, int32_t);
6+typedef void (*mixFunc)(void *, uint32_t, uint32_t);
77
88 extern const mixFunc mixFuncTab[72]; // ft2_mix.c
src/mixer/ft2_mix_macros.h+6−6
@@ -31,15 +31,15 @@ · 30 unmodified lines
3131
3232 #define GET_MIXER_VARS \
3333 const uint64_t delta = v->delta; \
34− dMixBufferL = audio.dMixBufferL; \
35− dMixBufferR = audio.dMixBufferR; \
34+ dMixBufferL = audio.dMixBufferL + bufferPos; \
35+ dMixBufferR = audio.dMixBufferR + bufferPos; \
3636 pos = v->pos; \
3737 posFrac = v->posFrac; \
3838
3939 #define GET_MIXER_VARS_RAMP \
4040 const uint64_t delta = v->delta; \
41− dMixBufferL = audio.dMixBufferL; \
42− dMixBufferR = audio.dMixBufferR; \
41+ dMixBufferL = audio.dMixBufferL + bufferPos; \
42+ dMixBufferR = audio.dMixBufferR + bufferPos; \
4343 dVolLDelta = v->dVolDeltaL; \
4444 dVolRDelta = v->dVolDeltaR; \
4545 pos = v->pos; \
@@ -47,8 +47,8 @@ · 1 unmodified line
4747
4848 #define GET_MIXER_VARS_MONO_RAMP \
4949 const uint64_t delta = v->delta; \
50− dMixBufferL = audio.dMixBufferL; \
51− dMixBufferR = audio.dMixBufferR; \
50+ dMixBufferL = audio.dMixBufferL + bufferPos; \
51+ dMixBufferR = audio.dMixBufferR + bufferPos; \
5252 dVolLDelta = v->dVolDeltaL; \
5353 pos = v->pos; \
5454 posFrac = v->posFrac; \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t