From 12b153a275606a1fefd24a95ad4f465a4377e4e4 Mon Sep 17 00:00:00 2001 From: Wong Cho Ching Date: Sun, 26 Jan 2014 11:37:43 +0800 Subject: [PATCH 1/2] Added pitch support: Now the pitch knob and the key being pressed have effect on the pitch produced. --- plugins/sfxr/sfxr.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/sfxr/sfxr.cpp b/plugins/sfxr/sfxr.cpp index 01beac5255..b1349b8116 100644 --- a/plugins/sfxr/sfxr.cpp +++ b/plugins/sfxr/sfxr.cpp @@ -299,7 +299,7 @@ void SfxrSynth::update( sampleFrame * buffer, const fpp_t frameNum ) { if(ssample>1.0f) ssample=1.0f; if(ssample<-1.0f) ssample=-1.0f; - for( ch_cnt_t j=0; j < DEFAULT_CHANNELS; j++ ) + for( ch_cnt_t j=0; j void sfxrInstrument::playNote(notePlayHandle * _n, sampleFrame * _working_buffer ) { m_synthMutex.lock(); @@ -458,7 +458,19 @@ void sfxrInstrument::playNote(notePlayHandle * _n, sampleFrame * _working_buffer _n->noteOff(); } - static_cast(_n->m_pluginData)->update( _working_buffer, frameNum ); + fpp_t pitchedFrameNum = (_n->frequency()/BaseFreq)*frameNum; + printf("%i", pitchedFrameNum); fflush(stdout); + sampleFrame * pitchedBuffer = new sampleFrame[pitchedFrameNum]; + static_cast(_n->m_pluginData)->update( pitchedBuffer, pitchedFrameNum ); + for( fpp_t i=0; iprocessAudioBuffer( _working_buffer, frameNum, NULL ); From 959d5e98e69c2bd83831143e775edcf446d8c78f Mon Sep 17 00:00:00 2001 From: Wong Cho Ching Date: Sun, 26 Jan 2014 11:38:52 +0800 Subject: [PATCH 2/2] remove debug message --- plugins/sfxr/sfxr.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/sfxr/sfxr.cpp b/plugins/sfxr/sfxr.cpp index b1349b8116..9def570483 100644 --- a/plugins/sfxr/sfxr.cpp +++ b/plugins/sfxr/sfxr.cpp @@ -444,7 +444,7 @@ QString sfxrInstrument::nodeName() const -#include + void sfxrInstrument::playNote(notePlayHandle * _n, sampleFrame * _working_buffer ) { m_synthMutex.lock(); @@ -459,7 +459,6 @@ void sfxrInstrument::playNote(notePlayHandle * _n, sampleFrame * _working_buffer } fpp_t pitchedFrameNum = (_n->frequency()/BaseFreq)*frameNum; - printf("%i", pitchedFrameNum); fflush(stdout); sampleFrame * pitchedBuffer = new sampleFrame[pitchedFrameNum]; static_cast(_n->m_pluginData)->update( pitchedBuffer, pitchedFrameNum ); for( fpp_t i=0; i