diff --git a/src/avtk/clipselector.cxx b/src/avtk/clipselector.cxx index 5311580..d6ec645 100644 --- a/src/avtk/clipselector.cxx +++ b/src/avtk/clipselector.cxx @@ -93,8 +93,8 @@ void ClipSelector::clipName(int clip, std::string name) void ClipSelector::setClipBeats(int scene, int beats, bool isBeatsToRecord) { - clips[scene].setBeats(beats, isBeatsToRecord); - redraw(); + clips[scene].setBeats(beats, isBeatsToRecord); + redraw(); } double getCairoTextWith(cairo_t * cr, const char * str) @@ -225,36 +225,36 @@ void ClipSelector::draw() cairo_line_to( cr, x+clipHeight-1, drawY + clipHeight - 2); cairo_stroke(cr); - int beatLen = 0; + int beatLen = 0; - // clip bars - if(!_master) { - const char * bars = clips[i].getBarsText(); - const char * beats = clips[i].getBeatsText(); - bool toRecord = clips[i].getBeats() <= 0 && clips[i].getBeatsToRecord() > 0; // If there are BeatsToRecord, but no Beats + // clip bars + if(!_master) { + const char * bars = clips[i].getBarsText(); + const char * beats = clips[i].getBeatsText(); + bool toRecord = clips[i].getBeats() <= 0 && clips[i].getBeatsToRecord() > 0; // If there are BeatsToRecord, but no Beats - if(strlen(bars)) { - if(toRecord) cairo_set_source_rgba(cr, 1.f, 0 / 255.f , 0 / 255.f, 1.f); - else cairo_set_source_rgba( cr, 255 / 255.f, 255 / 255.f, 255 / 255.f , 0.9 ); + if(strlen(bars)) { + if(toRecord) cairo_set_source_rgba(cr, 1.f, 0 / 255.f , 0 / 255.f, 1.f); + else cairo_set_source_rgba( cr, 255 / 255.f, 255 / 255.f, 255 / 255.f , 0.9 ); - cairo_move_to( cr, x + clipWidth - 5 - getCairoTextWith(cr, bars), drawY + textHeight - 8); - cairo_set_font_size( cr, 11 ); - cairo_show_text( cr, bars); + cairo_move_to( cr, x + clipWidth - 5 - getCairoTextWith(cr, bars), drawY + textHeight - 8); + cairo_set_font_size( cr, 11 ); + cairo_show_text( cr, bars); - beatLen = getCairoTextWith(cr, beats); - cairo_move_to( cr, x + clipWidth - 5 - beatLen, drawY + textHeight + 7); - cairo_show_text( cr, beats); - } - } + beatLen = getCairoTextWith(cr, beats); + cairo_move_to( cr, x + clipWidth - 5 - beatLen, drawY + textHeight + 7); + cairo_show_text( cr, beats); + } + } // clip name cairo_move_to( cr, x + clipHeight + 5, drawY + textHeight ); cairo_set_source_rgba( cr, 255 / 255.f, 255 / 255.f , 255 / 255.f , 0.9 ); cairo_set_font_size( cr, 11 ); - std::string tmp = clips[i].getName(); + std::string tmp = clips[i].getName(); trimStringToFit(cr, &tmp, clipWidth - (clipHeight + 15 + beatLen)); - cairo_show_text( cr, tmp.c_str() ); + cairo_show_text( cr, tmp.c_str() ); // special indicator if ( i == special ) { diff --git a/src/looper.cxx b/src/looper.cxx index 3c34480..38ba227 100644 --- a/src/looper.cxx +++ b/src/looper.cxx @@ -72,24 +72,23 @@ LooperClip* Looper::getClip(int scene) void Looper::beat() { - //TODO needed? - //FIXME: Need to keep looperClips in sync when there exists no int N - // such that playSpeed*N==1 - // for(int i=0;igetPlayhead()+1.0; - // long targetFrames = clips[i]->getBeats() * fpb; - // long actualFrames = clips[i]->getActualAudioLength();//getBufferLenght(); - // float playSpeed = 1.0; +//TODO needed? +//FIXME: Need to keep looperClips in sync when there exists no int N +// such that playSpeed*N==1 +// for(int i=0;igetPlayhead()+1.0; +// long targetFrames = clips[i]->getBeats() * fpb; +// long actualFrames = clips[i]->getActualAudioLength();//getBufferLenght(); +// float playSpeed = 1.0; - // if ( targetFrames != 0 && actualFrames != 0 ) - // { - // playSpeed = float(actualFrames) / targetFrames; - // } - // clips[i]->setPlayHead(iph-(iph%fpb)*playSpeed); - - // } +// if ( targetFrames != 0 && actualFrames != 0 ) +// { +// playSpeed = float(actualFrames) / targetFrames; +// } +// clips[i]->setPlayHead(iph-(iph%fpb)*playSpeed); +// } } void Looper::setRequestedBuffer(int s, AudioBuffer* ab) diff --git a/src/looperclip.cxx b/src/looperclip.cxx index 3f4863e..f2ddbd8 100644 --- a/src/looperclip.cxx +++ b/src/looperclip.cxx @@ -49,7 +49,7 @@ void LooperClip::init() _queuePlay = false; _queueStop = false; _queueRecord= false; - _beatsToRecord= -1; + _beatsToRecord= -1; setBeats(0); if ( _buffer ) { @@ -189,11 +189,11 @@ void LooperClip::setPlayHead(float ph) void LooperClip::setBarsToRecord(int bars) { - if(!(_playing || _queuePlay || _queueStop || _loaded)) { - _beatsToRecord = bars * 4; // we set beats - EventClipBeatsChanged e( track, scene, _beatsToRecord, true); - writeToGuiRingbuffer(&e); - } + if(!(_playing || _queuePlay || _queueStop || _loaded)) { + _beatsToRecord = bars * 4; // we set beats + EventClipBeatsChanged e( track, scene, _beatsToRecord, true); + writeToGuiRingbuffer(&e); + } } int LooperClip::getBeatsToRecord() @@ -255,12 +255,12 @@ size_t LooperClip::audioBufferSize() void LooperClip::setBeats(int beats) { - if (_loaded || _playing || _queuePlay || _queueStop || beats == 0) { - if(_buffer) - _buffer->setBeats( beats ); + if (_loaded || _playing || _queuePlay || _queueStop || beats == 0) { + if(_buffer) + _buffer->setBeats( beats ); - EventClipBeatsChanged e(track, scene, beats, false); - writeToGuiRingbuffer(&e); + EventClipBeatsChanged e(track, scene, beats, false); + writeToGuiRingbuffer(&e); } } diff --git a/src/looperclip.hxx b/src/looperclip.hxx index 6f7936a..e01c310 100644 --- a/src/looperclip.hxx +++ b/src/looperclip.hxx @@ -145,7 +145,7 @@ private: float _playhead; float _recordhead; - int _beatsToRecord; + int _beatsToRecord; AudioBuffer* _buffer; };