diff --git a/include/GrooveView.h b/include/GrooveView.h index 8abb4c8f7..faf8ec54e 100644 --- a/include/GrooveView.h +++ b/include/GrooveView.h @@ -18,7 +18,7 @@ class GrooveView : public QWidget public: GrooveView(QWidget * parent); virtual ~GrooveView(); - + void clear(); signals: diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index ac4c36937..1b4bf7f2e 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -261,7 +261,7 @@ private: FloatModel m_panningModel; AudioPort m_audioPort; - + // Track specific groove or NULL Groove * m_groove; Groove * m_noGroove; diff --git a/src/core/GrooveExperiments.cpp b/src/core/GrooveExperiments.cpp index 0925ef0a4..1c451099b 100644 --- a/src/core/GrooveExperiments.cpp +++ b/src/core/GrooveExperiments.cpp @@ -55,10 +55,10 @@ void GrooveExperiments::init() { Song * s = Engine::getSong(); - connect( s, SIGNAL(projectLoaded()), this, SLOT(update()) ); - connect( s, SIGNAL(lengthChanged(int)), this, SLOT(update()) ); - connect( s, SIGNAL(tempoChanged(bpm_t)), this, SLOT(update()) ); - connect( s, SIGNAL(timeSignatureChanged(int, int)), this, SLOT(update()) ); + connect(s, SIGNAL(projectLoaded()), this, SLOT(update())); + connect(s, SIGNAL(lengthChanged(int)), this, SLOT(update())); + connect(s, SIGNAL(tempoChanged(bpm_t)), this, SLOT(update())); + connect(s, SIGNAL(timeSignatureChanged(int, int)), this, SLOT(update())); } @@ -67,16 +67,16 @@ void GrooveExperiments::update() m_framesPerTick = Engine::framesPerTick(); } -int GrooveExperiments::isInTick(MidiTime * curStart, const fpp_t frames, const f_cnt_t offset, Note * n, Pattern * p ) +int GrooveExperiments::isInTick(MidiTime * curStart, const fpp_t frames, const f_cnt_t offset, Note * n, Pattern * p) { // TODO why is this wrong on boot how do we set it once not every loop - if ( m_framesPerTick == 0 ) + if (m_framesPerTick == 0) { m_framesPerTick = Engine::framesPerTick(); // e.g. 500 at 120BPM 4/4 } // only ever delay notes by 12 ticks, so if the tick is earlier don't play - if ( n->pos().getTicks() + 12 < curStart->getTicks()) + if (n->pos().getTicks() + 12 < curStart->getTicks()) { return -1; } @@ -85,26 +85,26 @@ int GrooveExperiments::isInTick(MidiTime * curStart, const fpp_t frames, const f // Where are we in the beat // 48 ticks to the beat, 192 ticks to the bar - int pos_in_beat = n->pos().getTicks() % 48; + int posInBeat = n->pos().getTicks() % 48; int posInEigth = -1; - if ( pos_in_beat >= 36 && pos_in_beat < 48 ) + if (posInBeat >= 36 && posInBeat < 48) { // third quarter - posInEigth = pos_in_beat - 36; // 0-11 + posInEigth = posInBeat - 36; // 0-11 } - if ( posInEigth >= 0 ) + if (posInEigth >= 0) { float ticksToShift = ((posInEigth - 12) * -m_swingFactor); - + f_cnt_t framesToShift = (int)(ticksToShift * m_framesPerTick); - + int tickOffset = (int)(framesToShift / m_framesPerTick); // round down - if ( curStart->getTicks() == (n->pos().getTicks() + tickOffset) ) + if (curStart->getTicks() == (n->pos().getTicks() + tickOffset)) { // play in this tick @@ -113,7 +113,7 @@ int GrooveExperiments::isInTick(MidiTime * curStart, const fpp_t frames, const f return newOffset; } else - { + { // this note does not play in this tick return -1; } @@ -138,7 +138,7 @@ GrooveExperimentsView::GrooveExperimentsView(GrooveExperiments * groove, QWidget m_sliderModel = new IntModel(0, 0, 127); // Unused m_slider = new AutomatableSlider(this, tr("Swinginess")); m_slider->setOrientation(Qt::Horizontal); - m_slider->setFixedSize( 90, 26 ); + m_slider->setFixedSize(90, 26); m_slider->setPageStep(1); m_slider->setModel(m_sliderModel); m_sliderModel->setValue(groove->amount()); diff --git a/src/core/HalfSwing.cpp b/src/core/HalfSwing.cpp index d7750e28e..6c7283aa1 100644 --- a/src/core/HalfSwing.cpp +++ b/src/core/HalfSwing.cpp @@ -107,9 +107,9 @@ int HalfSwing::isInTick(MidiTime * curStart, const fpp_t frames, const f_cnt_t o { float ticksToShift = ((posInEigth - 6) * -m_swingFactor); - + f_cnt_t framesToShift = (int)(ticksToShift * m_framesPerTick); - + int tickOffset = (int)(framesToShift / m_framesPerTick); // round down if (curStart->getTicks() == (n->pos().getTicks() + tickOffset)) diff --git a/src/core/HydrogenSwing.cpp b/src/core/HydrogenSwing.cpp index 6f76f0c15..f0a14e854 100644 --- a/src/core/HydrogenSwing.cpp +++ b/src/core/HydrogenSwing.cpp @@ -111,9 +111,9 @@ int HydrogenSwing::isInTick(MidiTime * curStart, const fpp_t frames, const f_cnt { float ticksToShift = ((posInEigth - 6) * -m_swingFactor); - + f_cnt_t framesToShift = (int)(ticksToShift * m_framesPerTick); - + int tickOffset = (int)(framesToShift / m_framesPerTick); // round down if (curStart->getTicks() == (n->pos().getTicks() + tickOffset)) @@ -125,7 +125,7 @@ int HydrogenSwing::isInTick(MidiTime * curStart, const fpp_t frames, const f_cnt return newOffset; } else - { + { // this note does not play in this tick return -1; } diff --git a/src/core/MidiSwing.cpp b/src/core/MidiSwing.cpp index 473439250..47e2c92c0 100644 --- a/src/core/MidiSwing.cpp +++ b/src/core/MidiSwing.cpp @@ -57,7 +57,7 @@ int MidiSwing::isInTick(MidiTime * curStart, Note * n, Pattern * p) if (posInBeat >= 12 && posInBeat < 18) { // 1st half of second quarter - //add a 0 - 24 tick shift + // add a 0 - 24 tick shift posInEigth = posInBeat - 12; // 0-5 } else if (posInBeat >= 36 && posInBeat < 42) diff --git a/src/core/Song.cpp b/src/core/Song.cpp index 4ef90899f..e26b812e8 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -1040,9 +1040,8 @@ void Song::loadProject( const QString & fileName ) QDomElement ge = dataFile.content().firstChildElement( "groove" ); m_globalGroove = GrooveFactory::create(ge.attribute("type")); m_globalGroove->restoreState( ge.firstChildElement(ge.attribute("type")) ); - } - else + else { m_globalGroove = GrooveFactory::create("none"); } diff --git a/src/core/Track.cpp b/src/core/Track.cpp index 3b28bf3f6..065ab42e1 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -1992,19 +1992,19 @@ QMenu * TrackOperationsWidget::grooveMenu() // turn groove off. QAction * muteAct = new QAction(embed::getIconPixmap( "led_red", 16, 16 ), - "Off", this); + "Off", this); muteAct->setData(t->id()); - grooveMenu->addAction( muteAct ); - QObject::connect(muteAct, SIGNAL( triggered( ) ), - this, SLOT( disableGroove( ) )); + grooveMenu->addAction(muteAct); + QObject::connect(muteAct, SIGNAL(triggered()), + this, SLOT(disableGroove())); // turn groove on. QAction * unmuteAct = new QAction(embed::getIconPixmap( "led_green", 16, 16 ), - "On", this); + "On", this); unmuteAct->setData(t->id()); - grooveMenu->addAction( unmuteAct ); - QObject::connect(unmuteAct, SIGNAL( triggered( ) ), - this, SLOT( enableGroove( ) )); + grooveMenu->addAction(unmuteAct); + QObject::connect(unmuteAct, SIGNAL(triggered()), + this, SLOT(enableGroove())); } diff --git a/src/gui/widgets/GrooveView.cpp b/src/gui/widgets/GrooveView.cpp index ce8ad5ac6..9660f1dc3 100644 --- a/src/gui/widgets/GrooveView.cpp +++ b/src/gui/widgets/GrooveView.cpp @@ -87,7 +87,7 @@ void GrooveView::clear() QLayoutItem * li = m_layout->takeAt(1); delete li->widget(); delete li; - + m_comboBox->setCurrentIndex(0); m_layout->addWidget(new QLabel("")); } @@ -98,7 +98,7 @@ void GrooveView::grooveChanged(int index) int selectedIdx = m_comboBox->currentIndex(); switch (selectedIdx) { - case 0 : + case 0 : { groove = new Groove(); break; diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 23285cd08..8c6277321 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -682,7 +682,7 @@ bool InstrumentTrack::play( const MidiTime & _start, const fpp_t _frames, // posated within the current sample-frame - + // FIXME: Uncomment once groove is straight. // Perhaps have groove supply max shift so we can skip some notes if not all /* @@ -718,7 +718,7 @@ bool InstrumentTrack::play( const MidiTime & _start, const fpp_t _frames, Engine::mixer()->addPlayHandle( notePlayHandle ); played_a_note = true; } - ++nit; + ++nit; } } unlock();