diff --git a/src/gmastertrack.hxx b/src/gmastertrack.hxx index d782a7b..18ac771 100644 --- a/src/gmastertrack.hxx +++ b/src/gmastertrack.hxx @@ -24,8 +24,6 @@ static void gmastertrack_button_callback(Fl_Widget *w, void *data) { if ( data ) track = *(int*)data; - cout << "Button " << track << " " << w->label() << " clicked" << endl; - if ( strcmp( w->label(), "Metro" ) == 0 ) { Avtk::Button* b = (Avtk::Button*)w; diff --git a/src/gui.cxx b/src/gui.cxx index 5062165..13b0d34 100644 --- a/src/gui.cxx +++ b/src/gui.cxx @@ -29,7 +29,7 @@ Gui::Gui() : { window.color(FL_BLACK); window.label("Luppp 5"); - window.callback( close_cb, 0 ); + //window.callback( close_cb, 0 ); Avtk::Image* header = new Avtk::Image(0,0,600,36,"header.png"); diff --git a/src/looper.cxx b/src/looper.cxx index 90df868..52deb7b 100644 --- a/src/looper.cxx +++ b/src/looper.cxx @@ -61,19 +61,37 @@ void Looper::process(int nframes, Buffers* buffers) float* in = buffers->audio[Buffers::MASTER_INPUT]; float* out = buffers->audio[Buffers::MASTER_OUTPUT]; + float playbackSpeed = endPoint / ( float(numBeats) * fpb ); + // invert the change due to speed, and pitch-shift it back to normal :D + float deltaPitch = 12 * log ( playbackSpeed ) / log (2); + semitoneShift = -deltaPitch; + + if (track == 0) + { + // log pitch-shift rates + char buffer [50]; + sprintf (buffer, "Looper, pbs=%f, dP=%f", playbackSpeed, deltaPitch ); + EventGuiPrint e( buffer ); + writeToGuiRingbuffer( &e ); + } + if ( state == STATE_PLAYING ) { for(int i = 0; i < nframes; i++) { if ( playPoint < endPoint ) { - tmpBuffer[i] += sample[playPoint]; + tmpBuffer[i] = sample[playPoint]; } // always update playPoint, even when not playing sound. // it updates the UI of progress playPoint++; } + + // not pitch-shift the audio in the buffer + pitchShift( nframes, &tmpBuffer[0], out); + float prog = (float(playPoint) / (fpb*numBeats)); /* @@ -96,10 +114,6 @@ void Looper::process(int nframes, Buffers* buffers) } } - - // not pitch-shift the audio in the buffer - pitchShift( nframes, &tmpBuffer[0], out); - }