more whitespace

This commit is contained in:
Valentin Boettcher 2018-04-10 08:51:27 +02:00
parent 69db656239
commit dbf38ceea8
4 changed files with 48 additions and 49 deletions

View file

@ -93,8 +93,8 @@ void ClipSelector::clipName(int clip, std::string name)
void ClipSelector::setClipBeats(int scene, int beats, bool isBeatsToRecord) void ClipSelector::setClipBeats(int scene, int beats, bool isBeatsToRecord)
{ {
clips[scene].setBeats(beats, isBeatsToRecord); clips[scene].setBeats(beats, isBeatsToRecord);
redraw(); redraw();
} }
double getCairoTextWith(cairo_t * cr, const char * str) 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_line_to( cr, x+clipHeight-1, drawY + clipHeight - 2);
cairo_stroke(cr); cairo_stroke(cr);
int beatLen = 0; int beatLen = 0;
// clip bars // clip bars
if(!_master) { if(!_master) {
const char * bars = clips[i].getBarsText(); const char * bars = clips[i].getBarsText();
const char * beats = clips[i].getBeatsText(); const char * beats = clips[i].getBeatsText();
bool toRecord = clips[i].getBeats() <= 0 && clips[i].getBeatsToRecord() > 0; // If there are BeatsToRecord, but no Beats bool toRecord = clips[i].getBeats() <= 0 && clips[i].getBeatsToRecord() > 0; // If there are BeatsToRecord, but no Beats
if(strlen(bars)) { if(strlen(bars)) {
if(toRecord) cairo_set_source_rgba(cr, 1.f, 0 / 255.f , 0 / 255.f, 1.f); 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 ); 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_move_to( cr, x + clipWidth - 5 - getCairoTextWith(cr, bars), drawY + textHeight - 8);
cairo_set_font_size( cr, 11 ); cairo_set_font_size( cr, 11 );
cairo_show_text( cr, bars); cairo_show_text( cr, bars);
beatLen = getCairoTextWith(cr, beats); beatLen = getCairoTextWith(cr, beats);
cairo_move_to( cr, x + clipWidth - 5 - beatLen, drawY + textHeight + 7); cairo_move_to( cr, x + clipWidth - 5 - beatLen, drawY + textHeight + 7);
cairo_show_text( cr, beats); cairo_show_text( cr, beats);
} }
} }
// clip name // clip name
cairo_move_to( cr, x + clipHeight + 5, drawY + textHeight ); 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_source_rgba( cr, 255 / 255.f, 255 / 255.f , 255 / 255.f , 0.9 );
cairo_set_font_size( cr, 11 ); 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)); trimStringToFit(cr, &tmp, clipWidth - (clipHeight + 15 + beatLen));
cairo_show_text( cr, tmp.c_str() ); cairo_show_text( cr, tmp.c_str() );
// special indicator // special indicator
if ( i == special ) { if ( i == special ) {

View file

@ -72,24 +72,23 @@ LooperClip* Looper::getClip(int scene)
void Looper::beat() void Looper::beat()
{ {
//TODO needed? //TODO needed?
//FIXME: Need to keep looperClips in sync when there exists no int N //FIXME: Need to keep looperClips in sync when there exists no int N
// such that playSpeed*N==1 // such that playSpeed*N==1
// for(int i=0;i<NSCENES;i++) // for(int i=0;i<NSCENES;i++)
// { // {
// int iph=clips[i]->getPlayhead()+1.0; // int iph=clips[i]->getPlayhead()+1.0;
// long targetFrames = clips[i]->getBeats() * fpb; // long targetFrames = clips[i]->getBeats() * fpb;
// long actualFrames = clips[i]->getActualAudioLength();//getBufferLenght(); // long actualFrames = clips[i]->getActualAudioLength();//getBufferLenght();
// float playSpeed = 1.0; // float playSpeed = 1.0;
// if ( targetFrames != 0 && actualFrames != 0 ) // if ( targetFrames != 0 && actualFrames != 0 )
// { // {
// playSpeed = float(actualFrames) / targetFrames; // playSpeed = float(actualFrames) / targetFrames;
// } // }
// clips[i]->setPlayHead(iph-(iph%fpb)*playSpeed); // clips[i]->setPlayHead(iph-(iph%fpb)*playSpeed);
// }
// }
} }
void Looper::setRequestedBuffer(int s, AudioBuffer* ab) void Looper::setRequestedBuffer(int s, AudioBuffer* ab)

View file

@ -49,7 +49,7 @@ void LooperClip::init()
_queuePlay = false; _queuePlay = false;
_queueStop = false; _queueStop = false;
_queueRecord= false; _queueRecord= false;
_beatsToRecord= -1; _beatsToRecord= -1;
setBeats(0); setBeats(0);
if ( _buffer ) { if ( _buffer ) {
@ -189,11 +189,11 @@ void LooperClip::setPlayHead(float ph)
void LooperClip::setBarsToRecord(int bars) void LooperClip::setBarsToRecord(int bars)
{ {
if(!(_playing || _queuePlay || _queueStop || _loaded)) { if(!(_playing || _queuePlay || _queueStop || _loaded)) {
_beatsToRecord = bars * 4; // we set beats _beatsToRecord = bars * 4; // we set beats
EventClipBeatsChanged e( track, scene, _beatsToRecord, true); EventClipBeatsChanged e( track, scene, _beatsToRecord, true);
writeToGuiRingbuffer(&e); writeToGuiRingbuffer(&e);
} }
} }
int LooperClip::getBeatsToRecord() int LooperClip::getBeatsToRecord()
@ -255,12 +255,12 @@ size_t LooperClip::audioBufferSize()
void LooperClip::setBeats(int beats) void LooperClip::setBeats(int beats)
{ {
if (_loaded || _playing || _queuePlay || _queueStop || beats == 0) { if (_loaded || _playing || _queuePlay || _queueStop || beats == 0) {
if(_buffer) if(_buffer)
_buffer->setBeats( beats ); _buffer->setBeats( beats );
EventClipBeatsChanged e(track, scene, beats, false); EventClipBeatsChanged e(track, scene, beats, false);
writeToGuiRingbuffer(&e); writeToGuiRingbuffer(&e);
} }
} }

View file

@ -145,7 +145,7 @@ private:
float _playhead; float _playhead;
float _recordhead; float _recordhead;
int _beatsToRecord; int _beatsToRecord;
AudioBuffer* _buffer; AudioBuffer* _buffer;
}; };