Do more reformattings

This commit is contained in:
Hyunin Song
2018-03-28 10:03:42 +09:00
parent 217c31af8c
commit 81e0fe23b0
10 changed files with 37 additions and 38 deletions

View File

@@ -18,7 +18,7 @@ class GrooveView : public QWidget
public:
GrooveView(QWidget * parent);
virtual ~GrooveView();
void clear();
signals:

View File

@@ -261,7 +261,7 @@ private:
FloatModel m_panningModel;
AudioPort m_audioPort;
// Track specific groove or NULL
Groove * m_groove;
Groove * m_noGroove;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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