Changeset 166
- Timestamp:
- 05/26/08 23:46:37 (5 years ago)
- Location:
- trunk
- Files:
-
- 5 modified
-
gui/src/PreferencesDialog.cpp (modified) (5 diffs)
-
libs/hydrogen/include/hydrogen/action.h (modified) (1 diff)
-
libs/hydrogen/src/IO/midi_input.cpp (modified) (2 diffs)
-
libs/hydrogen/src/action.cpp (modified) (5 diffs)
-
libs/hydrogen/src/preferences.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/src/PreferencesDialog.cpp
r159 r166 389 389 390 390 391 391 392 void PreferencesDialog::setupMidiTable() 392 393 { … … 446 447 447 448 QString actionParameter; 448 if( pAction->getParameterList().size() != 0){449 if( pAction->getParameterList().size() != 0 ){ 449 450 actionParameter = pAction->getParameterList().at(0); 450 451 } … … 457 458 tableWidget->setCellWidget( rowCount , 3, actionParameterSpinner ); 458 459 rowCount++; 460 } 461 462 for( int note = 0; note < 128; note++ ){ 463 464 QString eventString = "NOTE"; 465 466 action * pAction = mM->getNoteAction( note ); 467 if( pAction->getType() != "NOTHING" ){ 468 cout << note << pAction << endl; 469 470 tableWidget->insertRow( tableWidget->rowCount() ); 471 QComboBox *eventBox = new QComboBox(); 472 eventBox->insertItems( rowCount , aH->getEventList() ); 473 eventBox->setCurrentIndex( eventBox->findText(eventString) ); 474 tableWidget->setCellWidget( rowCount, 0, eventBox ); 475 476 QSpinBox *eventParameterSpinner = new QSpinBox(); 477 tableWidget->setCellWidget( rowCount , 1, eventParameterSpinner ); 478 eventParameterSpinner->setValue( note ); 479 480 QComboBox *actionBox = new QComboBox(); 481 actionBox->insertItems(rowCount,aH->getActionList()); 482 actionBox->setCurrentIndex ( actionBox->findText(pAction->getType() ) ); 483 tableWidget->setCellWidget( rowCount , 2, actionBox ); 484 485 486 QString actionParameter; 487 QSpinBox *actionParameterSpinner = new QSpinBox(); 488 489 if( pAction->getParameterList().size() > 0 ){ 490 actionParameter = pAction->getParameterList().at(0); 491 bool ok; 492 actionParameterSpinner->setValue( actionParameter.toInt(&ok,10) ); 493 } 494 495 tableWidget->setCellWidget( rowCount , 3, actionParameterSpinner ); 496 rowCount++; 497 } 459 498 } 460 499 … … 490 529 QComboBox * eventCombo = dynamic_cast <QComboBox *> ( tableWidget->cellWidget( row, 0 ) ); 491 530 531 QSpinBox * eventSpinner = dynamic_cast <QSpinBox *> ( tableWidget->cellWidget( row, 1 ) ); 532 492 533 QComboBox * actionCombo = dynamic_cast <QComboBox *> ( tableWidget->cellWidget( row, 2 ) ); 493 534 494 535 QSpinBox * actionSpinner = dynamic_cast <QSpinBox *> ( tableWidget->cellWidget( row, 3 ) ); 536 537 495 538 496 539 QString eventString; 497 540 QString actionString; 541 498 542 499 543 if( eventCombo->currentText() != "" && actionCombo->currentText() != "" ){ … … 508 552 } 509 553 510 mM->registerMMCEvent( eventString , pAction ); 554 if( eventString.left(3) == "MMC" ){ 555 mM->registerMMCEvent( eventString , pAction ); 556 } 557 558 if( eventString.left(4) == "NOTE" ){ 559 mM->registerNoteEvent( eventSpinner->cleanText().toInt() , pAction ); 560 cout << "register " << eventSpinner->value() << endl; 561 } 511 562 } 512 563 } -
trunk/libs/hydrogen/include/hydrogen/action.h
r158 r166 53 53 54 54 void registerMMCEvent( QString,action * ); 55 void registerNoteEvent( int , action * ); 56 57 map <QString , action *> getMMCMap(); 55 58 56 59 action * getMMCAction( QString ); 60 action * getNoteAction( int note ); 61 62 void setupNoteArray(); 57 63 58 map <QString , action *> getMMCMap(); 64 65 66 private: 67 68 action * noteArray[128]; 59 69 map <QString , action *> mmcMap; 60 70 }; -
trunk/libs/hydrogen/src/IO/midi_input.cpp
r146 r166 37 37 { 38 38 //INFOLOG( "INIT" ); 39 39 40 } 40 41 … … 132 133 { 133 134 INFOLOG( "handleNoteOnMessage" ); 135 136 actionManager * aH = actionManager::getInstance(); 137 midiMap * mM = midiMap::getInstance(); 138 139 aH->handleAction( mM->getNoteAction( msg.m_nData1 ) ); 134 140 135 141 int nMidiChannelFilter = Preferences::getInstance()->m_nMidiChannelFilter; -
trunk/libs/hydrogen/src/action.cpp
r159 r166 61 61 { 62 62 //constructor 63 for(int note = 0; note < 128; note++ ){ 64 noteArray[ note ] = new action("NOTHING"); 65 } 63 66 } 64 67 … … 66 69 { 67 70 std::map< QString , action *>::iterator dIter(mmcMap.begin()); 71 68 72 for( dIter = mmcMap.begin(); dIter != mmcMap.end(); dIter++ ) 69 73 { 70 74 delete dIter->second; 71 75 } 76 77 for(int i = 0; i < 128; i++){ 78 delete noteArray[i]; 79 } 80 72 81 instance = NULL; 73 82 } … … 88 97 } 89 98 99 void midiMap::registerNoteEvent( int note , action * pAction ){ 100 101 if( note >= 0 && note < 128 ){ 102 delete noteArray[ note ]; 103 noteArray[ note ] = pAction; 104 } 105 } 90 106 91 107 action * midiMap::getMMCAction( QString eventString ){ … … 100 116 } 101 117 102 118 action * midiMap::getNoteAction( int note ){ 119 return noteArray[ note ]; 120 } 103 121 104 122 … … 127 145 << "MMC_RECORD_STROBE" 128 146 << "MMC_RECORD_EXIT" 129 << "MMC_PAUSE"; 147 << "MMC_PAUSE" 148 << "NOTE"; 130 149 } 131 150 -
trunk/libs/hydrogen/src/preferences.cpp
r159 r166 421 421 422 422 } 423 424 425 if( pMidiEventNode->FirstChild()->Value() == QString("noteEvent")){ 426 QString event = pMidiEventNode->FirstChild("noteEvent")->FirstChild()->Value(); 427 428 QString s_action = pMidiEventNode->FirstChild("action")->FirstChild()->Value(); 429 430 //QString s_param = pMidiEventNode->FirstChild("parameter")->FirstChild()->Value(); 431 432 QString s_eventParameter = pMidiEventNode->FirstChild("eventParameter")->FirstChild()->Value(); 433 434 action * pAction = new action( s_action ); 435 436 437 //pAction->addParameter( s_param ); 438 439 mM->registerNoteEvent(s_eventParameter.toInt(), pAction); 440 } 423 441 } 424 442 } else { … … 643 661 { 644 662 645 std::map< QString , action *>::iterator dIter( mmcMap.begin());663 std::map< QString , action *>::iterator dIter( mmcMap.begin() ); 646 664 for( dIter = mmcMap.begin(); dIter != mmcMap.end(); dIter++ ){ 647 665 … … 665 683 midiEventMapNode.InsertEndChild(midiEventNode); 666 684 685 } 686 } 687 688 for( int note=0; note < 128; note++ ){ 689 action * pAction = mM->getNoteAction( note ); 690 if( pAction != NULL && pAction->getType() != "NOTHING") 691 { 692 TiXmlElement midiEventNode( "midiEvent" ); 693 694 LocalFileMng::writeXmlString( &midiEventNode, "noteEvent" , QString("NOTE") ); 695 LocalFileMng::writeXmlString( &midiEventNode, "eventParameter" , QString::number( note ) ); 696 697 LocalFileMng::writeXmlString( &midiEventNode, "action" , pAction->getType() ); 698 699 if ( pAction->getParameterList().size() != 0 ){ 700 LocalFileMng::writeXmlString( &midiEventNode, "parameter" , pAction->getParameterList().at(0) ); 701 } 702 703 midiEventMapNode.InsertEndChild(midiEventNode); 667 704 } 668 705 }