Replaced libsoxr with r8brain free source
Replaced the free SoX resampler with the r8brain resampler source, which is also free. Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
c8d8e759bc
commit
777ab28d6a
|
@ -19,3 +19,6 @@
|
|||
[submodule "Frameworks/libsidplayfp/sidplayfp"]
|
||||
path = Frameworks/libsidplayfp/sidplayfp
|
||||
url = https://github.com/kode54/libsidplayfp.git
|
||||
[submodule "Audio/ThirdParty/r8brain-free-src"]
|
||||
path = Audio/ThirdParty/r8brain-free-src
|
||||
url = https://github.com/avaneev/r8brain-free-src
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#import <AudioUnit/AudioUnit.h>
|
||||
#import <CoreAudio/AudioHardware.h>
|
||||
|
||||
#import <soxr.h>
|
||||
|
||||
#import "Node.h"
|
||||
|
||||
#import "HeadphoneFilter.h"
|
||||
|
@ -21,7 +19,7 @@
|
|||
@interface ConverterNode : Node {
|
||||
NSDictionary *rgInfo;
|
||||
|
||||
soxr_t soxr;
|
||||
void *_r8bstate;
|
||||
|
||||
void *inputBuffer;
|
||||
size_t inputBufferSize;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#import "BadSampleCleaner.h"
|
||||
#endif
|
||||
|
||||
#import "r8bstate.h"
|
||||
|
||||
void PrintStreamDesc(AudioStreamBasicDescription *inDesc) {
|
||||
if(!inDesc) {
|
||||
DLog(@"Can't print a NULL desc!\n");
|
||||
|
@ -48,7 +50,7 @@ void PrintStreamDesc(AudioStreamBasicDescription *inDesc) {
|
|||
if(self) {
|
||||
rgInfo = nil;
|
||||
|
||||
soxr = 0;
|
||||
_r8bstate = 0;
|
||||
inputBuffer = NULL;
|
||||
inputBufferSize = 0;
|
||||
floatBuffer = NULL;
|
||||
|
@ -76,7 +78,7 @@ void PrintStreamDesc(AudioStreamBasicDescription *inDesc) {
|
|||
return self;
|
||||
}
|
||||
|
||||
void scale_by_volume(float *buffer, size_t count, float volume) {
|
||||
extern "C" void scale_by_volume(float *buffer, size_t count, float volume) {
|
||||
if(volume != 1.0) {
|
||||
size_t unaligned = (uintptr_t)buffer & 15;
|
||||
if(unaligned) {
|
||||
|
@ -147,6 +149,10 @@ static void dsd2pcm_reset(void *);
|
|||
static void *dsd2pcm_alloc() {
|
||||
struct dsd2pcm_state *state = (struct dsd2pcm_state *)calloc(1, sizeof(struct dsd2pcm_state));
|
||||
|
||||
float *FILT_LOOKUP_TABLE;
|
||||
double *temp;
|
||||
uint8_t *REVERSE_BITS;
|
||||
|
||||
if(!state)
|
||||
return NULL;
|
||||
|
||||
|
@ -156,8 +162,8 @@ static void *dsd2pcm_alloc() {
|
|||
state->FILT_LOOKUP_TABLE = (float *)calloc(sizeof(float), FILT_LOOKUP_PARTS << 8);
|
||||
if(!state->FILT_LOOKUP_TABLE)
|
||||
goto fail;
|
||||
float *FILT_LOOKUP_TABLE = state->FILT_LOOKUP_TABLE;
|
||||
double *temp = (double *)calloc(sizeof(double), 0x100);
|
||||
FILT_LOOKUP_TABLE = state->FILT_LOOKUP_TABLE;
|
||||
temp = (double *)calloc(sizeof(double), 0x100);
|
||||
if(!temp)
|
||||
goto fail;
|
||||
for(int part = 0, sofs = 0, dofs = 0; part < FILT_LOOKUP_PARTS;) {
|
||||
|
@ -190,7 +196,7 @@ static void *dsd2pcm_alloc() {
|
|||
state->REVERSE_BITS = (uint8_t *)calloc(1, 0x100);
|
||||
if(!state->REVERSE_BITS)
|
||||
goto fail;
|
||||
uint8_t *REVERSE_BITS = state->REVERSE_BITS;
|
||||
REVERSE_BITS = state->REVERSE_BITS;
|
||||
for(int i = 0, j = 0; i < 0x100; i++) {
|
||||
REVERSE_BITS[i] = (uint8_t)j;
|
||||
// "reverse-increment" of j
|
||||
|
@ -507,7 +513,7 @@ tryagain:
|
|||
size_t bytesRead = frameCount * inf.mBytesPerPacket;
|
||||
if(frameCount) {
|
||||
NSData *samples = [chunk removeSamples:frameCount];
|
||||
memcpy(inputBuffer + bytesReadFromInput, [samples bytes], bytesRead);
|
||||
memcpy(((uint8_t *)inputBuffer) + bytesReadFromInput, [samples bytes], bytesRead);
|
||||
lastChunkIn = [[AudioChunk alloc] init];
|
||||
[lastChunkIn setFormat:inf];
|
||||
[lastChunkIn setChannelConfig:config];
|
||||
|
@ -526,7 +532,7 @@ tryagain:
|
|||
if(!skipResampler && !is_postextrapolated_) {
|
||||
if(dsd2pcm) {
|
||||
uint32_t amountToSkip = dsd2pcmLatency * inputFormat.mBytesPerPacket;
|
||||
memset(inputBuffer + bytesReadFromInput, 0x55, amountToSkip);
|
||||
memset(((uint8_t *)inputBuffer) + bytesReadFromInput, 0x55, amountToSkip);
|
||||
bytesReadFromInput += amountToSkip;
|
||||
}
|
||||
is_postextrapolated_ = 1;
|
||||
|
@ -559,14 +565,14 @@ tryagain:
|
|||
|
||||
if(bytesReadFromInput && isBigEndian) {
|
||||
// Time for endian swap!
|
||||
convert_be_to_le(inputBuffer, inputFormat.mBitsPerChannel, bytesReadFromInput);
|
||||
convert_be_to_le((uint8_t *)inputBuffer, inputFormat.mBitsPerChannel, bytesReadFromInput);
|
||||
}
|
||||
|
||||
if(bytesReadFromInput && isFloat && inputFormat.mBitsPerChannel == 64) {
|
||||
// Time for precision loss from weird inputs
|
||||
samplesRead = bytesReadFromInput / sizeof(double);
|
||||
convert_f64_to_f32(inputBuffer + bytesReadFromInput, inputBuffer, samplesRead);
|
||||
memmove(inputBuffer, inputBuffer + bytesReadFromInput, samplesRead * sizeof(float));
|
||||
convert_f64_to_f32((float *)(((uint8_t *)inputBuffer) + bytesReadFromInput), (const double *)inputBuffer, samplesRead);
|
||||
memmove(inputBuffer, ((uint8_t *)inputBuffer) + bytesReadFromInput, samplesRead * sizeof(float));
|
||||
bytesReadFromInput = samplesRead * sizeof(float);
|
||||
}
|
||||
|
||||
|
@ -575,8 +581,8 @@ tryagain:
|
|||
if(bitsPerSample == 1) {
|
||||
samplesRead = bytesReadFromInput / inputFormat.mBytesPerPacket;
|
||||
size_t buffer_adder = (bytesReadFromInput + 15) & ~15;
|
||||
convert_dsd_to_f32(inputBuffer + buffer_adder, inputBuffer, samplesRead, inputFormat.mChannelsPerFrame, dsd2pcm);
|
||||
memmove(inputBuffer, inputBuffer + buffer_adder, samplesRead * inputFormat.mChannelsPerFrame * sizeof(float));
|
||||
convert_dsd_to_f32((float *)(((uint8_t *)inputBuffer) + buffer_adder), (const uint8_t *)inputBuffer, samplesRead, inputFormat.mChannelsPerFrame, dsd2pcm);
|
||||
memmove(inputBuffer, ((const uint8_t *)inputBuffer) + buffer_adder, samplesRead * inputFormat.mChannelsPerFrame * sizeof(float));
|
||||
bitsPerSample = 32;
|
||||
bytesReadFromInput = samplesRead * inputFormat.mChannelsPerFrame * sizeof(float);
|
||||
isFloat = YES;
|
||||
|
@ -584,10 +590,10 @@ tryagain:
|
|||
samplesRead = bytesReadFromInput;
|
||||
size_t buffer_adder = (bytesReadFromInput + 1) & ~1;
|
||||
if(!isUnsigned)
|
||||
convert_s8_to_s16(inputBuffer + buffer_adder, inputBuffer, samplesRead);
|
||||
convert_s8_to_s16((int16_t *)(((uint8_t *)inputBuffer) + buffer_adder), (const uint8_t *)inputBuffer, samplesRead);
|
||||
else
|
||||
convert_u8_to_s16(inputBuffer + buffer_adder, inputBuffer, samplesRead);
|
||||
memmove(inputBuffer, inputBuffer + buffer_adder, samplesRead * 2);
|
||||
convert_u8_to_s16((int16_t *)(((uint8_t *)inputBuffer) + buffer_adder), (const uint8_t *)inputBuffer, samplesRead);
|
||||
memmove(inputBuffer, ((uint8_t *)inputBuffer) + buffer_adder, samplesRead * 2);
|
||||
bitsPerSample = 16;
|
||||
bytesReadFromInput = samplesRead * 2;
|
||||
isUnsigned = NO;
|
||||
|
@ -595,11 +601,11 @@ tryagain:
|
|||
if(hdcd_decoder) { // implied bits per sample is 16, produces 32 bit int scale
|
||||
samplesRead = bytesReadFromInput / 2;
|
||||
if(isUnsigned)
|
||||
convert_u16_to_s16(inputBuffer, samplesRead);
|
||||
convert_u16_to_s16((int16_t *)inputBuffer, samplesRead);
|
||||
size_t buffer_adder = (bytesReadFromInput + 3) & ~3;
|
||||
convert_s16_to_hdcd_input(inputBuffer + buffer_adder, inputBuffer, samplesRead);
|
||||
memmove(inputBuffer, inputBuffer + buffer_adder, samplesRead * 4);
|
||||
hdcd_process_stereo((hdcd_state_stereo_t *)hdcd_decoder, inputBuffer, (int)(samplesRead / 2));
|
||||
convert_s16_to_hdcd_input((int32_t *)(((uint8_t *)inputBuffer) + buffer_adder), (int16_t *)inputBuffer, samplesRead);
|
||||
memmove(inputBuffer, ((uint8_t *)inputBuffer) + buffer_adder, samplesRead * 4);
|
||||
hdcd_process_stereo((hdcd_state_stereo_t *)hdcd_decoder, (int32_t *)inputBuffer, (int)(samplesRead / 2));
|
||||
if(((hdcd_state_stereo_t *)hdcd_decoder)->channel[0].sustain &&
|
||||
((hdcd_state_stereo_t *)hdcd_decoder)->channel[1].sustain) {
|
||||
[controller sustainHDCD];
|
||||
|
@ -611,12 +617,12 @@ tryagain:
|
|||
} else if(bitsPerSample <= 16) {
|
||||
samplesRead = bytesReadFromInput / 2;
|
||||
if(isUnsigned)
|
||||
convert_u16_to_s16(inputBuffer, samplesRead);
|
||||
convert_u16_to_s16((int16_t *)inputBuffer, samplesRead);
|
||||
size_t buffer_adder = (bytesReadFromInput + 15) & ~15; // vDSP functions expect aligned to four elements
|
||||
vDSP_vflt16((const short *)inputBuffer, 1, (float *)(inputBuffer + buffer_adder), 1, samplesRead);
|
||||
vDSP_vflt16((const short *)inputBuffer, 1, (float *)(((uint8_t *)inputBuffer) + buffer_adder), 1, samplesRead);
|
||||
float scale = 1ULL << 15;
|
||||
vDSP_vsdiv((const float *)(inputBuffer + buffer_adder), 1, &scale, (float *)(inputBuffer + buffer_adder), 1, samplesRead);
|
||||
memmove(inputBuffer, inputBuffer + buffer_adder, samplesRead * sizeof(float));
|
||||
vDSP_vsdiv((const float *)(((uint8_t *)inputBuffer) + buffer_adder), 1, &scale, (float *)(((uint8_t *)inputBuffer) + buffer_adder), 1, samplesRead);
|
||||
memmove(inputBuffer, ((uint8_t *)inputBuffer) + buffer_adder, samplesRead * sizeof(float));
|
||||
bitsPerSample = 32;
|
||||
bytesReadFromInput = samplesRead * sizeof(float);
|
||||
isUnsigned = NO;
|
||||
|
@ -625,10 +631,10 @@ tryagain:
|
|||
samplesRead = bytesReadFromInput / 3;
|
||||
size_t buffer_adder = (bytesReadFromInput + 3) & ~3;
|
||||
if(isUnsigned)
|
||||
convert_u24_to_s32(inputBuffer + buffer_adder, inputBuffer, samplesRead);
|
||||
convert_u24_to_s32((int32_t *)(((uint8_t *)inputBuffer) + buffer_adder), (uint8_t *)inputBuffer, samplesRead);
|
||||
else
|
||||
convert_s24_to_s32(inputBuffer + buffer_adder, inputBuffer, samplesRead);
|
||||
memmove(inputBuffer, inputBuffer + buffer_adder, samplesRead * 4);
|
||||
convert_s24_to_s32((int32_t *)(((uint8_t *)inputBuffer) + buffer_adder), (uint8_t *)inputBuffer, samplesRead);
|
||||
memmove(inputBuffer, ((uint8_t *)inputBuffer) + buffer_adder, samplesRead * 4);
|
||||
bitsPerSample = 32;
|
||||
bytesReadFromInput = samplesRead * 4;
|
||||
isUnsigned = NO;
|
||||
|
@ -636,12 +642,12 @@ tryagain:
|
|||
if(!isFloat && bitsPerSample <= 32) {
|
||||
samplesRead = bytesReadFromInput / 4;
|
||||
if(isUnsigned)
|
||||
convert_u32_to_s32(inputBuffer, samplesRead);
|
||||
convert_u32_to_s32((int32_t *)inputBuffer, samplesRead);
|
||||
size_t buffer_adder = (bytesReadFromInput + 31) & ~31; // vDSP functions expect aligned to four elements
|
||||
vDSP_vflt32((const int *)inputBuffer, 1, (float *)(inputBuffer + buffer_adder), 1, samplesRead);
|
||||
vDSP_vflt32((const int *)inputBuffer, 1, (float *)(((uint8_t *)inputBuffer) + buffer_adder), 1, samplesRead);
|
||||
float scale = (1ULL << 31) / gain;
|
||||
vDSP_vsdiv((const float *)(inputBuffer + buffer_adder), 1, &scale, (float *)(inputBuffer + buffer_adder), 1, samplesRead);
|
||||
memmove(inputBuffer, inputBuffer + buffer_adder, samplesRead * sizeof(float));
|
||||
vDSP_vsdiv((const float *)(((uint8_t *)inputBuffer) + buffer_adder), 1, &scale, (float *)(((uint8_t *)inputBuffer) + buffer_adder), 1, samplesRead);
|
||||
memmove(inputBuffer, ((uint8_t *)inputBuffer) + buffer_adder, samplesRead * sizeof(float));
|
||||
bitsPerSample = 32;
|
||||
bytesReadFromInput = samplesRead * sizeof(float);
|
||||
isUnsigned = NO;
|
||||
|
@ -678,9 +684,9 @@ tryagain:
|
|||
}
|
||||
}
|
||||
|
||||
memmove(inputBuffer + N_samples_to_add_ * floatFormat.mBytesPerPacket, inputBuffer + bytesToSkip, bytesReadFromInput);
|
||||
memmove(((uint8_t *)inputBuffer) + N_samples_to_add_ * floatFormat.mBytesPerPacket, ((uint8_t *)inputBuffer) + bytesToSkip, bytesReadFromInput);
|
||||
|
||||
lpc_extrapolate_bkwd(inputBuffer + _N_samples_to_add_ * floatFormat.mBytesPerPacket, samples_in_buffer, prime, floatFormat.mChannelsPerFrame, LPC_ORDER, _N_samples_to_add_, &extrapolateBuffer, &extrapolateBufferSize);
|
||||
lpc_extrapolate_bkwd((float *)(((uint8_t *)inputBuffer) + _N_samples_to_add_ * floatFormat.mBytesPerPacket), samples_in_buffer, prime, floatFormat.mChannelsPerFrame, LPC_ORDER, _N_samples_to_add_, &extrapolateBuffer, &extrapolateBufferSize);
|
||||
#ifdef _DEBUG
|
||||
[BadSampleCleaner cleanSamples:(float *)inputBuffer
|
||||
amount:_N_samples_to_add_ * floatFormat.mChannelsPerFrame
|
||||
|
@ -707,7 +713,7 @@ tryagain:
|
|||
inputBuffer = realloc(inputBuffer, inputBufferSize = newSize * 3);
|
||||
}
|
||||
|
||||
lpc_extrapolate_fwd(inputBuffer, samples_in_buffer, prime, floatFormat.mChannelsPerFrame, LPC_ORDER, N_samples_to_add_, &extrapolateBuffer, &extrapolateBufferSize);
|
||||
lpc_extrapolate_fwd((float *)inputBuffer, samples_in_buffer, prime, floatFormat.mChannelsPerFrame, LPC_ORDER, N_samples_to_add_, &extrapolateBuffer, &extrapolateBufferSize);
|
||||
#ifdef _DEBUG
|
||||
[BadSampleCleaner cleanSamples:(float *)(inputBuffer) + samples_in_buffer * floatFormat.mChannelsPerFrame
|
||||
amount:N_samples_to_add_ * floatFormat.mChannelsPerFrame
|
||||
|
@ -748,14 +754,12 @@ tryagain:
|
|||
size_t outputDone = 0;
|
||||
|
||||
if(!skipResampler) {
|
||||
ioNumberPackets += soxr_delay(soxr);
|
||||
|
||||
#ifdef _DEBUG
|
||||
[BadSampleCleaner cleanSamples:(float *)(((uint8_t *)inputBuffer) + inpOffset)
|
||||
amount:inputSamples * floatFormat.mChannelsPerFrame
|
||||
location:@"resampler input"];
|
||||
#endif
|
||||
soxr_process(soxr, (float *)(((uint8_t *)inputBuffer) + inpOffset), inputSamples, &inputDone, floatBuffer, ioNumberPackets, &outputDone);
|
||||
outputDone = ((r8bstate *)_r8bstate)->resample((float *)(((uint8_t *)inputBuffer) + inpOffset), inputSamples, &inputDone, (float *)floatBuffer, ioNumberPackets);
|
||||
#ifdef _DEBUG
|
||||
[BadSampleCleaner cleanSamples:(float *)floatBuffer
|
||||
amount:outputDone * floatFormat.mChannelsPerFrame
|
||||
|
@ -764,10 +768,10 @@ tryagain:
|
|||
|
||||
if(latencyEatenPost) {
|
||||
// Post file flush
|
||||
size_t idone = 0, odone = 0;
|
||||
size_t odone = 0;
|
||||
|
||||
do {
|
||||
soxr_process(soxr, NULL, 0, &idone, floatBuffer + outputDone * floatFormat.mBytesPerPacket, ioNumberPackets - outputDone, &odone);
|
||||
odone = ((r8bstate *)_r8bstate)->flush((float *)(((uint8_t *)floatBuffer) + outputDone * floatFormat.mBytesPerPacket), ioNumberPackets - outputDone);
|
||||
#ifdef _DEBUG
|
||||
[BadSampleCleaner cleanSamples:(float *)(floatBuffer + outputDone * floatFormat.mBytesPerPacket)
|
||||
amount:odone * floatFormat.mChannelsPerFrame
|
||||
|
@ -787,7 +791,7 @@ tryagain:
|
|||
if(latencyEaten) {
|
||||
if(outputDone > latencyEaten) {
|
||||
outputDone -= latencyEaten;
|
||||
memmove(floatBuffer, floatBuffer + latencyEaten * floatFormat.mBytesPerPacket, outputDone * floatFormat.mBytesPerPacket);
|
||||
memmove(floatBuffer, ((uint8_t *)floatBuffer) + latencyEaten * floatFormat.mBytesPerPacket, outputDone * floatFormat.mBytesPerPacket);
|
||||
latencyEaten = 0;
|
||||
} else {
|
||||
latencyEaten -= outputDone;
|
||||
|
@ -821,7 +825,7 @@ tryagain:
|
|||
|
||||
ioNumberPackets -= ioNumberPackets % outputFormat.mBytesPerPacket;
|
||||
|
||||
memcpy(dest + amountRead, floatBuffer + floatOffset, ioNumberPackets);
|
||||
memcpy(((uint8_t *)dest) + amountRead, ((uint8_t *)floatBuffer) + floatOffset, ioNumberPackets);
|
||||
|
||||
floatOffset += ioNumberPackets;
|
||||
amountRead += ioNumberPackets;
|
||||
|
@ -924,7 +928,7 @@ static float db_to_scale(float db) {
|
|||
// Decimate this for speed
|
||||
floatFormat.mSampleRate *= 1.0 / 8.0;
|
||||
dsd2pcmCount = floatFormat.mChannelsPerFrame;
|
||||
dsd2pcm = calloc(dsd2pcmCount, sizeof(void *));
|
||||
dsd2pcm = (void **)calloc(dsd2pcmCount, sizeof(void *));
|
||||
dsd2pcm[0] = dsd2pcm_alloc();
|
||||
dsd2pcmLatency = dsd2pcm_latency(dsd2pcm[0]);
|
||||
for(size_t i = 1; i < dsd2pcmCount; ++i) {
|
||||
|
@ -951,16 +955,9 @@ static float db_to_scale(float db) {
|
|||
sampleRatio = (double)outputFormat.mSampleRate / (double)floatFormat.mSampleRate;
|
||||
|
||||
if(!skipResampler) {
|
||||
soxr_quality_spec_t q_spec = soxr_quality_spec(SOXR_HQ, 0);
|
||||
soxr_io_spec_t io_spec = soxr_io_spec(SOXR_FLOAT32_I, SOXR_FLOAT32_I);
|
||||
soxr_runtime_spec_t runtime_spec = soxr_runtime_spec(0);
|
||||
const int channelCount = floatFormat.mChannelsPerFrame;
|
||||
|
||||
soxr_error_t error;
|
||||
|
||||
soxr = soxr_create(floatFormat.mSampleRate, outputFormat.mSampleRate, floatFormat.mChannelsPerFrame, &error, &io_spec, &q_spec, &runtime_spec);
|
||||
|
||||
if(error)
|
||||
return NO;
|
||||
_r8bstate = (void *)(new r8bstate(channelCount, 1024, floatFormat.mSampleRate, outputFormat.mSampleRate));
|
||||
|
||||
PRIME_LEN_ = max(floatFormat.mSampleRate / 20, 1024u);
|
||||
PRIME_LEN_ = min(PRIME_LEN_, 16384u);
|
||||
|
@ -1035,9 +1032,9 @@ static float db_to_scale(float db) {
|
|||
free(hdcd_decoder);
|
||||
hdcd_decoder = NULL;
|
||||
}
|
||||
if(soxr) {
|
||||
soxr_delete(soxr);
|
||||
soxr = NULL;
|
||||
if(_r8bstate) {
|
||||
delete(r8bstate *)_r8bstate;
|
||||
_r8bstate = NULL;
|
||||
}
|
||||
if(dsd2pcm && dsd2pcmCount) {
|
||||
for(size_t i = 0; i < dsd2pcmCount; ++i) {
|
|
@ -10,9 +10,10 @@
|
|||
#import "AudioDecoder.h"
|
||||
#import "AudioSource.h"
|
||||
|
||||
#import <soxr.h>
|
||||
#import <stdlib.h>
|
||||
|
||||
#import "r8bstate.h"
|
||||
|
||||
#import "lpc.h"
|
||||
#import "util.h"
|
||||
|
||||
|
@ -197,12 +198,8 @@ static const int8_t speakers_to_hesuvi_14[11][2] = {
|
|||
double sampleRatio = sampleRate / sampleRateOfSource;
|
||||
int resampledCount = (int)ceil((double)sampleCount * sampleRatio);
|
||||
|
||||
soxr_quality_spec_t q_spec = soxr_quality_spec(SOXR_HQ, 0);
|
||||
soxr_io_spec_t io_spec = soxr_io_spec(SOXR_FLOAT32_I, SOXR_FLOAT32_I);
|
||||
soxr_runtime_spec_t runtime_spec = soxr_runtime_spec(0);
|
||||
|
||||
soxr_error_t error;
|
||||
|
||||
r8bstate *_r8bstate = new r8bstate(impulseChannels, 1024, sampleRateOfSource, sampleRate);
|
||||
|
||||
unsigned long PRIME_LEN_ = MAX(sampleRateOfSource / 20, 1024u);
|
||||
PRIME_LEN_ = MIN(PRIME_LEN_, 16384u);
|
||||
PRIME_LEN_ = MAX(PRIME_LEN_, 2 * LPC_ORDER + 1);
|
||||
|
@ -244,13 +241,13 @@ static const int8_t speakers_to_hesuvi_14[11][2] = {
|
|||
size_t inputDone = 0;
|
||||
size_t outputDone = 0;
|
||||
|
||||
error = soxr_oneshot(sampleRateOfSource, sampleRate, impulseChannels, impulseBuffer, sampleCount + N_samples_to_add_ * 2, &inputDone, resampledImpulse, resampledCount, &outputDone, &io_spec, &q_spec, &runtime_spec);
|
||||
|
||||
if(error) {
|
||||
free(resampledImpulse);
|
||||
free(impulseBuffer);
|
||||
return nil;
|
||||
outputDone = _r8bstate->resample(impulseBuffer, sampleCount + N_samples_to_add_ * 2, &inputDone, resampledImpulse, resampledCount);
|
||||
|
||||
if (outputDone < resampledCount) {
|
||||
outputDone += _r8bstate->flush(resampledImpulse + outputDone * impulseChannels, resampledCount - outputDone);
|
||||
}
|
||||
|
||||
delete _r8bstate;
|
||||
|
||||
outputDone -= N_samples_to_drop_ * 2;
|
||||
|
|
@ -61,11 +61,10 @@
|
|||
835C88AD2797DA5800E28EAE /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = 835C88AC2797DA5800E28EAE /* util.h */; };
|
||||
835C88B1279811A500E28EAE /* hdcd_decode2.h in Headers */ = {isa = PBXBuildFile; fileRef = 835C88AF279811A500E28EAE /* hdcd_decode2.h */; };
|
||||
835C88B2279811A500E28EAE /* hdcd_decode2.c in Sources */ = {isa = PBXBuildFile; fileRef = 835C88B0279811A500E28EAE /* hdcd_decode2.c */; };
|
||||
835EDD7B279FE23A001EDCCE /* HeadphoneFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 835EDD7A279FE23A001EDCCE /* HeadphoneFilter.m */; };
|
||||
835EDD7B279FE23A001EDCCE /* HeadphoneFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 835EDD7A279FE23A001EDCCE /* HeadphoneFilter.mm */; };
|
||||
835EDD7D279FE307001EDCCE /* HeadphoneFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 835EDD7C279FE307001EDCCE /* HeadphoneFilter.h */; };
|
||||
835FAC5E27BCA14D00BA8562 /* BadSampleCleaner.h in Headers */ = {isa = PBXBuildFile; fileRef = 835FAC5C27BCA14D00BA8562 /* BadSampleCleaner.h */; };
|
||||
835FAC5F27BCA14D00BA8562 /* BadSampleCleaner.m in Sources */ = {isa = PBXBuildFile; fileRef = 835FAC5D27BCA14D00BA8562 /* BadSampleCleaner.m */; };
|
||||
83725A8B27AA0DBF0003F694 /* soxr.h in Headers */ = {isa = PBXBuildFile; fileRef = 83725A8827AA0DBF0003F694 /* soxr.h */; };
|
||||
83725A9027AA16C90003F694 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83725A7B27AA0D8A0003F694 /* Accelerate.framework */; };
|
||||
83725A9127AA16D50003F694 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83725A7C27AA0D8E0003F694 /* AVFoundation.framework */; };
|
||||
8377C64C27B8C51500E8BC0F /* fft_accelerate.c in Sources */ = {isa = PBXBuildFile; fileRef = 8377C64B27B8C51500E8BC0F /* fft_accelerate.c */; };
|
||||
|
@ -77,12 +76,39 @@
|
|||
839366681815923C006DD712 /* CogPluginMulti.m in Sources */ = {isa = PBXBuildFile; fileRef = 839366661815923C006DD712 /* CogPluginMulti.m */; };
|
||||
8399CF2C27B5D1D5008751F1 /* NSDictionary+Merge.h in Headers */ = {isa = PBXBuildFile; fileRef = 8399CF2A27B5D1D4008751F1 /* NSDictionary+Merge.h */; };
|
||||
8399CF2D27B5D1D5008751F1 /* NSDictionary+Merge.m in Sources */ = {isa = PBXBuildFile; fileRef = 8399CF2B27B5D1D4008751F1 /* NSDictionary+Merge.m */; };
|
||||
83FA145327CA1FEB00483F3C /* libsoxr.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 83FA145227CA1FEB00483F3C /* libsoxr.a */; };
|
||||
83F18B1E27D1E8EF00385946 /* CDSPHBDownsampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18ADF27D1E8EF00385946 /* CDSPHBDownsampler.h */; };
|
||||
83F18B1F27D1E8EF00385946 /* pffft_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AE127D1E8EF00385946 /* pffft_double.h */; };
|
||||
83F18B2027D1E8EF00385946 /* pf_neon_double_from_avx.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AE327D1E8EF00385946 /* pf_neon_double_from_avx.h */; };
|
||||
83F18B2127D1E8EF00385946 /* pf_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AE427D1E8EF00385946 /* pf_double.h */; };
|
||||
83F18B2227D1E8EF00385946 /* pf_neon_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AE527D1E8EF00385946 /* pf_neon_double.h */; };
|
||||
83F18B2327D1E8EF00385946 /* pf_sse2_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AE627D1E8EF00385946 /* pf_sse2_double.h */; };
|
||||
83F18B2427D1E8EF00385946 /* pf_avx_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AE727D1E8EF00385946 /* pf_avx_double.h */; };
|
||||
83F18B2527D1E8EF00385946 /* pf_scalar_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AE827D1E8EF00385946 /* pf_scalar_double.h */; };
|
||||
83F18B2627D1E8EF00385946 /* pffft_priv_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AE927D1E8EF00385946 /* pffft_priv_impl.h */; };
|
||||
83F18B2727D1E8EF00385946 /* pffft_double.c in Sources */ = {isa = PBXBuildFile; fileRef = 83F18AEA27D1E8EF00385946 /* pffft_double.c */; };
|
||||
83F18B3327D1E8EF00385946 /* CDSPSincFilterGen.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AF827D1E8EF00385946 /* CDSPSincFilterGen.h */; };
|
||||
83F18B3427D1E8EF00385946 /* r8butil.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AF927D1E8EF00385946 /* r8butil.h */; };
|
||||
83F18B3627D1E8EF00385946 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 83F18AFB27D1E8EF00385946 /* LICENSE */; };
|
||||
83F18B3727D1E8EF00385946 /* r8bbase.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AFC27D1E8EF00385946 /* r8bbase.h */; };
|
||||
83F18B3827D1E8EF00385946 /* CDSPFIRFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18AFD27D1E8EF00385946 /* CDSPFIRFilter.h */; };
|
||||
83F18B4227D1E8EF00385946 /* CDSPProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18B0827D1E8EF00385946 /* CDSPProcessor.h */; };
|
||||
83F18B4327D1E8EF00385946 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 83F18B0927D1E8EF00385946 /* README.md */; };
|
||||
83F18B4427D1E8EF00385946 /* fft4g.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18B0A27D1E8EF00385946 /* fft4g.h */; };
|
||||
83F18B4527D1E8EF00385946 /* CDSPRealFFT.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18B0B27D1E8EF00385946 /* CDSPRealFFT.h */; };
|
||||
83F18B4627D1E8EF00385946 /* CDSPFracInterpolator.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18B0C27D1E8EF00385946 /* CDSPFracInterpolator.h */; };
|
||||
83F18B4E27D1E8F000385946 /* CDSPBlockConvolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18B1727D1E8EF00385946 /* CDSPBlockConvolver.h */; };
|
||||
83F18B4F27D1E8F000385946 /* CDSPHBUpsampler.inc in Sources */ = {isa = PBXBuildFile; fileRef = 83F18B1827D1E8EF00385946 /* CDSPHBUpsampler.inc */; };
|
||||
83F18B5027D1E8F000385946 /* r8bconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18B1927D1E8EF00385946 /* r8bconf.h */; };
|
||||
83F18B5127D1E8F000385946 /* r8bbase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83F18B1A27D1E8EF00385946 /* r8bbase.cpp */; };
|
||||
83F18B5227D1E8F000385946 /* pffft.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18B1B27D1E8EF00385946 /* pffft.h */; };
|
||||
83F18B5327D1E8F000385946 /* CDSPResampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18B1C27D1E8EF00385946 /* CDSPResampler.h */; };
|
||||
83F18B5427D1E8F000385946 /* CDSPHBUpsampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18B1D27D1E8EF00385946 /* CDSPHBUpsampler.h */; };
|
||||
83F18B5627D1F5E900385946 /* r8bstate.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F18B5527D1F5E900385946 /* r8bstate.h */; };
|
||||
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
|
||||
8E8D3D2F0CBAEE6E00135C1B /* AudioContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E8D3D2D0CBAEE6E00135C1B /* AudioContainer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
8E8D3D300CBAEE6E00135C1B /* AudioContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E8D3D2E0CBAEE6E00135C1B /* AudioContainer.m */; };
|
||||
8EC1225F0B993BD500C5B3AD /* ConverterNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EC1225D0B993BD500C5B3AD /* ConverterNode.h */; };
|
||||
8EC122600B993BD500C5B3AD /* ConverterNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EC1225E0B993BD500C5B3AD /* ConverterNode.m */; };
|
||||
8EC122600B993BD500C5B3AD /* ConverterNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8EC1225E0B993BD500C5B3AD /* ConverterNode.mm */; };
|
||||
B0575F2D0D687A0800411D77 /* Helper.h in Headers */ = {isa = PBXBuildFile; fileRef = B0575F2C0D687A0800411D77 /* Helper.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
B0575F300D687A4000411D77 /* Helper.m in Sources */ = {isa = PBXBuildFile; fileRef = B0575F2F0D687A4000411D77 /* Helper.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
@ -167,13 +193,12 @@
|
|||
835C88AC2797DA5800E28EAE /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = util.h; path = ThirdParty/lvqcl/util.h; sourceTree = SOURCE_ROOT; };
|
||||
835C88AF279811A500E28EAE /* hdcd_decode2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hdcd_decode2.h; sourceTree = "<group>"; };
|
||||
835C88B0279811A500E28EAE /* hdcd_decode2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hdcd_decode2.c; sourceTree = "<group>"; };
|
||||
835EDD7A279FE23A001EDCCE /* HeadphoneFilter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HeadphoneFilter.m; sourceTree = "<group>"; };
|
||||
835EDD7A279FE23A001EDCCE /* HeadphoneFilter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = HeadphoneFilter.mm; sourceTree = "<group>"; };
|
||||
835EDD7C279FE307001EDCCE /* HeadphoneFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HeadphoneFilter.h; sourceTree = "<group>"; };
|
||||
835FAC5C27BCA14D00BA8562 /* BadSampleCleaner.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = BadSampleCleaner.h; path = Utils/BadSampleCleaner.h; sourceTree = SOURCE_ROOT; };
|
||||
835FAC5D27BCA14D00BA8562 /* BadSampleCleaner.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = BadSampleCleaner.m; path = Utils/BadSampleCleaner.m; sourceTree = SOURCE_ROOT; };
|
||||
83725A7B27AA0D8A0003F694 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
|
||||
83725A7C27AA0D8E0003F694 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
|
||||
83725A8827AA0DBF0003F694 /* soxr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = soxr.h; sourceTree = "<group>"; };
|
||||
8377C64B27B8C51500E8BC0F /* fft_accelerate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fft_accelerate.c; sourceTree = "<group>"; };
|
||||
8377C64D27B8C54400E8BC0F /* fft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fft.h; sourceTree = "<group>"; };
|
||||
8377C65027B8CAD100E8BC0F /* VisualizationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VisualizationController.h; sourceTree = "<group>"; };
|
||||
|
@ -183,13 +208,40 @@
|
|||
839366661815923C006DD712 /* CogPluginMulti.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CogPluginMulti.m; sourceTree = "<group>"; };
|
||||
8399CF2A27B5D1D4008751F1 /* NSDictionary+Merge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+Merge.h"; path = "../../Utils/NSDictionary+Merge.h"; sourceTree = "<group>"; };
|
||||
8399CF2B27B5D1D4008751F1 /* NSDictionary+Merge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+Merge.m"; path = "../../Utils/NSDictionary+Merge.m"; sourceTree = "<group>"; };
|
||||
83FA145227CA1FEB00483F3C /* libsoxr.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libsoxr.a; sourceTree = "<group>"; };
|
||||
83F18ADF27D1E8EF00385946 /* CDSPHBDownsampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPHBDownsampler.h; sourceTree = "<group>"; };
|
||||
83F18AE127D1E8EF00385946 /* pffft_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pffft_double.h; sourceTree = "<group>"; };
|
||||
83F18AE327D1E8EF00385946 /* pf_neon_double_from_avx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_neon_double_from_avx.h; sourceTree = "<group>"; };
|
||||
83F18AE427D1E8EF00385946 /* pf_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_double.h; sourceTree = "<group>"; };
|
||||
83F18AE527D1E8EF00385946 /* pf_neon_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_neon_double.h; sourceTree = "<group>"; };
|
||||
83F18AE627D1E8EF00385946 /* pf_sse2_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_sse2_double.h; sourceTree = "<group>"; };
|
||||
83F18AE727D1E8EF00385946 /* pf_avx_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_avx_double.h; sourceTree = "<group>"; };
|
||||
83F18AE827D1E8EF00385946 /* pf_scalar_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_scalar_double.h; sourceTree = "<group>"; };
|
||||
83F18AE927D1E8EF00385946 /* pffft_priv_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pffft_priv_impl.h; sourceTree = "<group>"; };
|
||||
83F18AEA27D1E8EF00385946 /* pffft_double.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pffft_double.c; sourceTree = "<group>"; };
|
||||
83F18AF827D1E8EF00385946 /* CDSPSincFilterGen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPSincFilterGen.h; sourceTree = "<group>"; };
|
||||
83F18AF927D1E8EF00385946 /* r8butil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = r8butil.h; sourceTree = "<group>"; };
|
||||
83F18AFB27D1E8EF00385946 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
|
||||
83F18AFC27D1E8EF00385946 /* r8bbase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = r8bbase.h; sourceTree = "<group>"; };
|
||||
83F18AFD27D1E8EF00385946 /* CDSPFIRFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPFIRFilter.h; sourceTree = "<group>"; };
|
||||
83F18B0827D1E8EF00385946 /* CDSPProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPProcessor.h; sourceTree = "<group>"; };
|
||||
83F18B0927D1E8EF00385946 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
||||
83F18B0A27D1E8EF00385946 /* fft4g.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fft4g.h; sourceTree = "<group>"; };
|
||||
83F18B0B27D1E8EF00385946 /* CDSPRealFFT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPRealFFT.h; sourceTree = "<group>"; };
|
||||
83F18B0C27D1E8EF00385946 /* CDSPFracInterpolator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPFracInterpolator.h; sourceTree = "<group>"; };
|
||||
83F18B1727D1E8EF00385946 /* CDSPBlockConvolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPBlockConvolver.h; sourceTree = "<group>"; };
|
||||
83F18B1827D1E8EF00385946 /* CDSPHBUpsampler.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = CDSPHBUpsampler.inc; sourceTree = "<group>"; };
|
||||
83F18B1927D1E8EF00385946 /* r8bconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = r8bconf.h; sourceTree = "<group>"; };
|
||||
83F18B1A27D1E8EF00385946 /* r8bbase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = r8bbase.cpp; sourceTree = "<group>"; };
|
||||
83F18B1B27D1E8EF00385946 /* pffft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pffft.h; sourceTree = "<group>"; };
|
||||
83F18B1C27D1E8EF00385946 /* CDSPResampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPResampler.h; sourceTree = "<group>"; };
|
||||
83F18B1D27D1E8EF00385946 /* CDSPHBUpsampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPHBUpsampler.h; sourceTree = "<group>"; };
|
||||
83F18B5527D1F5E900385946 /* r8bstate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = r8bstate.h; path = ThirdParty/r8bstate.h; sourceTree = SOURCE_ROOT; };
|
||||
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
8DC2EF5B0486A6940098B216 /* CogAudio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CogAudio.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8E8D3D2D0CBAEE6E00135C1B /* AudioContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioContainer.h; sourceTree = "<group>"; };
|
||||
8E8D3D2E0CBAEE6E00135C1B /* AudioContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioContainer.m; sourceTree = "<group>"; };
|
||||
8EC1225D0B993BD500C5B3AD /* ConverterNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ConverterNode.h; sourceTree = "<group>"; };
|
||||
8EC1225E0B993BD500C5B3AD /* ConverterNode.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ConverterNode.m; sourceTree = "<group>"; };
|
||||
8EC1225E0B993BD500C5B3AD /* ConverterNode.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ConverterNode.mm; sourceTree = "<group>"; };
|
||||
B0575F2C0D687A0800411D77 /* Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Helper.h; sourceTree = "<group>"; };
|
||||
B0575F2F0D687A4000411D77 /* Helper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Helper.m; sourceTree = "<group>"; };
|
||||
D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
||||
|
@ -204,7 +256,6 @@
|
|||
83725A9127AA16D50003F694 /* AVFoundation.framework in Frameworks */,
|
||||
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */,
|
||||
83725A9027AA16C90003F694 /* Accelerate.framework in Frameworks */,
|
||||
83FA145327CA1FEB00483F3C /* libsoxr.a in Frameworks */,
|
||||
17D21DAD0B8BE76800D1EBDE /* AudioToolbox.framework in Frameworks */,
|
||||
17D21DAE0B8BE76800D1EBDE /* AudioUnit.framework in Frameworks */,
|
||||
17D21DAF0B8BE76800D1EBDE /* CoreAudio.framework in Frameworks */,
|
||||
|
@ -323,7 +374,7 @@
|
|||
17D21C760B8BE4BA00D1EBDE /* BufferChain.h */,
|
||||
17D21C770B8BE4BA00D1EBDE /* BufferChain.m */,
|
||||
8EC1225D0B993BD500C5B3AD /* ConverterNode.h */,
|
||||
8EC1225E0B993BD500C5B3AD /* ConverterNode.m */,
|
||||
8EC1225E0B993BD500C5B3AD /* ConverterNode.mm */,
|
||||
17D21C7A0B8BE4BA00D1EBDE /* InputNode.h */,
|
||||
17D21C7B0B8BE4BA00D1EBDE /* InputNode.m */,
|
||||
17D21C7C0B8BE4BA00D1EBDE /* Node.h */,
|
||||
|
@ -331,7 +382,7 @@
|
|||
17D21C7E0B8BE4BA00D1EBDE /* OutputNode.h */,
|
||||
17D21C7F0B8BE4BA00D1EBDE /* OutputNode.m */,
|
||||
835EDD7C279FE307001EDCCE /* HeadphoneFilter.h */,
|
||||
835EDD7A279FE23A001EDCCE /* HeadphoneFilter.m */,
|
||||
835EDD7A279FE23A001EDCCE /* HeadphoneFilter.mm */,
|
||||
);
|
||||
path = Chain;
|
||||
sourceTree = "<group>";
|
||||
|
@ -348,8 +399,8 @@
|
|||
17D21CD80B8BE5B400D1EBDE /* ThirdParty */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
83F18ADE27D1E8EF00385946 /* r8brain-free-src */,
|
||||
8377C64A27B8C51500E8BC0F /* deadbeef */,
|
||||
83725A8627AA0DBF0003F694 /* libsoxr */,
|
||||
835C88AE279811A500E28EAE /* hdcd */,
|
||||
835C88A22797D4D400E28EAE /* lvqcl */,
|
||||
17D21DC40B8BE79700D1EBDE /* CoreAudioUtils */,
|
||||
|
@ -423,31 +474,6 @@
|
|||
path = hdcd;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
83725A8627AA0DBF0003F694 /* libsoxr */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
83725A8727AA0DBF0003F694 /* include */,
|
||||
83725A8927AA0DBF0003F694 /* lib */,
|
||||
);
|
||||
path = libsoxr;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
83725A8727AA0DBF0003F694 /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
83725A8827AA0DBF0003F694 /* soxr.h */,
|
||||
);
|
||||
path = include;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
83725A8927AA0DBF0003F694 /* lib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
83FA145227CA1FEB00483F3C /* libsoxr.a */,
|
||||
);
|
||||
path = lib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
83725A8F27AA16C90003F694 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -474,6 +500,57 @@
|
|||
path = Visualization;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
83F18ADE27D1E8EF00385946 /* r8brain-free-src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
83F18ADF27D1E8EF00385946 /* CDSPHBDownsampler.h */,
|
||||
83F18AE027D1E8EF00385946 /* pffft_double */,
|
||||
83F18AF827D1E8EF00385946 /* CDSPSincFilterGen.h */,
|
||||
83F18AF927D1E8EF00385946 /* r8butil.h */,
|
||||
83F18AFB27D1E8EF00385946 /* LICENSE */,
|
||||
83F18AFC27D1E8EF00385946 /* r8bbase.h */,
|
||||
83F18AFD27D1E8EF00385946 /* CDSPFIRFilter.h */,
|
||||
83F18B0827D1E8EF00385946 /* CDSPProcessor.h */,
|
||||
83F18B0927D1E8EF00385946 /* README.md */,
|
||||
83F18B0A27D1E8EF00385946 /* fft4g.h */,
|
||||
83F18B0B27D1E8EF00385946 /* CDSPRealFFT.h */,
|
||||
83F18B0C27D1E8EF00385946 /* CDSPFracInterpolator.h */,
|
||||
83F18B1727D1E8EF00385946 /* CDSPBlockConvolver.h */,
|
||||
83F18B1827D1E8EF00385946 /* CDSPHBUpsampler.inc */,
|
||||
83F18B1927D1E8EF00385946 /* r8bconf.h */,
|
||||
83F18B1A27D1E8EF00385946 /* r8bbase.cpp */,
|
||||
83F18B1B27D1E8EF00385946 /* pffft.h */,
|
||||
83F18B1C27D1E8EF00385946 /* CDSPResampler.h */,
|
||||
83F18B1D27D1E8EF00385946 /* CDSPHBUpsampler.h */,
|
||||
83F18B5527D1F5E900385946 /* r8bstate.h */,
|
||||
);
|
||||
path = "r8brain-free-src";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
83F18AE027D1E8EF00385946 /* pffft_double */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
83F18AE127D1E8EF00385946 /* pffft_double.h */,
|
||||
83F18AE227D1E8EF00385946 /* simd */,
|
||||
83F18AE927D1E8EF00385946 /* pffft_priv_impl.h */,
|
||||
83F18AEA27D1E8EF00385946 /* pffft_double.c */,
|
||||
);
|
||||
path = pffft_double;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
83F18AE227D1E8EF00385946 /* simd */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
83F18AE327D1E8EF00385946 /* pf_neon_double_from_avx.h */,
|
||||
83F18AE427D1E8EF00385946 /* pf_double.h */,
|
||||
83F18AE527D1E8EF00385946 /* pf_neon_double.h */,
|
||||
83F18AE627D1E8EF00385946 /* pf_sse2_double.h */,
|
||||
83F18AE727D1E8EF00385946 /* pf_avx_double.h */,
|
||||
83F18AE827D1E8EF00385946 /* pf_scalar_double.h */,
|
||||
);
|
||||
path = simd;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
|
@ -484,36 +561,58 @@
|
|||
17D21CA10B8BE4BA00D1EBDE /* BufferChain.h in Headers */,
|
||||
17D21CA50B8BE4BA00D1EBDE /* InputNode.h in Headers */,
|
||||
17D21CA70B8BE4BA00D1EBDE /* Node.h in Headers */,
|
||||
83F18B3427D1E8EF00385946 /* r8butil.h in Headers */,
|
||||
8399CF2C27B5D1D5008751F1 /* NSDictionary+Merge.h in Headers */,
|
||||
17D21CA90B8BE4BA00D1EBDE /* OutputNode.h in Headers */,
|
||||
83F18B4527D1E8EF00385946 /* CDSPRealFFT.h in Headers */,
|
||||
83F18B3827D1E8EF00385946 /* CDSPFIRFilter.h in Headers */,
|
||||
8328995427CB511000D7F028 /* RedundantPlaylistDataStore.h in Headers */,
|
||||
17D21CC50B8BE4BA00D1EBDE /* OutputCoreAudio.h in Headers */,
|
||||
83F18B2427D1E8EF00385946 /* pf_avx_double.h in Headers */,
|
||||
834FD4F427AFA2150063BC83 /* Downmix.h in Headers */,
|
||||
17D21CC70B8BE4BA00D1EBDE /* Status.h in Headers */,
|
||||
83F18B1F27D1E8EF00385946 /* pffft_double.h in Headers */,
|
||||
835C88AB2797D4D400E28EAE /* lpc.h in Headers */,
|
||||
17D21CF30B8BE5EF00D1EBDE /* Semaphore.h in Headers */,
|
||||
17D21DC70B8BE79700D1EBDE /* CoreAudioUtils.h in Headers */,
|
||||
83F18B3327D1E8EF00385946 /* CDSPSincFilterGen.h in Headers */,
|
||||
17D21EBD0B8BF44000D1EBDE /* AudioPlayer.h in Headers */,
|
||||
83F18B4427D1E8EF00385946 /* fft4g.h in Headers */,
|
||||
83F18B1E27D1E8EF00385946 /* CDSPHBDownsampler.h in Headers */,
|
||||
83F18B5627D1F5E900385946 /* r8bstate.h in Headers */,
|
||||
8377C65227B8CAD100E8BC0F /* VisualizationController.h in Headers */,
|
||||
834FD4F027AF93680063BC83 /* ChunkList.h in Headers */,
|
||||
83F18B2127D1E8EF00385946 /* pf_double.h in Headers */,
|
||||
17F94DD50B8D0F7000A34E87 /* PluginController.h in Headers */,
|
||||
17F94DDD0B8D101100A34E87 /* Plugin.h in Headers */,
|
||||
83F18B2027D1E8EF00385946 /* pf_neon_double_from_avx.h in Headers */,
|
||||
83F18B5227D1E8F000385946 /* pffft.h in Headers */,
|
||||
83F18B2627D1E8EF00385946 /* pffft_priv_impl.h in Headers */,
|
||||
8328995727CB51B700D7F028 /* SHA256Digest.h in Headers */,
|
||||
83F18B4627D1E8EF00385946 /* CDSPFracInterpolator.h in Headers */,
|
||||
834FD4EB27AF8F380063BC83 /* AudioChunk.h in Headers */,
|
||||
83F18B4E27D1E8F000385946 /* CDSPBlockConvolver.h in Headers */,
|
||||
83F18B4227D1E8EF00385946 /* CDSPProcessor.h in Headers */,
|
||||
17A2D3C50B8D1D37000778C4 /* AudioDecoder.h in Headers */,
|
||||
8347C7412796C58800FA8A7D /* NSFileHandle+CreateFile.h in Headers */,
|
||||
17C940230B900909008627D6 /* AudioMetadataReader.h in Headers */,
|
||||
83725A8B27AA0DBF0003F694 /* soxr.h in Headers */,
|
||||
17B619300B909BC300BC003F /* AudioPropertiesReader.h in Headers */,
|
||||
83F18B5427D1E8F000385946 /* CDSPHBUpsampler.h in Headers */,
|
||||
835EDD7D279FE307001EDCCE /* HeadphoneFilter.h in Headers */,
|
||||
839366671815923C006DD712 /* CogPluginMulti.h in Headers */,
|
||||
83F18B2227D1E8EF00385946 /* pf_neon_double.h in Headers */,
|
||||
83F18B2527D1E8EF00385946 /* pf_scalar_double.h in Headers */,
|
||||
83F18B5327D1E8F000385946 /* CDSPResampler.h in Headers */,
|
||||
17ADB13C0B97926D00257CA2 /* AudioSource.h in Headers */,
|
||||
835C88B1279811A500E28EAE /* hdcd_decode2.h in Headers */,
|
||||
8EC1225F0B993BD500C5B3AD /* ConverterNode.h in Headers */,
|
||||
8384912718080FF100E7332D /* Logging.h in Headers */,
|
||||
8377C64E27B8C54400E8BC0F /* fft.h in Headers */,
|
||||
83F18B5027D1E8F000385946 /* r8bconf.h in Headers */,
|
||||
835FAC5E27BCA14D00BA8562 /* BadSampleCleaner.h in Headers */,
|
||||
83F18B2327D1E8EF00385946 /* pf_sse2_double.h in Headers */,
|
||||
8E8D3D2F0CBAEE6E00135C1B /* AudioContainer.h in Headers */,
|
||||
83F18B3727D1E8EF00385946 /* r8bbase.h in Headers */,
|
||||
B0575F2D0D687A0800411D77 /* Helper.h in Headers */,
|
||||
835C88AD2797DA5800E28EAE /* util.h in Headers */,
|
||||
07DB5F3E0ED353A900C2E3EF /* AudioMetadataWriter.h in Headers */,
|
||||
|
@ -581,8 +680,10 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
83F18B3627D1E8EF00385946 /* LICENSE in Resources */,
|
||||
835C88A92797D4D400E28EAE /* License.txt in Resources */,
|
||||
835C88A82797D4D400E28EAE /* LICENSE.LGPL in Resources */,
|
||||
83F18B4327D1E8EF00385946 /* README.md in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -593,7 +694,7 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
835EDD7B279FE23A001EDCCE /* HeadphoneFilter.m in Sources */,
|
||||
835EDD7B279FE23A001EDCCE /* HeadphoneFilter.mm in Sources */,
|
||||
17D21CA20B8BE4BA00D1EBDE /* BufferChain.m in Sources */,
|
||||
17D21CA60B8BE4BA00D1EBDE /* InputNode.m in Sources */,
|
||||
8399CF2D27B5D1D5008751F1 /* NSDictionary+Merge.m in Sources */,
|
||||
|
@ -605,9 +706,11 @@
|
|||
835C88B2279811A500E28EAE /* hdcd_decode2.c in Sources */,
|
||||
835FAC5F27BCA14D00BA8562 /* BadSampleCleaner.m in Sources */,
|
||||
834FD4ED27AF91220063BC83 /* AudioChunk.m in Sources */,
|
||||
83F18B5127D1E8F000385946 /* r8bbase.cpp in Sources */,
|
||||
17D21CF40B8BE5EF00D1EBDE /* Semaphore.m in Sources */,
|
||||
8347C7422796C58800FA8A7D /* NSFileHandle+CreateFile.m in Sources */,
|
||||
17D21DC80B8BE79700D1EBDE /* CoreAudioUtils.m in Sources */,
|
||||
83F18B2727D1E8EF00385946 /* pffft_double.c in Sources */,
|
||||
8328995327CB511000D7F028 /* RedundantPlaylistDataStore.m in Sources */,
|
||||
8377C64C27B8C51500E8BC0F /* fft_accelerate.c in Sources */,
|
||||
839366681815923C006DD712 /* CogPluginMulti.m in Sources */,
|
||||
|
@ -620,7 +723,8 @@
|
|||
17B619310B909BC300BC003F /* AudioPropertiesReader.m in Sources */,
|
||||
17ADB13D0B97926D00257CA2 /* AudioSource.m in Sources */,
|
||||
834FD4F127AF93680063BC83 /* ChunkList.m in Sources */,
|
||||
8EC122600B993BD500C5B3AD /* ConverterNode.m in Sources */,
|
||||
83F18B4F27D1E8F000385946 /* CDSPHBUpsampler.inc in Sources */,
|
||||
8EC122600B993BD500C5B3AD /* ConverterNode.mm in Sources */,
|
||||
8E8D3D300CBAEE6E00135C1B /* AudioContainer.m in Sources */,
|
||||
B0575F300D687A4000411D77 /* Helper.m in Sources */,
|
||||
07DB5F3F0ED353A900C2E3EF /* AudioMetadataWriter.m in Sources */,
|
||||
|
@ -648,6 +752,11 @@
|
|||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = CogAudio_Prefix.pch;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"R8B_EXTFFT=1",
|
||||
"R8B_PFFFT_DOUBLE=1",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = ThirdParty/libsoxr/include;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "@executable_path/../Frameworks";
|
||||
|
@ -655,6 +764,8 @@
|
|||
LIBRARY_SEARCH_PATHS = (
|
||||
ThirdParty/libsoxr/lib,
|
||||
"$(PROJECT_DIR)/ThirdParty/libsoxr/lib",
|
||||
"$(PROJECT_DIR)/ThirdParty/r8brain-free-src/DLL/Win64",
|
||||
"$(PROJECT_DIR)/ThirdParty/r8brain-free-src/DLL/Win32",
|
||||
);
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cogx.cogaudio;
|
||||
|
@ -683,6 +794,10 @@
|
|||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = CogAudio_Prefix.pch;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"R8B_EXTFFT=1",
|
||||
"R8B_PFFFT_DOUBLE=1",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = ThirdParty/libsoxr/include;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "@executable_path/../Frameworks";
|
||||
|
@ -690,6 +805,8 @@
|
|||
LIBRARY_SEARCH_PATHS = (
|
||||
ThirdParty/libsoxr/lib,
|
||||
"$(PROJECT_DIR)/ThirdParty/libsoxr/lib",
|
||||
"$(PROJECT_DIR)/ThirdParty/r8brain-free-src/DLL/Win64",
|
||||
"$(PROJECT_DIR)/ThirdParty/r8brain-free-src/DLL/Win32",
|
||||
);
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cogx.cogaudio;
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
These were compiled with default settings from:
|
||||
|
||||
https://github.com/kode54/libsoxr
|
||||
|
||||
Original upstream it was forked from:
|
||||
|
||||
https://github.com/nanake/libsoxr
|
||||
|
||||
Using CMake:
|
||||
|
||||
```
|
||||
mkdir build-x86
|
||||
mkdir build-arm
|
||||
cd build-x86
|
||||
cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.12" -DBUILD_SHARED_LIBS=OFF -DWITH_OPENMP=OFF
|
||||
make -j8
|
||||
cd ../build-arm
|
||||
cmake .. -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" -DBUILD_SHARED_LIBS=OFF -DWITH_OPENMP=OFF
|
||||
make -j8
|
||||
cd ..
|
||||
lipo -create -output libsoxr.a build-x86/src/libsoxr.a build-arm/src/libsoxr.a
|
||||
```
|
|
@ -1,344 +0,0 @@
|
|||
/* SoX Resampler Library Copyright (c) 2007-18 robs@users.sourceforge.net
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* -------------------------------- Gubbins --------------------------------- */
|
||||
|
||||
#if !defined soxr_included
|
||||
#define soxr_included
|
||||
|
||||
|
||||
#if defined __cplusplus
|
||||
#include <cstddef>
|
||||
extern "C" {
|
||||
#else
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
#if defined SOXR_DLL
|
||||
#if defined soxr_EXPORTS
|
||||
#define SOXR __declspec(dllexport)
|
||||
#else
|
||||
#define SOXR __declspec(dllimport)
|
||||
#endif
|
||||
#elif defined SOXR_VISIBILITY && defined __GNUC__ && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 1)
|
||||
#define SOXR __attribute__ ((visibility("default")))
|
||||
#else
|
||||
#define SOXR
|
||||
#endif
|
||||
|
||||
typedef struct soxr_io_spec soxr_io_spec_t;
|
||||
typedef struct soxr_quality_spec soxr_quality_spec_t;
|
||||
typedef struct soxr_runtime_spec soxr_runtime_spec_t;
|
||||
|
||||
|
||||
|
||||
/* ---------------------------- API conventions --------------------------------
|
||||
|
||||
Buffer lengths (and occupancies) are expressed as the number of contained
|
||||
samples per channel.
|
||||
|
||||
Parameter names for buffer lengths have the suffix `len'.
|
||||
|
||||
A single-character `i' or 'o' is often used in names to give context as
|
||||
input or output (e.g. ilen, olen). */
|
||||
|
||||
|
||||
|
||||
/* --------------------------- Version management --------------------------- */
|
||||
|
||||
/* E.g. #if SOXR_THIS_VERSION >= SOXR_VERSION(0,1,1) ... */
|
||||
|
||||
#define SOXR_VERSION(x,y,z) (((x)<<16)|((y)<<8)|(z))
|
||||
#define SOXR_THIS_VERSION SOXR_VERSION(0,1,3)
|
||||
#define SOXR_THIS_VERSION_STR "0.1.3"
|
||||
|
||||
|
||||
|
||||
/* --------------------------- Type declarations ---------------------------- */
|
||||
|
||||
typedef struct soxr * soxr_t; /* A resampler for 1 or more channels. */
|
||||
typedef char const * soxr_error_t; /* 0:no-error; non-0:error. */
|
||||
|
||||
typedef void * soxr_buf_t; /* 1 buffer of channel-interleaved samples. */
|
||||
typedef void const * soxr_cbuf_t; /* Ditto; read-only. */
|
||||
|
||||
typedef soxr_buf_t const * soxr_bufs_t;/* Or, a separate buffer for each ch. */
|
||||
typedef soxr_cbuf_t const * soxr_cbufs_t; /* Ditto; read-only. */
|
||||
|
||||
typedef void const * soxr_in_t; /* Either a soxr_cbuf_t or soxr_cbufs_t,
|
||||
depending on itype in soxr_io_spec_t. */
|
||||
typedef void * soxr_out_t; /* Either a soxr_buf_t or soxr_bufs_t,
|
||||
depending on otype in soxr_io_spec_t. */
|
||||
|
||||
|
||||
|
||||
/* --------------------------- API main functions --------------------------- */
|
||||
|
||||
SOXR char const * soxr_version(void); /* Query library version: "libsoxr-x.y.z" */
|
||||
|
||||
#define soxr_strerror(e) /* Soxr counterpart to strerror. */ \
|
||||
((e)?(e):"no error")
|
||||
|
||||
|
||||
/* Create a stream resampler: */
|
||||
|
||||
SOXR soxr_t soxr_create(
|
||||
double input_rate, /* Input sample-rate. */
|
||||
double output_rate, /* Output sample-rate. */
|
||||
unsigned num_channels, /* Number of channels to be used. */
|
||||
/* All following arguments are optional (may be set to NULL). */
|
||||
soxr_error_t *, /* To report any error during creation. */
|
||||
soxr_io_spec_t const *, /* To specify non-default I/O formats. */
|
||||
soxr_quality_spec_t const *, /* To specify non-default resampling quality.*/
|
||||
soxr_runtime_spec_t const *);/* To specify non-default runtime resources.
|
||||
|
||||
Default io_spec is per soxr_io_spec(SOXR_FLOAT32_I, SOXR_FLOAT32_I)
|
||||
Default quality_spec is per soxr_quality_spec(SOXR_HQ, 0)
|
||||
Default runtime_spec is per soxr_runtime_spec(1) */
|
||||
|
||||
|
||||
|
||||
/* If not using an app-supplied input function, after creating a stream
|
||||
* resampler, repeatedly call: */
|
||||
|
||||
SOXR soxr_error_t soxr_process(
|
||||
soxr_t resampler, /* As returned by soxr_create. */
|
||||
/* Input (to be resampled): */
|
||||
soxr_in_t in, /* Input buffer(s); may be NULL (see below). */
|
||||
size_t ilen, /* Input buf. length (samples per channel). */
|
||||
size_t * idone, /* To return actual # samples used (<= ilen). */
|
||||
/* Output (resampled): */
|
||||
soxr_out_t out, /* Output buffer(s).*/
|
||||
size_t olen, /* Output buf. length (samples per channel). */
|
||||
size_t * odone); /* To return actual # samples out (<= olen).
|
||||
|
||||
Note that no special meaning is associated with ilen or olen equal to
|
||||
zero. End-of-input (i.e. no data is available nor shall be available)
|
||||
may be indicated by seting `in' to NULL. */
|
||||
|
||||
|
||||
|
||||
/* If using an app-supplied input function, it must look and behave like this:*/
|
||||
|
||||
typedef size_t /* data_len */
|
||||
(* soxr_input_fn_t)( /* Supply data to be resampled. */
|
||||
void * input_fn_state, /* As given to soxr_set_input_fn (below). */
|
||||
soxr_in_t * data, /* Returned data; see below. N.B. ptr to ptr(s)*/
|
||||
size_t requested_len); /* Samples per channel, >= returned data_len.
|
||||
|
||||
data_len *data Indicates Meaning
|
||||
------- ------- ------------ -------------------------
|
||||
!=0 !=0 Success *data contains data to be
|
||||
input to the resampler.
|
||||
0 !=0 (or End-of-input No data is available nor
|
||||
not set) shall be available.
|
||||
0 0 Failure An error occurred whilst trying to
|
||||
source data to be input to the resampler. */
|
||||
|
||||
/* and be registered with a previously created stream resampler using: */
|
||||
|
||||
SOXR soxr_error_t soxr_set_input_fn(/* Set (or reset) an input function.*/
|
||||
soxr_t resampler, /* As returned by soxr_create. */
|
||||
soxr_input_fn_t, /* Function to supply data to be resampled.*/
|
||||
void * input_fn_state, /* If needed by the input function. */
|
||||
size_t max_ilen); /* Maximum value for input fn. requested_len.*/
|
||||
|
||||
/* then repeatedly call: */
|
||||
|
||||
SOXR size_t /*odone*/ soxr_output(/* Resample and output a block of data.*/
|
||||
soxr_t resampler, /* As returned by soxr_create. */
|
||||
soxr_out_t data, /* App-supplied buffer(s) for resampled data.*/
|
||||
size_t olen); /* Amount of data to output; >= odone. */
|
||||
|
||||
|
||||
|
||||
/* Common stream resampler operations: */
|
||||
|
||||
SOXR soxr_error_t soxr_error(soxr_t); /* Query error status. */
|
||||
SOXR size_t * soxr_num_clips(soxr_t); /* Query int. clip counter (for R/W). */
|
||||
SOXR double soxr_delay(soxr_t); /* Query current delay in output samples.*/
|
||||
SOXR char const * soxr_engine(soxr_t); /* Query resampling engine name. */
|
||||
|
||||
SOXR soxr_error_t soxr_clear(soxr_t); /* Ready for fresh signal, same config. */
|
||||
SOXR void soxr_delete(soxr_t); /* Free resources. */
|
||||
|
||||
|
||||
|
||||
/* `Short-cut', single call to resample a (probably short) signal held entirely
|
||||
* in memory. See soxr_create and soxr_process above for parameter details.
|
||||
* Note that unlike soxr_create however, the default quality spec. for
|
||||
* soxr_oneshot is per soxr_quality_spec(SOXR_LQ, 0). */
|
||||
|
||||
SOXR soxr_error_t soxr_oneshot(
|
||||
double input_rate,
|
||||
double output_rate,
|
||||
unsigned num_channels,
|
||||
soxr_in_t in , size_t ilen, size_t * idone,
|
||||
soxr_out_t out, size_t olen, size_t * odone,
|
||||
soxr_io_spec_t const *,
|
||||
soxr_quality_spec_t const *,
|
||||
soxr_runtime_spec_t const *);
|
||||
|
||||
|
||||
|
||||
/* For variable-rate resampling. See example # 5 for how to create a
|
||||
* variable-rate resampler and how to use this function. */
|
||||
|
||||
SOXR soxr_error_t soxr_set_io_ratio(soxr_t, double io_ratio, size_t slew_len);
|
||||
|
||||
|
||||
|
||||
/* -------------------------- API type definitions -------------------------- */
|
||||
|
||||
typedef enum { /* Datatypes supported for I/O to/from the resampler: */
|
||||
/* Internal; do not use: */
|
||||
SOXR_FLOAT32, SOXR_FLOAT64, SOXR_INT32, SOXR_INT16, SOXR_SPLIT = 4,
|
||||
|
||||
/* Use for interleaved channels: */
|
||||
SOXR_FLOAT32_I = SOXR_FLOAT32, SOXR_FLOAT64_I, SOXR_INT32_I, SOXR_INT16_I,
|
||||
|
||||
/* Use for split channels: */
|
||||
SOXR_FLOAT32_S = SOXR_SPLIT , SOXR_FLOAT64_S, SOXR_INT32_S, SOXR_INT16_S
|
||||
|
||||
} soxr_datatype_t;
|
||||
|
||||
#define soxr_datatype_size(x) /* Returns `sizeof' a soxr_datatype_t sample. */\
|
||||
((unsigned char *)"\4\10\4\2")[(x)&3]
|
||||
|
||||
|
||||
|
||||
struct soxr_io_spec { /* Typically */
|
||||
soxr_datatype_t itype; /* Input datatype. SOXR_FLOAT32_I */
|
||||
soxr_datatype_t otype; /* Output datatype. SOXR_FLOAT32_I */
|
||||
double scale; /* Linear gain to apply during resampling. 1 */
|
||||
void * e; /* Reserved for internal use 0 */
|
||||
unsigned long flags; /* Per the following #defines. 0 */
|
||||
};
|
||||
|
||||
#define SOXR_TPDF 0 /* Applicable only if otype is INT16. */
|
||||
#define SOXR_NO_DITHER 8u /* Disable the above. */
|
||||
|
||||
|
||||
|
||||
struct soxr_quality_spec { /* Typically */
|
||||
double precision; /* Conversion precision (in bits). 20 */
|
||||
double phase_response; /* 0=minimum, ... 50=linear, ... 100=maximum 50 */
|
||||
double passband_end; /* 0dB pt. bandwidth to preserve; nyquist=1 0.913*/
|
||||
double stopband_begin; /* Aliasing/imaging control; > passband_end 1 */
|
||||
void * e; /* Reserved for internal use. 0 */
|
||||
unsigned long flags; /* Per the following #defines. 0 */
|
||||
};
|
||||
|
||||
#define SOXR_ROLLOFF_SMALL 0u /* <= 0.01 dB */
|
||||
#define SOXR_ROLLOFF_MEDIUM 1u /* <= 0.35 dB */
|
||||
#define SOXR_ROLLOFF_NONE 2u /* For Chebyshev bandwidth. */
|
||||
|
||||
#define SOXR_HI_PREC_CLOCK 8u /* Increase `irrational' ratio accuracy. */
|
||||
#define SOXR_DOUBLE_PRECISION 16u /* Use D.P. calcs even if precision <= 20. */
|
||||
#define SOXR_VR 32u /* Variable-rate resampling. */
|
||||
|
||||
|
||||
|
||||
struct soxr_runtime_spec { /* Typically */
|
||||
unsigned log2_min_dft_size; /* For DFT efficiency. [8,15] 10 */
|
||||
unsigned log2_large_dft_size; /* For DFT efficiency. [8,20] 17 */
|
||||
unsigned coef_size_kbytes; /* For SOXR_COEF_INTERP_AUTO (below). 400 */
|
||||
unsigned num_threads; /* 0: per OMP_NUM_THREADS; 1: 1 thread. 1 */
|
||||
void * e; /* Reserved for internal use. 0 */
|
||||
unsigned long flags; /* Per the following #defines. 0 */
|
||||
};
|
||||
/* For `irrational' ratios only: */
|
||||
#define SOXR_COEF_INTERP_AUTO 0u /* Auto select coef. interpolation. */
|
||||
#define SOXR_COEF_INTERP_LOW 2u /* Man. select: less CPU, more memory. */
|
||||
#define SOXR_COEF_INTERP_HIGH 3u /* Man. select: more CPU, less memory. */
|
||||
|
||||
|
||||
|
||||
/* -------------------------- API type constructors ------------------------- */
|
||||
|
||||
/* These functions allow setting of the most commonly-used structure
|
||||
* parameters, with other parameters being given default values. The default
|
||||
* values may then be overridden, directly in the structure, if needed. */
|
||||
|
||||
SOXR soxr_quality_spec_t soxr_quality_spec(
|
||||
unsigned long recipe, /* Per the #defines immediately below. */
|
||||
unsigned long flags); /* As soxr_quality_spec_t.flags. */
|
||||
|
||||
/* The 5 standard qualities found in SoX: */
|
||||
#define SOXR_QQ 0 /* 'Quick' cubic interpolation. */
|
||||
#define SOXR_LQ 1 /* 'Low' 16-bit with larger rolloff. */
|
||||
#define SOXR_MQ 2 /* 'Medium' 16-bit with medium rolloff. */
|
||||
#define SOXR_HQ SOXR_20_BITQ /* 'High quality'. */
|
||||
#define SOXR_VHQ SOXR_28_BITQ /* 'Very high quality'. */
|
||||
|
||||
#define SOXR_16_BITQ 3
|
||||
#define SOXR_20_BITQ 4
|
||||
#define SOXR_24_BITQ 5
|
||||
#define SOXR_28_BITQ 6
|
||||
#define SOXR_32_BITQ 7
|
||||
/* Reserved for internal use (to be removed): */
|
||||
#define SOXR_LSR0Q 8 /* 'Best sinc'. */
|
||||
#define SOXR_LSR1Q 9 /* 'Medium sinc'. */
|
||||
#define SOXR_LSR2Q 10 /* 'Fast sinc'. */
|
||||
|
||||
#define SOXR_LINEAR_PHASE 0x00
|
||||
#define SOXR_INTERMEDIATE_PHASE 0x10
|
||||
#define SOXR_MINIMUM_PHASE 0x30
|
||||
|
||||
#define SOXR_STEEP_FILTER 0x40
|
||||
|
||||
|
||||
|
||||
SOXR soxr_runtime_spec_t soxr_runtime_spec(
|
||||
unsigned num_threads);
|
||||
|
||||
|
||||
|
||||
SOXR soxr_io_spec_t soxr_io_spec(
|
||||
soxr_datatype_t itype,
|
||||
soxr_datatype_t otype);
|
||||
|
||||
|
||||
|
||||
/* --------------------------- Advanced use only ---------------------------- */
|
||||
|
||||
/* For new designs, the following functions/usage will probably not be needed.
|
||||
* They might be useful when adding soxr into an existing design where values
|
||||
* for the resampling-rate and/or number-of-channels parameters to soxr_create
|
||||
* are not available when that function will be called. In such cases, the
|
||||
* relevant soxr_create parameter(s) can be given as 0, then one or both of the
|
||||
* following (as appropriate) later invoked (but prior to calling soxr_process
|
||||
* or soxr_output):
|
||||
*
|
||||
* soxr_set_error(soxr, soxr_set_io_ratio(soxr, io_ratio, 0));
|
||||
* soxr_set_error(soxr, soxr_set_num_channels(soxr, num_channels));
|
||||
*/
|
||||
|
||||
SOXR soxr_error_t soxr_set_error(soxr_t, soxr_error_t);
|
||||
SOXR soxr_error_t soxr_set_num_channels(soxr_t, unsigned);
|
||||
|
||||
|
||||
|
||||
#undef SOXR
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Binary file not shown.
|
@ -24,8 +24,16 @@
|
|||
|
||||
static const size_t LPC_ORDER = 32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void lpc_extrapolate2(float * const data, const size_t data_len, const int nch, const int lpc_order, const size_t extra_bkwd, const size_t extra_fwd, void ** extrapolate_buffer, size_t * extrapolate_buffer_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void lpc_extrapolate_bkwd(float * const data, const size_t data_len, const size_t prime_len, const int nch, const int lpc_order, const size_t extra_bkwd, void ** extrapolate_buffer, size_t * extrapolate_buffer_size)
|
||||
{
|
||||
(void)data_len;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 33e8a35ef6e33cbebe1d0ccfbb12ecd7535e44c2
|
|
@ -0,0 +1,132 @@
|
|||
//
|
||||
// r8bstate.h
|
||||
// CogAudio Framework
|
||||
//
|
||||
// Created by Christopher Snowhill on 3/3/22.
|
||||
//
|
||||
|
||||
#ifndef r8bstate_h
|
||||
#define r8bstate_h
|
||||
|
||||
#include "CDSPResampler.h"
|
||||
#include "r8bbase.h"
|
||||
|
||||
struct r8bstate {
|
||||
int channelCount;
|
||||
int bufferCapacity;
|
||||
size_t remainder;
|
||||
uint64_t inProcessed;
|
||||
uint64_t outProcessed;
|
||||
double sampleRatio;
|
||||
r8b::CFixedBuffer<double> InBuf;
|
||||
r8b::CFixedBuffer<double> *OutBuf;
|
||||
r8b::CDSPResampler24 **Resamps;
|
||||
r8bstate(int _channelCount, int _bufferCapacity, double srcRate, double dstRate)
|
||||
: channelCount(_channelCount), bufferCapacity(_bufferCapacity), inProcessed(0), outProcessed(0), remainder(0) {
|
||||
InBuf.alloc(bufferCapacity);
|
||||
OutBuf = new r8b::CFixedBuffer<double>[channelCount];
|
||||
Resamps = new r8b::CDSPResampler24 *[channelCount];
|
||||
for(int i = 0; i < channelCount; ++i) {
|
||||
Resamps[i] = new r8b::CDSPResampler24(srcRate, dstRate, bufferCapacity);
|
||||
}
|
||||
sampleRatio = dstRate / srcRate;
|
||||
}
|
||||
|
||||
~r8bstate() {
|
||||
delete[] OutBuf;
|
||||
for(int i = 0; i < channelCount; ++i) {
|
||||
delete Resamps[i];
|
||||
}
|
||||
delete[] Resamps;
|
||||
}
|
||||
|
||||
int resample(const float *input, size_t inCount, size_t *inDone, float *output, size_t outMax) {
|
||||
int ret = 0;
|
||||
int i;
|
||||
if(inDone) *inDone = 0;
|
||||
while(remainder > 0) {
|
||||
size_t blockCount = remainder;
|
||||
if(blockCount > outMax)
|
||||
blockCount = outMax;
|
||||
for(i = 0; i < channelCount; ++i) {
|
||||
vDSP_vdpsp(&OutBuf[i][0], 1, output + i, channelCount, blockCount);
|
||||
}
|
||||
remainder -= blockCount;
|
||||
output += channelCount * blockCount;
|
||||
outMax -= blockCount;
|
||||
ret += blockCount;
|
||||
if(!outMax)
|
||||
return ret;
|
||||
}
|
||||
while(inCount > 0) {
|
||||
size_t blockCount = inCount;
|
||||
if(blockCount > bufferCapacity)
|
||||
blockCount = bufferCapacity;
|
||||
int outputDone;
|
||||
for(i = 0; i < channelCount; ++i) {
|
||||
double *outputPointer;
|
||||
vDSP_vspdp(input + i, channelCount, &InBuf[0], 1, blockCount);
|
||||
outputDone = Resamps[i]->process(InBuf, (int)blockCount, outputPointer);
|
||||
if(outputDone) {
|
||||
if(outputDone > outMax) {
|
||||
vDSP_vdpsp(outputPointer, 1, output + i, channelCount, outMax);
|
||||
remainder = outputDone - outMax;
|
||||
OutBuf[i].alloc((int)remainder);
|
||||
memcpy(&OutBuf[i][0], outputPointer + outMax, remainder);
|
||||
} else {
|
||||
vDSP_vdpsp(outputPointer, 1, output + i, channelCount, outputDone);
|
||||
}
|
||||
}
|
||||
}
|
||||
input += channelCount * blockCount;
|
||||
output += channelCount * outputDone;
|
||||
inCount -= blockCount;
|
||||
if(inDone) *inDone += blockCount;
|
||||
inProcessed += blockCount;
|
||||
outProcessed += outputDone;
|
||||
ret += outputDone;
|
||||
if(remainder)
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int flush(float *output, size_t outMax) {
|
||||
int ret = 0;
|
||||
int i;
|
||||
if(remainder > 0) {
|
||||
size_t blockCount = remainder;
|
||||
if(blockCount > outMax)
|
||||
blockCount = outMax;
|
||||
for(i = 0; i < channelCount; ++i) {
|
||||
vDSP_vdpsp(&OutBuf[i][0], 1, output + i, channelCount, blockCount);
|
||||
}
|
||||
remainder -= blockCount;
|
||||
output += channelCount * blockCount;
|
||||
outMax -= blockCount;
|
||||
ret += blockCount;
|
||||
if(!outMax)
|
||||
return ret;
|
||||
}
|
||||
uint64_t outputWanted = ceil(inProcessed * sampleRatio);
|
||||
memset(&InBuf[0], 0, sizeof(double) * bufferCapacity);
|
||||
while(outProcessed < outputWanted) {
|
||||
int outputDone = 0;
|
||||
for(int i = 0; i < channelCount; ++i) {
|
||||
double *outputPointer;
|
||||
outputDone = Resamps[i]->process(InBuf, bufferCapacity, outputPointer);
|
||||
if(outputDone) {
|
||||
if(outputDone > (outputWanted - outProcessed))
|
||||
outputDone = (int)(outputWanted - outProcessed);
|
||||
vDSP_vdpsp(outputPointer, 1, output + i, channelCount, outputDone);
|
||||
}
|
||||
}
|
||||
outProcessed += outputDone;
|
||||
output += channelCount * outputDone;
|
||||
ret += outputDone;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* r8bstate_h */
|
Loading…
Reference in New Issue