MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / resample

Function resample

extlibs/soloud/src/core/soloud.cpp:855–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

853#define FIXPOINT_FRAC_MASK ((1 << FIXPOINT_FRAC_BITS) - 1)
854
855 void resample(float *aSrc,
856 float *aSrc1,
857 float *aDst,
858 int aSrcOffset,
859 int aDstSampleCount,
860 float aSrcSamplerate,
861 float aDstSamplerate,
862 int aStepFixed)
863 {
864#if 0
865
866#elif defined(RESAMPLER_LINEAR)
867 int i;
868 int pos = aSrcOffset;
869
870 for (i = 0; i < aDstSampleCount; i++, pos += aStepFixed)
871 {
872 int p = pos >> FIXPOINT_FRAC_BITS;
873 int f = pos & FIXPOINT_FRAC_MASK;
874#ifdef _DEBUG
875 if (p >= SAMPLE_GRANULARITY || p < 0)
876 {
877 // This should never actually happen
878 p = SAMPLE_GRANULARITY - 1;
879 }
880#endif
881 float s1 = aSrc1[SAMPLE_GRANULARITY - 1];
882 float s2 = aSrc[p];
883 if (p != 0)
884 {
885 s1 = aSrc[p-1];
886 }
887 aDst[i] = s1 + (s2 - s1) * f * (1 / (float)FIXPOINT_FRAC_MUL);
888 }
889#else // Point sample
890 int i;
891 int pos = aSrcOffset;
892
893 for (i = 0; i < aDstSampleCount; i++, pos += aStepFixed)
894 {
895 int p = pos >> FIXPOINT_FRAC_BITS;
896 aDst[i] = aSrc[p];
897 }
898#endif
899 }
900
901 void panAndExpand(AudioSourceInstance *aVoice, float *aBuffer, unsigned int aSamplesToRead, unsigned int aBufferSize, float *aScratch, unsigned int aChannels)
902 {

Callers 1

mixBusMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected