Changeset 549
- Timestamp:
- 10/07/08 22:07:02 (2 months ago)
- Files:
-
- branches/midiAutosense/gui/src/widgets/midiTable.cpp (modified) (4 diffs)
- branches/midiAutosense/libs/hydrogen/include/hydrogen/action.h (modified) (1 diff)
- branches/midiAutosense/libs/hydrogen/src/IO/midi_input.cpp (modified) (2 diffs)
- branches/midiAutosense/libs/hydrogen/src/action.cpp (modified) (6 diffs)
- branches/midiAutosense/libs/hydrogen/src/preferences.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/midiAutosense/gui/src/widgets/midiTable.cpp
r548 r549 204 204 int actionParameterInteger = 0; 205 205 206 if( pAction->getParameterList().size() != 0 ){ 207 actionParameter = pAction->getParameterList().at(0); 208 actionParameterInteger = actionParameter.toInt(&ok,10); 209 } 206 actionParameter = pAction->getParameter1(); 207 actionParameterInteger = actionParameter.toInt(&ok,10); 208 210 209 211 210 insertNewRow(pAction->getType() , dIter->first , 0 , actionParameterInteger ); … … 218 217 int actionParameterInteger = 0; 219 218 220 if( pAction->getParameterList().size() != 0 ){ 221 actionParameter = pAction->getParameterList().at(0); 222 actionParameterInteger = actionParameter.toInt(&ok,10); 223 } 219 actionParameter = pAction->getParameter1(); 220 actionParameterInteger = actionParameter.toInt(&ok,10); 224 221 225 222 if ( pAction->getType() == "NOTHING" ) continue; … … 234 231 int actionParameterInteger = 0; 235 232 236 if( pAction->getParameterList().size() != 0 ){ 237 actionParameter = pAction->getParameterList().at(0); 238 actionParameterInteger = actionParameter.toInt(&ok,10); 239 } 233 actionParameter = pAction->getParameter1(); 234 actionParameterInteger = actionParameter.toInt(&ok,10); 240 235 241 236 if ( pAction->getType() == "NOTHING" ) continue; … … 283 278 284 279 if( actionSpinner->cleanText() != ""){ 285 pAction-> addParameter( actionSpinner->cleanText() );280 pAction->setParameter1( actionSpinner->cleanText() ); 286 281 } 287 282 branches/midiAutosense/libs/hydrogen/include/hydrogen/action.h
r173 r549 34 34 35 35 QString getType(); 36 QStringList getParameterList(); 37 void addParameter( QString ); 36 37 void setParameter1( QString ); 38 void setParameter2( QString ); 39 40 QString getParameter1(); 41 QString getParameter2(); 38 42 39 43 private: 40 44 QString type; 41 QStringList parameterList; 45 QString parameter1; 46 QString parameter2; 42 47 }; 43 48 branches/midiAutosense/libs/hydrogen/src/IO/midi_input.cpp
r548 r549 131 131 void MidiInput::handleControlChangeMessage( const MidiMessage& msg ) 132 132 { 133 INFOLOG( QString( "[handleMidiMessage] CONTROL_CHANGE Parameter: %1, Value: %2" ).arg( msg.m_nData1 ).arg( msg.m_nData2 ) );133 //INFOLOG( QString( "[handleMidiMessage] CONTROL_CHANGE Parameter: %1, Value: %2" ).arg( msg.m_nData1 ).arg( msg.m_nData2 ) ); 134 134 135 135 Hydrogen *pEngine = Hydrogen::get_instance(); … … 137 137 midiMap * mM = midiMap::getInstance(); 138 138 139 bool action = aH->handleAction( mM->getCCAction( msg.m_nData1 ) ); 139 action * pAction; 140 141 pAction = mM->getCCAction( msg.m_nData1 ); 142 pAction->setParameter2( QString::number( msg.m_nData2 ) ); 143 144 aH->handleAction( pAction ); 140 145 141 146 pEngine->lastMidiEvent = "CC"; branches/midiAutosense/libs/hydrogen/src/action.cpp
r548 r549 41 41 } 42 42 43 QStringList action::getParameterList(){ 44 return parameterList; 45 } 46 47 void action::addParameter( QString param ){ 48 parameterList.append( param ); 43 44 45 void action::setParameter1( QString text ){ 46 parameter1 = text; 47 } 48 49 void action::setParameter2( QString text ){ 50 parameter2 = text; 51 } 52 53 QString action::getParameter1(){ 54 return parameter1; 55 } 56 57 QString action::getParameter2(){ 58 return parameter2; 49 59 } 50 60 51 61 action::action( QString s ) : Object( "action" ) { 52 62 type = s; 53 QStringList parameterList; 63 QString parameter1 = "0"; 64 QString parameter2 = "0" ; 54 65 } 55 66 … … 70 81 << "BPM_INCR" 71 82 << "BPM_DECR" 83 << "BPM_CC_RELATIVE" 72 84 << "BEATCOUNTER" 73 85 << "TAP_TEMPO"; … … 192 204 193 205 206 if( sActionString == "BPM_CC_RELATIVE" ){ 207 AudioEngine::get_instance()->lock( "Action::BPM_CC_RELATIVE" ); 208 209 int mult = 1; 210 211 //second parameter of cc command 212 //this value should be 1 to decrement and something other then 1 to increment the bpm 213 int cc_param = 1; 214 215 //this action should be triggered only by CC commands 216 217 bool ok; 218 mult = pAction->getParameter1().toInt(&ok,10); 219 cc_param = pAction->getParameter2().toInt(&ok,10); 220 221 222 223 Song* pSong = pEngine->getSong(); 224 225 226 227 if ( cc_param == 1 && pSong->__bpm < 300) { 228 pEngine->setBPM( pSong->__bpm + 1*mult ); 229 } 230 231 232 if ( cc_param != 1 && pSong->__bpm > 40 ) { 233 pEngine->setBPM( pSong->__bpm - 1*mult ); 234 } 235 236 237 AudioEngine::get_instance()->unlock(); 238 239 return true; 240 } 241 242 194 243 if( sActionString == "BPM_INCR" ){ 195 244 AudioEngine::get_instance()->lock( "Action::BPM_INCR" ); … … 197 246 int mult = 1; 198 247 199 if( pAction->getParameterList().size() > 0){ 200 bool ok; 201 mult = pAction->getParameterList().at(0).toInt(&ok,10); 202 } 248 bool ok; 249 mult = pAction->getParameter1().toInt(&ok,10); 203 250 204 251 … … 212 259 } 213 260 261 262 214 263 if( sActionString == "BPM_DECR" ){ 215 264 AudioEngine::get_instance()->lock( "Action::BPM_DECR" ); … … 217 266 int mult = 1; 218 267 219 if( pAction->getParameterList().size() > 0){ 220 bool ok; 221 mult = pAction->getParameterList().at(0).toInt(&ok,10); 222 } 268 bool ok; 269 mult = pAction->getParameter1().toInt(&ok,10); 223 270 224 271 Song* pSong = pEngine->getSong(); branches/midiAutosense/libs/hydrogen/src/preferences.cpp
r548 r549 480 480 action * pAction = new action( s_action ); 481 481 482 pAction-> addParameter( s_param );482 pAction->setParameter1( s_param ); 483 483 484 484 mM->registerMMCEvent( event, pAction ); … … 498 498 action * pAction = new action( s_action ); 499 499 500 pAction-> addParameter( s_param );500 pAction->setParameter1( s_param ); 501 501 502 502 mM->registerNoteEvent( s_eventParameter.toInt(), pAction ); … … 514 514 action * pAction = new action( s_action ); 515 515 516 pAction-> addParameter( s_param );516 pAction->setParameter1( s_param ); 517 517 518 518 mM->registerCCEvent( s_eventParameter.toInt(), pAction ); … … 832 832 LocalFileMng::writeXmlString( &midiEventNode, "action" , pAction->getType()); 833 833 834 if ( pAction->getParameterList().size() != 0 ){835 LocalFileMng::writeXmlString( &midiEventNode, "parameter" , pAction->getParameterList().at(0) );836 }834 835 LocalFileMng::writeXmlString( &midiEventNode, "parameter" , pAction->getParameter1() ); 836 837 837 838 838 midiEventMapNode.InsertEndChild(midiEventNode); … … 853 853 LocalFileMng::writeXmlString( &midiEventNode, "action" , pAction->getType() ); 854 854 855 if ( pAction->getParameterList().size() != 0 ){ 856 LocalFileMng::writeXmlString( &midiEventNode, "parameter" , pAction->getParameterList().at(0) ); 857 } 855 LocalFileMng::writeXmlString( &midiEventNode, "parameter" , pAction->getParameter1() ); 858 856 859 857 midiEventMapNode.InsertEndChild(midiEventNode); … … 873 871 LocalFileMng::writeXmlString( &midiEventNode, "action" , pAction->getType() ); 874 872 875 if ( pAction->getParameterList().size() != 0 ){ 876 LocalFileMng::writeXmlString( &midiEventNode, "parameter" , pAction->getParameterList().at(0) ); 877 } 873 LocalFileMng::writeXmlString( &midiEventNode, "parameter" , pAction->getParameter1() ); 878 874 879 875 midiEventMapNode.InsertEndChild(midiEventNode);
