Skip to content

Commit

Permalink
Various faust fixes, plus faust benchmark script, plus add "-vec" opt…
Browse files Browse the repository at this point in the history
…ion to zita reverb, which improves performance a little bit
  • Loading branch information
kmatheussen committed Mar 25, 2017
1 parent 0bad345 commit d62b4fe
Show file tree
Hide file tree
Showing 6 changed files with 444 additions and 288 deletions.
4 changes: 2 additions & 2 deletions Makefile.Qt
Expand Up @@ -1656,7 +1656,7 @@ zita_rev.o: audio/zita_rev.cpp
$(CCC) audio/zita_rev.cpp $(FAUST_OPTS) -DCLASSNAME=Zita_dsp -DDSP_NAME=\"Zita\ Reverb\" -DCREATE_NAME=create_zita_rev_plugin

audio/zita_rev.cpp: audio/zita_rev.dsp $(FAUST_DEPENDENCIES)
cd audio && $(FAUST) -cn Zita_dsp -a Faust_plugins_template.cpp zita_rev.dsp -o zita_rev.cpp
cd audio && $(FAUST) -vec -cn Zita_dsp -a Faust_plugins_template.cpp zita_rev.dsp -o zita_rev.cpp
sed -i s/^float\ faustpower/static\ float\ faustpower/ $@


Expand Down Expand Up @@ -2018,7 +2018,7 @@ system_compressor_wrapper.o: audio/system_compressor_wrapper.cpp audio/system_co
$(CCC) $(FAUST_OPTS) audio/system_compressor_wrapper.cpp

audio/system_compressor.cpp: audio/system_compressor.dsp
$(FAUST) -vec -cn Faust_system_compressor audio/system_compressor.dsp -o audio/system_compressor.cpp
$(FAUST) -I `pwd`/audio -vec -cn Faust_system_compressor audio/system_compressor.dsp -o audio/system_compressor.cpp

bin/crashreporter: crashreporter/crashreporter.cpp $(API)radium_proc.h
$(CCC) -Wall crashreporter/crashreporter.cpp $(CPPOPT) -DCRASHREPORTER_BIN -DVERSION=\"$(VERSION)\" $(QT_GUI_CFLAGS) $(QT_NETWORK_CFLAGS) -o crashbin.o
Expand Down
16 changes: 8 additions & 8 deletions audio/Sampler_plugin.cpp
Expand Up @@ -789,12 +789,12 @@ static bool RT_play_voice(Data *data, Voice *voice, int num_frames_to_produce, f
}


static void RT_process(SoundPlugin *plugin, int64_t time, int num_frames, float **inputs, float **outputs){
static void RT_process(SoundPlugin *plugin, int64_t time, R_NUM_FRAMES_DECL float **inputs, float **outputs){
Data *data = (Data*)plugin->data;
Voice *voice = data->voices_playing;

memset(outputs[0],0,num_frames*sizeof(float));
memset(outputs[1],0,num_frames*sizeof(float));
memset(outputs[0],0,R_NUM_FRAMES*sizeof(float));
memset(outputs[1],0,R_NUM_FRAMES*sizeof(float));

if (ATOMIC_GET(data->recording_status)==IS_RECORDING){
float *audio_[2];
Expand Down Expand Up @@ -822,15 +822,15 @@ static void RT_process(SoundPlugin *plugin, int64_t time, int num_frames, float

if (data->p.vibrato_phase_add > 0.0) {
data->p.vibrato_value = data->p.vibrato_depth * sin(data->p.vibrato_phase);
data->p.vibrato_phase += data->p.vibrato_phase_add*(double)num_frames;
data->p.vibrato_phase += data->p.vibrato_phase_add*(double)R_NUM_FRAMES;
}

bool was_playing_something = data->voices_playing != NULL;

while(voice!=NULL){
Voice *next = voice->next;

if(RT_play_voice(data, voice, num_frames, outputs)==true){
if(RT_play_voice(data, voice, R_NUM_FRAMES, outputs)==true){
RT_remove_voice(&data->voices_playing, voice);
RT_add_voice(&data->voices_not_playing, voice);
}
Expand All @@ -839,11 +839,11 @@ static void RT_process(SoundPlugin *plugin, int64_t time, int num_frames, float
}

if (was_playing_something)
data->tremolo->type->RT_process(data->tremolo, time, num_frames, outputs, outputs);
data->tremolo->type->RT_process(data->tremolo, time, R_NUM_FRAMES, outputs, outputs);

if(data->new_data != NULL){
RT_fade_out(outputs[0],num_frames);
RT_fade_out(outputs[1],num_frames);
RT_fade_out(outputs[0],R_NUM_FRAMES);
RT_fade_out(outputs[1],R_NUM_FRAMES);

plugin->data = data->new_data; // Bang! (hmm.)
data->new_data = NULL;
Expand Down
11 changes: 8 additions & 3 deletions audio/SmoothDelay.hpp
Expand Up @@ -79,9 +79,10 @@ struct SmoothDelay {
return safe_int_read(&iHslider0);
}

#define R_COUNT RADIUM_BLOCKSIZE
#define INTERP (1.0/4096.0)
#define PROCESS(ANDING) \
for (int i = 0; (i < count); i = (i + 1)) { \
for (int i = 0; (i < R_COUNT); i = (i + 1)) { \
float fSel1; \
if ((fRec0[1] != 0.0f) != 0) { \
fSel1 = (((fRec1[1] > 0.0f) & (fRec1[1] < 1.0f))?fRec0[1]:0.0f); \
Expand Down Expand Up @@ -114,20 +115,24 @@ struct SmoothDelay {


bool RT_process(int count, const FAUSTFLOAT* input0, FAUSTFLOAT* output0) {
#if !defined(RELEASE)
R_ASSERT_RETURN_IF_FALSE2(count==R_COUNT, false);
#endif

const int iSlow0 = iHslider0;

const int anding = buffer_size-1;

if (can_pipe_instead){

// Must do this, even if there has been no delay earlier. If we don't do this, there will be clicks when turning on the delay.
for(int i = 0 ; i < count ; i++){
for(int i = 0 ; i < R_COUNT ; i++){
fVec0[(IOTA & anding)] = input0[i];
IOTA++;
}

// if (input0 != output0)
// memcpy(output0, input0, sizeof(float)*count);
// memcpy(output0, input0, sizeof(float)*R_COUNT);

return false;
}
Expand Down

0 comments on commit d62b4fe

Please sign in to comment.