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)
{
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 ) {

View file

@ -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;i<NSCENES;i++)
// {
// int iph=clips[i]->getPlayhead()+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;i<NSCENES;i++)
// {
// int iph=clips[i]->getPlayhead()+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)

View file

@ -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);
}
}

View file

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