Move enable/disable groove per instrument track...
...from the TrackOperationsWidget to the InstrumentMiscView.
This commit is contained in:
@@ -62,8 +62,7 @@ private:
|
||||
QToolButton * m_wpBtn;
|
||||
|
||||
LcdSpinBox* m_baseVelocitySpinBox;
|
||||
|
||||
} ;
|
||||
};
|
||||
|
||||
class InstrumentMiscView : public QWidget
|
||||
{
|
||||
@@ -76,11 +75,14 @@ public:
|
||||
{
|
||||
return m_pitchGroupBox;
|
||||
}
|
||||
GroupBox * grooveGroupBox()
|
||||
{
|
||||
return m_grooveGroupBox;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
GroupBox * m_pitchGroupBox;
|
||||
|
||||
GroupBox * m_grooveGroupBox;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -271,6 +271,7 @@ private:
|
||||
IntModel m_pitchRangeModel;
|
||||
IntModel m_effectChannelModel;
|
||||
BoolModel m_useMasterPitchModel;
|
||||
BoolModel m_useGrooveModel;
|
||||
|
||||
|
||||
Instrument * m_instrument;
|
||||
@@ -287,7 +288,9 @@ private:
|
||||
friend class NotePlayHandle;
|
||||
friend class InstrumentMiscView;
|
||||
|
||||
} ;
|
||||
private slots:
|
||||
void updateGroove();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -441,9 +441,6 @@ private slots:
|
||||
void recordingOn();
|
||||
void recordingOff();
|
||||
void clearTrack();
|
||||
QMenu * grooveMenu();
|
||||
void enableGroove();
|
||||
void disableGroove();
|
||||
|
||||
private:
|
||||
static QPixmap * s_grip;
|
||||
|
||||
@@ -1894,34 +1894,6 @@ void TrackOperationsWidget::removeTrack()
|
||||
emit trackRemovalScheduled( m_trackView );
|
||||
}
|
||||
|
||||
/*! \brief Turns off the groove
|
||||
*
|
||||
*/
|
||||
void TrackOperationsWidget::disableGroove()
|
||||
{
|
||||
//engine::getMixer()->lock();
|
||||
Track * t = m_trackView->getTrack();
|
||||
if (t->type() == Track::InstrumentTrack) {
|
||||
InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( t );
|
||||
it->disableGroove();
|
||||
}
|
||||
//engine::getMixer()->unlock();
|
||||
}
|
||||
|
||||
/*! \brief Turns on the groove
|
||||
*
|
||||
*/
|
||||
void TrackOperationsWidget::enableGroove()
|
||||
{
|
||||
//engine::getMixer()->lock();
|
||||
Track * t = m_trackView->getTrack();
|
||||
if (t->type() == Track::InstrumentTrack) {
|
||||
InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( t );
|
||||
it->enableGroove();
|
||||
}
|
||||
//engine::getMixer()->unlock();
|
||||
}
|
||||
|
||||
/*! \brief Update the trackOperationsWidget context menu
|
||||
*
|
||||
* For all track types, we have the Clone and Remove options.
|
||||
@@ -1949,10 +1921,8 @@ void TrackOperationsWidget::updateMenu()
|
||||
{
|
||||
QMenu *fxMenu = trackView->createFxMenu( tr( "FX %1: %2" ), tr( "Assign to new FX Channel" ));
|
||||
toMenu->addMenu(fxMenu);
|
||||
|
||||
toMenu->addSeparator();
|
||||
toMenu->addMenu( trackView->midiMenu() );
|
||||
toMenu->addMenu( grooveMenu() );
|
||||
}
|
||||
if( dynamic_cast<AutomationTrackView *>( m_trackView ) )
|
||||
{
|
||||
@@ -1977,40 +1947,6 @@ void TrackOperationsWidget::recordingOn()
|
||||
}
|
||||
}
|
||||
|
||||
// Groove operations
|
||||
QMenu * TrackOperationsWidget::grooveMenu()
|
||||
{
|
||||
|
||||
// TODO, this is a memory leak presumably
|
||||
QMenu * grooveMenu = new QMenu();
|
||||
grooveMenu->setIcon( embed::getIconPixmap( "note_double_whole", 16, 16 ) );
|
||||
grooveMenu->setTitle("Groove");
|
||||
|
||||
Track * t = this->m_trackView->getTrack();
|
||||
|
||||
if(t->type() == Track::InstrumentTrack) {
|
||||
|
||||
// turn groove off.
|
||||
QAction * muteAct = new QAction(embed::getIconPixmap( "led_red", 16, 16 ),
|
||||
"Off", this);
|
||||
muteAct->setData(t->id());
|
||||
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);
|
||||
unmuteAct->setData(t->id());
|
||||
grooveMenu->addAction(unmuteAct);
|
||||
QObject::connect(unmuteAct, SIGNAL(triggered()),
|
||||
this, SLOT(enableGroove()));
|
||||
|
||||
}
|
||||
|
||||
return grooveMenu;
|
||||
}
|
||||
|
||||
void TrackOperationsWidget::recordingOff()
|
||||
{
|
||||
AutomationTrackView * atv = dynamic_cast<AutomationTrackView *>( m_trackView );
|
||||
|
||||
@@ -207,19 +207,28 @@ void InstrumentMidiIOView::modelChanged()
|
||||
InstrumentMiscView::InstrumentMiscView(InstrumentTrack *it, QWidget *parent) :
|
||||
QWidget( parent )
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout( this );
|
||||
layout->setMargin( 5 );
|
||||
m_pitchGroupBox = new GroupBox( tr ( "MASTER PITCH" ) );
|
||||
layout->addWidget( m_pitchGroupBox );
|
||||
QHBoxLayout* masterPitchLayout = new QHBoxLayout( m_pitchGroupBox );
|
||||
masterPitchLayout->setContentsMargins( 8, 18, 8, 8 );
|
||||
QLabel *tlabel = new QLabel(tr( "Enables the use of Master Pitch" ) );
|
||||
m_pitchGroupBox->setModel( &it->m_useMasterPitchModel );
|
||||
masterPitchLayout->addWidget( tlabel );
|
||||
QLabel *label1 = new QLabel( tr( "Enables the use of Master Pitch" ) );
|
||||
QHBoxLayout *masterPitchLayout = new QHBoxLayout( m_pitchGroupBox );
|
||||
masterPitchLayout->setContentsMargins( 8, 18, 8, 8 );
|
||||
masterPitchLayout->addWidget( label1 );
|
||||
|
||||
m_grooveGroupBox = new GroupBox( tr ( "GROOVE" ) );
|
||||
m_grooveGroupBox->setModel( &it->m_useGrooveModel );
|
||||
QLabel *label2 = new QLabel( tr( "Enables the use of Groove" ) );
|
||||
QHBoxLayout *grooveLayout = new QHBoxLayout( m_grooveGroupBox );
|
||||
grooveLayout->setContentsMargins( 8, 18, 8, 8 );
|
||||
grooveLayout->addWidget( label2 );
|
||||
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout( this );
|
||||
layout->setMargin( 5 );
|
||||
layout->addWidget( m_pitchGroupBox );
|
||||
layout->addWidget( m_grooveGroupBox );
|
||||
layout->addStretch();
|
||||
}
|
||||
|
||||
InstrumentMiscView::~InstrumentMiscView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -106,7 +106,8 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
|
||||
m_pitchModel( 0, MinPitchDefault, MaxPitchDefault, 1, this, tr( "Pitch" ) ),
|
||||
m_pitchRangeModel( 1, 1, 60, this, tr( "Pitch range" ) ),
|
||||
m_effectChannelModel( 0, 0, 0, this, tr( "FX channel" ) ),
|
||||
m_useMasterPitchModel( true, this, tr( "Master Pitch") ),
|
||||
m_useMasterPitchModel( true, this, tr( "Master Pitch" ) ),
|
||||
m_useGrooveModel( true, this, tr( "Groove" ) ),
|
||||
m_instrument( NULL ),
|
||||
m_soundShaping( this ),
|
||||
m_arpeggio( this ),
|
||||
@@ -132,6 +133,7 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
|
||||
connect( &m_pitchModel, SIGNAL( dataChanged() ), this, SLOT( updatePitch() ) );
|
||||
connect( &m_pitchRangeModel, SIGNAL( dataChanged() ), this, SLOT( updatePitchRange() ) );
|
||||
connect( &m_effectChannelModel, SIGNAL( dataChanged() ), this, SLOT( updateEffectChannel() ) );
|
||||
connect( &m_useGrooveModel, SIGNAL( dataChanged() ), this, SLOT( updateGroove() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -727,8 +729,6 @@ bool InstrumentTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
|
||||
Groove * InstrumentTrack::groove()
|
||||
{
|
||||
|
||||
// TODO: Track-specific groove (may sound weird)
|
||||
if (m_grooveOn)
|
||||
{
|
||||
// NULL: Use global groove
|
||||
@@ -742,19 +742,20 @@ Groove * InstrumentTrack::groove()
|
||||
}
|
||||
|
||||
|
||||
void InstrumentTrack::disableGroove()
|
||||
void InstrumentTrack::updateGroove()
|
||||
{
|
||||
if (m_noGroove == NULL)
|
||||
if (m_useGrooveModel.value())
|
||||
{
|
||||
m_noGroove = new Groove();
|
||||
m_grooveOn = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_noGroove == NULL)
|
||||
{
|
||||
m_noGroove = new Groove();
|
||||
}
|
||||
m_grooveOn = false;
|
||||
}
|
||||
m_grooveOn = false;
|
||||
}
|
||||
|
||||
|
||||
void InstrumentTrack::enableGroove()
|
||||
{
|
||||
m_grooveOn = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -784,6 +785,7 @@ void InstrumentTrack::saveTrackSpecificSettings( QDomDocument& doc, QDomElement
|
||||
m_effectChannelModel.saveSettings( doc, thisElement, "fxch" );
|
||||
m_baseNoteModel.saveSettings( doc, thisElement, "basenote" );
|
||||
m_useMasterPitchModel.saveSettings( doc, thisElement, "usemasterpitch");
|
||||
m_useGrooveModel.saveSettings( doc, thisElement, "usegroove");
|
||||
|
||||
if( m_instrument != NULL )
|
||||
{
|
||||
@@ -819,6 +821,7 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & thisElement
|
||||
}
|
||||
m_baseNoteModel.loadSettings( thisElement, "basenote" );
|
||||
m_useMasterPitchModel.loadSettings( thisElement, "usemasterpitch");
|
||||
m_useGrooveModel.loadSettings( thisElement, "usegroove");
|
||||
|
||||
// clear effect-chain just in case we load an old preset without FX-data
|
||||
m_audioPort.effects()->clear();
|
||||
@@ -1641,6 +1644,7 @@ void InstrumentTrackWindow::modelChanged()
|
||||
m_midiView->setModel( &m_track->m_midiPort );
|
||||
m_effectView->setModel( m_track->m_audioPort.effects() );
|
||||
m_miscView->pitchGroupBox()->setModel(&m_track->m_useMasterPitchModel);
|
||||
m_miscView->grooveGroupBox()->setModel(&m_track->m_useGrooveModel);
|
||||
updateName();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user