diff --git a/src/audiobuffer.cxx b/src/audiobuffer.cxx index 172b393..13cb689 100644 --- a/src/audiobuffer.cxx +++ b/src/audiobuffer.cxx @@ -17,7 +17,6 @@ */ #include "audiobuffer.hxx" -#include "eventhandler.hxx" #include "config.hxx" #include diff --git a/src/avtk/clipselector.cxx b/src/avtk/clipselector.cxx index 7cbdba0..9e96c73 100644 --- a/src/avtk/clipselector.cxx +++ b/src/avtk/clipselector.cxx @@ -89,12 +89,12 @@ std::string ClipSelector::clipName(int clip) void ClipSelector::clipName(int clip, std::string name) { clips[clip].setName( name ); - redraw(); + redraw(); } void ClipSelector::setClipBeats(int scene, int beats, bool isBeatsToRecord) { - clips[scene].setBeats(beats, isBeatsToRecord); + clips[scene].setBeats(beats, isBeatsToRecord); } void ClipSelector::setSpecial(int scene) @@ -320,22 +320,22 @@ int ClipSelector::handle(int event) { "Save" }, { "Special"}, { "Beats", 0, 0, 0, FL_SUBMENU | FL_MENU_DIVIDER }, - RECORD_LENGTH_MENU_ITEM(1), - RECORD_LENGTH_MENU_ITEM(2), - RECORD_LENGTH_MENU_ITEM(4), - RECORD_LENGTH_MENU_ITEM(8), - RECORD_LENGTH_MENU_ITEM(16), - RECORD_LENGTH_MENU_ITEM(32), - RECORD_LENGTH_MENU_ITEM(64), + RECORD_LENGTH_MENU_ITEM(1), + RECORD_LENGTH_MENU_ITEM(2), + RECORD_LENGTH_MENU_ITEM(4), + RECORD_LENGTH_MENU_ITEM(8), + RECORD_LENGTH_MENU_ITEM(16), + RECORD_LENGTH_MENU_ITEM(32), + RECORD_LENGTH_MENU_ITEM(64), {0}, - { "Bars to record", 0, 0, 0, FL_SUBMENU | FL_MENU_DIVIDER }, - RECORD_BARS_MENU_ITEM(1), - RECORD_BARS_MENU_ITEM(2), - RECORD_BARS_MENU_ITEM(4), - RECORD_BARS_MENU_ITEM(6), - RECORD_BARS_MENU_ITEM(8), - {"Endless", 0, setRecordBarsCb, (void*)-1, FL_MENU_DIVIDER | (clips[clipNum].getBeatsToRecord() < 0) ? FL_ACTIVATE : 0 }, - {"Custom", 0, setRecordBarsCb, (void*)-2}, + { "Bars to record", 0, 0, 0, FL_SUBMENU | FL_MENU_DIVIDER }, + RECORD_BARS_MENU_ITEM(1), + RECORD_BARS_MENU_ITEM(2), + RECORD_BARS_MENU_ITEM(4), + RECORD_BARS_MENU_ITEM(6), + RECORD_BARS_MENU_ITEM(8), + {"Endless", 0, setRecordBarsCb, (void*)-1, FL_MENU_DIVIDER | (clips[clipNum].getBeatsToRecord() < 0) ? FL_ACTIVATE : 0 }, + {"Custom", 0, setRecordBarsCb, (void*)-2}, {0}, //{ "Record" }, { "Use as tempo" }, @@ -423,24 +423,23 @@ int ClipSelector::handle(int event) return 0; default: return Fl_Widget::handle(event); - } + } } void ClipState::setBeats(int numBeats, bool isBeatsToRecord) { - if(numBeats > 0) { - barsText = std::to_string(numBeats/4); - if(isBeatsToRecord){ - barsText = "(" + barsText + ")"; - beatsToRecord = numBeats; - } else { - beats = numBeats; - beatsToRecord = -1; - } - } - else - barsText = std::string(""); + if(numBeats > 0) { + barsText = std::to_string(numBeats/4); + if(isBeatsToRecord){ + barsText = "(" + barsText + ")"; + beatsToRecord = numBeats; + } else { + beats = numBeats; + beatsToRecord = -1; + } + } + else + barsText = std::string(""); } } // Avtk - diff --git a/src/avtk/clipselector.hxx b/src/avtk/clipselector.hxx index c701cd5..95e3b8b 100644 --- a/src/avtk/clipselector.hxx +++ b/src/avtk/clipselector.hxx @@ -41,9 +41,9 @@ class ClipState public: ClipState() : state(GridLogic::STATE_EMPTY), - name(""), - barsText("") - {} + name(""), + barsText("") + {} void setName(std::string n) { @@ -65,31 +65,31 @@ public: return state; } - int getBeatsToRecord(){ - return beatsToRecord; - } + int getBeatsToRecord(){ + return beatsToRecord; + } - void setBeats(int numBeats, bool isBeatsToRecord); + void setBeats(int numBeats, bool isBeatsToRecord); - const char * getBarsString(){ + const char * getBarsString(){ return barsText.c_str(); } private: - GridLogic::State state; + GridLogic::State state; std::string name; std::string barsText; - int beatsToRecord; - int beats; + int beatsToRecord; + int beats; }; class ClipSelector : public Fl_Button { public: ClipSelector( int _x, int _y, int _w, int _h, - const char *_label, bool master = false); + const char *_label, bool master = false); int ID; @@ -114,7 +114,7 @@ public: void setState( int clipNum, GridLogic::State s ); void clipName(int clip, std::string name); - void setClipBeats(int scene, int beats, bool isBeatsToRecord); + void setClipBeats(int scene, int beats, bool isBeatsToRecord); std::string clipName(int clip); @@ -132,4 +132,3 @@ private: } // Avtk #endif // AVTK_CLIP_SELECTOR_H - diff --git a/src/event.hxx b/src/event.hxx index 11053b8..a2eb576 100644 --- a/src/event.hxx +++ b/src/event.hxx @@ -23,7 +23,7 @@ #include /* - event.hxx + event.hxx This file provides declarations for each type of event that the engine uses. */ @@ -128,8 +128,8 @@ enum EVENT_TYPE { // for keeping loop index's inside the enum EVENT_TYPE_FINAL, - // Clip - CLIP_BEATS_CHANGED, + // Clip + CLIP_BEATS_CHANGED, }; /// returns the pretty name of an event @@ -1177,24 +1177,23 @@ public: class EventClipBeatsChanged : public EventBase { public: - int type() - { - return int(CLIP_BEATS_CHANGED); - } - uint32_t size() - { - return sizeof(EventClipBeatsChanged); - } + int type() + { + return int(CLIP_BEATS_CHANGED); + } + uint32_t size() + { + return sizeof(EventClipBeatsChanged); + } - int track; - int scene; - int beats; - bool isBeatsToRecord; + int track; + int scene; + int beats; + bool isBeatsToRecord; - EventClipBeatsChanged() {} - EventClipBeatsChanged(int t, int s, int b, bool i) : track(t), scene(s), beats(b), isBeatsToRecord(i) {} + EventClipBeatsChanged() {} + EventClipBeatsChanged(int t, int s, int b, bool i) : track(t), scene(s), beats(b), isBeatsToRecord(i) {} }; #endif // LUPPP_EVENT_H - diff --git a/src/eventhandlerdsp.cxx b/src/eventhandlerdsp.cxx index e936bb1..8b55b05 100644 --- a/src/eventhandlerdsp.cxx +++ b/src/eventhandlerdsp.cxx @@ -171,7 +171,7 @@ void handleDspEvents() break; } - // ========= GRID ===== + // ========= GRID ===== case Event::GRID_STATE: { if ( availableRead >= sizeof(EventGridState) ) { EventGridState ev; @@ -307,10 +307,10 @@ void handleDspEvents() break; /*{ if ( availableRead >= sizeof(EventFxReverb) ) { - EventFxReverb ev; - jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventFxReverb) ); - // TODO implement reverb - break; } + EventFxReverb ev; + jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventFxReverb) ); + // TODO implement reverb + break; } } */ case Event::TRACK_VOLUME: { @@ -476,8 +476,8 @@ void handleDspEvents() cout << "DSP: Unkown message!! Will clog ringbuffer" << endl; // just do nothing break; - } - } + } + } } else { // next call will get the half-written event return; @@ -499,4 +499,3 @@ void writeToDspRingbuffer(EventBase* e) } #endif // LUPPP_EVENT_HANDLER_DSP_H - diff --git a/src/eventhandlergui.cxx b/src/eventhandlergui.cxx index cacf847..f3a214a 100644 --- a/src/eventhandlergui.cxx +++ b/src/eventhandlergui.cxx @@ -221,7 +221,7 @@ void handleGuiEvents() delete ev.ab; } else { gui->getDiskWriter()->writeAudioBuffer(ev.track, ev.scene, ev.ab, - gui->saveBufferPath.c_str()); + gui->saveBufferPath.c_str()); gui->saveBufferPath = ""; } @@ -279,14 +279,14 @@ void handleGuiEvents() break; } - case Event::CLIP_BEATS_CHANGED: { - if ( availableRead >= sizeof(EventClipBeatsChanged) ) { - EventClipBeatsChanged ev; - jack_ringbuffer_read( rbToGui, (char*)&ev, sizeof(EventClipBeatsChanged) ); - gui->getTrack(ev.track)->getClipSelector()->setClipBeats(ev.scene, ev.beats, ev.isBeatsToRecord); - } - break; - } + case Event::CLIP_BEATS_CHANGED: { + if ( availableRead >= sizeof(EventClipBeatsChanged) ) { + EventClipBeatsChanged ev; + jack_ringbuffer_read( rbToGui, (char*)&ev, sizeof(EventClipBeatsChanged) ); + gui->getTrack(ev.track)->getClipSelector()->setClipBeats(ev.scene, ev.beats, ev.isBeatsToRecord); + } + break; + } case Event::TRACK_SEND: { if ( availableRead >= sizeof(EventTrackSend) ) { @@ -298,7 +298,7 @@ void handleGuiEvents() } if ( ev.send == SEND_XSIDE ) if ( ev.track < NTRACKS ) { - gui->getTrack(ev.track)->setXSide( ev.value ); + gui->getTrack(ev.track)->setXSide( ev.value ); } } break; @@ -499,4 +499,3 @@ void writeToGuiRingbuffer(EventBase* e) } #endif // LUPPP_EVENT_HANDLER_DSP_H - diff --git a/src/looper.cxx b/src/looper.cxx index da4dd48..13cda8b 100644 --- a/src/looper.cxx +++ b/src/looper.cxx @@ -115,7 +115,7 @@ void Looper::process(unsigned int nframes, Buffers* buffers) if ( clips[clip]->recordSpaceAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST && - !clips[clip]->newBufferInTransit() ) { + !clips[clip]->newBufferInTransit() ) { EventLooperClipRequestBuffer e( track, clip, clips[clip]->audioBufferSize() + LOOPER_SAMPLES_UPDATE_SIZE); writeToGuiRingbuffer( &e ); clips[clip]->newBufferInTransit(true); @@ -199,11 +199,11 @@ void Looper::pitchShift(int count, float* input, float* output) int iTemp5 = int(fTemp4); float out=output[0]; out += (float)(((1 - fTemp3) * (((fTemp4 - iTemp5) * - fVec0[(IOTA-int((int((1 + iTemp5)) & 65535)))&65535]) + ((0 - (( - fRec0[0] + fSlow3) - iTemp5)) * fVec0[(IOTA-int((iTemp5 & 65535))) - &65535]))) + (fTemp3 * (((fRec0[0] - iTemp1) * fVec0[(IOTA-int((int( - iTemp2) & 65535)))&65535]) + ((iTemp2 - fRec0[0]) * fVec0[(IOTA-int(( - iTemp1 & 65535)))&65535])))); + fVec0[(IOTA-int((int((1 + iTemp5)) & 65535)))&65535]) + ((0 - (( + fRec0[0] + fSlow3) - iTemp5)) * fVec0[(IOTA-int((iTemp5 & 65535))) + &65535]))) + (fTemp3 * (((fRec0[0] - iTemp1) * fVec0[(IOTA-int((int( + iTemp2) & 65535)))&65535]) + ((iTemp2 - fRec0[0]) * fVec0[(IOTA-int(( + iTemp1 & 65535)))&65535])))); output[0]=out; fRec0[1] = fRec0[0]; diff --git a/src/looperclip.cxx b/src/looperclip.cxx index af15cb5..5b32509 100644 --- a/src/looperclip.cxx +++ b/src/looperclip.cxx @@ -48,9 +48,9 @@ void LooperClip::init() _queuePlay = false; _queueStop = false; - _queueRecord= false; - _wantedBeats= -1; - setBeats(0); + _queueRecord= false; + _wantedBeats= -1; + setBeats(0); if ( _buffer ) { _buffer->init(); @@ -114,8 +114,8 @@ void LooperClip::load( AudioBuffer* ab ) } _buffer = ab; - EventClipBeatsChanged e( track, scene, _wantedBeats, true ); - writeToGuiRingbuffer( &e ); + EventClipBeatsChanged e( track, scene, _wantedBeats, true ); + writeToGuiRingbuffer( &e ); _playhead = 0; jack->getControllerUpdater()->setTrackSceneProgress(track, scene, 0 ); @@ -155,7 +155,7 @@ void LooperClip::setRequestedBuffer( AudioBuffer* ab ) void LooperClip::recieveSaveBuffer( AudioBuffer* saveBuffer ) { if ( saveBuffer->getSize() >= _buffer->getDataL().at(0) || - saveBuffer->getSize() >= _buffer->getDataR().at(0) ) { + saveBuffer->getSize() >= _buffer->getDataR().at(0) ) { // copy current contents into save buffer, // getData() contains L and R buffer, so twice the size is needed size_t framesBySize = _buffer->getAudioFrames(); @@ -183,15 +183,15 @@ void LooperClip::setPlayHead(float ph) { if(!_recording&&_playing) { _playhead = ph; - jack->getControllerUpdater()->setTrackSceneProgress( track, scene, getProgress() ); - } + jack->getControllerUpdater()->setTrackSceneProgress( track, scene, getProgress() ); + } } void LooperClip::setBarsToRecord(int bars) { - _wantedBeats = bars * 4; // we set beats - EventClipBeatsChanged e( track, scene, _wantedBeats, true); - writeToGuiRingbuffer(&e); + _wantedBeats = bars * 4; // we set beats + EventClipBeatsChanged e( track, scene, _wantedBeats, true); + writeToGuiRingbuffer(&e); } int LooperClip::getBeatsToRecord() @@ -205,7 +205,7 @@ int LooperClip::getBarsToRecord(){ void LooperClip::record(int count, float* L, float* R) { - // write "count" samples into current buffer. + // write "count" samples into current buffer. if ( _buffer ) { size_t size = _buffer->getSize(); @@ -255,11 +255,11 @@ void LooperClip::setBeats(int beats) { if ( _buffer ) { _buffer->setBeats( beats ); - } + } - // Even on Reset! - EventClipBeatsChanged e(track, scene, beats, false); - writeToGuiRingbuffer(&e); + // Even on Reset! + EventClipBeatsChanged e(track, scene, beats, false); + writeToGuiRingbuffer(&e); } int LooperClip::getBeats() @@ -291,10 +291,10 @@ void LooperClip::bar() GridLogic::State s = GridLogic::STATE_EMPTY; // first update the buffer, as time has passed - if ( _recording ) { + if ( _recording ) { // FIXME: assumes 4 beats in a bar - setBeats( _buffer->getBeats() + 4 ); - _buffer->setAudioFrames( jack->getTimeManager()->getFpb() * _buffer->getBeats() ); + setBeats( _buffer->getBeats() + 4 ); + _buffer->setAudioFrames( jack->getTimeManager()->getFpb() * _buffer->getBeats() ); } if ( _playhead >= _recordhead ) { @@ -438,8 +438,8 @@ void LooperClip::getSample(float playSpeed, float* L, float* R) { if ( _buffer && (_buffer->getSize() > 0)) { if ( _playhead >= _recordhead || - _playhead >= _buffer->getSize() || - _playhead < 0 ) { + _playhead >= _buffer->getSize() || + _playhead < 0 ) { _playhead = 0; EventGuiPrint e( "LooperClip resetting _playhead" ); diff --git a/src/looperclip.hxx b/src/looperclip.hxx index d5d0bf8..27a763c 100644 --- a/src/looperclip.hxx +++ b/src/looperclip.hxx @@ -151,4 +151,3 @@ private: }; #endif // LUPPP_LOOPER_CLIP_H -