Skip to content

Commit

Permalink
add some midi record actions
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.assembla.com/svn/hydrogen/trunk@2476 3b3fb362-3133-0410-aa15-cf69e0a59cb7
  • Loading branch information
wolkstein committed Mar 22, 2012
1 parent 014196c commit 681c9cf
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/core/src/IO/midi_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ void MidiInput::handleSysexMessage( const MidiMessage& msg )
4 Fast Forward
5 Rewind
6 Record strobe (punch in)
7 Record exit (punch out)
7 Record exit (punch out)
8 Record ready
9 Pause
Expand Down Expand Up @@ -375,6 +376,11 @@ if ( msg.m_sysexData.size() == 6 ) {
aH->handleAction(mM->getMMCAction("MMC_RECORD_EXIT"));
break;

case 8: // RECORD READY
pEngine->lastMidiEvent = "MMC_RECORD_READY";
aH->handleAction(mM->getMMCAction("MMC_RECORD_READY"));
break;

case 9: //PAUSE
pEngine->lastMidiEvent = "MMC_PAUSE";
aH->handleAction(mM->getMMCAction("MMC_PAUSE"));
Expand Down
46 changes: 44 additions & 2 deletions src/core/src/midi_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ MidiActionManager::MidiActionManager() : Object( __class_name )
<< "PLAY/PAUSE_TOGGLE"
<< "STOP"
<< "PAUSE"
<< "RECORD_READY"
<< "RECORD/STROBE_TOGGLE"
<< "RECORD_STROBE"
<< "RECORD_EXIT"
<< "MUTE"
<< "UNMUTE"
<< "MUTE_TOGGLE"
Expand All @@ -149,8 +153,8 @@ MidiActionManager::MidiActionManager() : Object( __class_name )
<< "EFFECT3_LEVEL_ABSOLUTE"
<< "EFFECT4_LEVEL_ABSOLUTE"
<< "SELECT_NEXT_PATTERN"
<< "SELECT_NEXT_PATTERN_PROMPTLY"
<< "SELECT_AND_PLAY_PATTERN"
<< "SELECT_NEXT_PATTERN_PROMPTLY"
<< "SELECT_AND_PLAY_PATTERN"
<< "PAN_RELATIVE"
<< "PAN_ABSOLUTE"
<< "BEATCOUNTER"
Expand All @@ -167,6 +171,7 @@ MidiActionManager::MidiActionManager() : Object( __class_name )
<< "MMC_REWIND"
<< "MMC_RECORD_STROBE"
<< "MMC_RECORD_EXIT"
<< "MMC_RECORD_READY"
<< "MMC_PAUSE"
<< "NOTE"
<< "CC";
Expand Down Expand Up @@ -688,6 +693,43 @@ bool MidiActionManager::handleAction( MidiAction * pAction ){
}
return true;
}

if( sActionString == "RECORD_READY"){
if ( pEngine->getState() != STATE_PLAYING ) {
if (!Preferences::get_instance()->getRecordEvents()) {
Preferences::get_instance()->setRecordEvents(true);
}
else {
Preferences::get_instance()->setRecordEvents(false);
}
}
return true;
}
if( sActionString == "RECORD/STROBE_TOGGLE"){
if (!Preferences::get_instance()->getRecordEvents()) {
Preferences::get_instance()->setRecordEvents(true);
}
else {
Preferences::get_instance()->setRecordEvents(false);
}
return true;
}

if( sActionString == "RECORD_STROBE"){

if (!Preferences::get_instance()->getRecordEvents()) {
Preferences::get_instance()->setRecordEvents(true);
}
return true;
}

if( sActionString == "RECORD_EXIT"){

if (Preferences::get_instance()->getRecordEvents()) {
Preferences::get_instance()->setRecordEvents(false);
}
return true;
}

return false;
}
4 changes: 3 additions & 1 deletion src/gui/src/PlayerControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ PlayerControl::PlayerControl(QWidget *parent)
m_pRecBtn->setToolTip( trUtf8("Record") );
connect(m_pRecBtn, SIGNAL(clicked(Button*)), this, SLOT(recBtnClicked(Button*)));
connect(m_pRecBtn, SIGNAL(rightClicked(Button*)), this, SLOT(recBtnRightClicked(Button*)));
MidiAction* pAction = new MidiAction("RECORD_READY");
m_pRecBtn->setAction( pAction );


// Record+delete button
Expand Down Expand Up @@ -145,7 +147,7 @@ PlayerControl::PlayerControl(QWidget *parent)
m_pPlayBtn->setPressed(false);
m_pPlayBtn->setToolTip( trUtf8("Play/ Pause") );
connect(m_pPlayBtn, SIGNAL(clicked(Button*)), this, SLOT(playBtnClicked(Button*)));
MidiAction* pAction = new MidiAction("PLAY");
pAction = new MidiAction("PLAY");
m_pPlayBtn->setAction( pAction );


Expand Down

0 comments on commit 681c9cf

Please sign in to comment.