Changeset 588
- Timestamp:
- 10/22/08 04:20:05 (3 months ago)
- Files:
-
- branches/new_fx_rack_and_sample_fun/gui/src/AudioFileBrowser/AudioFileBrowser.cpp (modified) (2 diffs)
- branches/new_fx_rack_and_sample_fun/gui/src/AudioFileBrowser/AudioFileBrowser.h (modified) (1 diff)
- branches/new_fx_rack_and_sample_fun/gui/src/AudioFileBrowser/AudioFileBrowser_UI.ui (modified) (4 diffs)
- branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/IO/MidiInput.h (modified) (1 diff)
- branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/hydrogen.h (modified) (1 diff)
- branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/sampler/Sampler.h (modified) (1 diff)
- branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/IO/midi_input.cpp (modified) (5 diffs)
- branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/hydrogen.cpp (modified) (2 diffs)
- branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/sampler/sampler.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/new_fx_rack_and_sample_fun/gui/src/AudioFileBrowser/AudioFileBrowser.cpp
r585 r588 100 100 if( ev->modifiers()==Qt::ControlModifier ){ 101 101 tree->setSelectionMode( QAbstractItemView::MultiSelection ); 102 openBTN->setEnabled( true ); 102 103 } 103 104 … … 350 351 tree->collapse( model->index( updir ) ); 351 352 } 353 354 355 356 void AudioFileBrowser::on_hiddenCB_clicked() 357 { 358 if ( hiddenCB->isChecked() ){ 359 model->setFilter( QDir::AllDirs | QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden ); 360 }else 361 { 362 model->setFilter( QDir::AllDirs | QDir::AllEntries | QDir::NoDotAndDotDot ); 363 tree->setRootIndex( model->index( pathLineEdit->text() ) ); 364 } 365 } branches/new_fx_rack_and_sample_fun/gui/src/AudioFileBrowser/AudioFileBrowser.h
r585 r588 62 62 void on_m_pPathUptoolButton_clicked(); 63 63 void on_playSamplescheckBox_clicked(); 64 void on_hiddenCB_clicked(); 64 65 65 66 virtual void keyPressEvent (QKeyEvent *ev); branches/new_fx_rack_and_sample_fun/gui/src/AudioFileBrowser/AudioFileBrowser_UI.ui
r570 r588 90 90 <x>10</x> 91 91 <y>530</y> 92 <width>2 71</width>92 <width>216</width> 93 93 <height>21</height> 94 94 </rect> … … 110 110 <item> 111 111 <widget class="QLineEdit" name="pathLineEdit" /> 112 </item> 113 <item> 114 <widget class="QRadioButton" name="hiddenCB" > 115 <property name="toolTip" > 116 <string>View hidden folders</string> 117 </property> 118 <property name="text" > 119 <string/> 120 </property> 121 </widget> 112 122 </item> 113 123 <item> … … 231 241 <tabstops> 232 242 <tabstop>pathLineEdit</tabstop> 243 <tabstop>hiddenCB</tabstop> 233 244 <tabstop>m_pPathUptoolButton</tabstop> 234 245 <tabstop>m_pPathHometoolButton</tabstop> … … 239 250 <tabstop>useNameCheckBox</tabstop> 240 251 <tabstop>playSamplescheckBox</tabstop> 252 <tabstop>autoVelCheckBox</tabstop> 241 253 <tabstop>openBTN</tabstop> 242 254 <tabstop>cancelBTN</tabstop> branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/IO/MidiInput.h
r581 r588 103 103 104 104 105 private: 106 unsigned long __noteOnTick; 107 unsigned long __noteOffTick; 108 unsigned long computeDeltaNoteOnOfftime(); 109 110 105 111 106 112 }; branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/hydrogen.h
r583 r588 201 201 202 202 void __panic(); 203 int __get_selected_PatterNumber(); 203 204 204 205 branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/sampler/Sampler.h
r583 r588 74 74 void makeTrackOutputQueues(); 75 75 76 bool istInstrumentPlaying( Instrument* instrument);76 void setPlayingNotelenght( Instrument* instrument, unsigned long ticks, unsigned long noteOnTick ); 77 77 78 78 private: branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/IO/midi_input.cpp
r585 r588 152 152 } 153 153 154 155 154 156 void MidiInput::handleNoteOnMessage( const MidiMessage& msg ) 155 157 { … … 181 183 182 184 bool action = aH->handleAction( mM->getNoteAction( msg.m_nData1 ) ); 185 __noteOnTick = pEngine->getTickPosition(); 183 186 184 187 if ( action && Preferences::getInstance()->m_bMidiDiscardNoteAfterAction) … … 228 231 Song *pSong = pEngine->getSong(); 229 232 233 __noteOffTick = pEngine->getTickPosition(); 234 unsigned long notelenght = computeDeltaNoteOnOfftime(); 235 230 236 int nNote = msg.m_nData1; 237 //float fVelocity = msg.m_nData2 / 127.0; //we need this in future to controll release velocity 231 238 int nInstrument = nNote - 36; 232 239 if ( nInstrument < 0 ) { … … 237 244 } 238 245 Instrument *pInstr = pSong->get_instrument_list()->get( nInstrument ); 246 247 if ( pInstr ){ //set the notelength 248 AudioEngine::get_instance()->get_sampler()->setPlayingNotelenght( pInstr, notelenght, __noteOnTick ); 249 } 250 239 251 const unsigned nPosition = 0; 240 252 const float fVelocity = 0.0f; … … 245 257 Note *pNewNote = new Note( pInstr, nPosition, fVelocity, fPan_L, fPan_R, nLenght, fPitch ); 246 258 247 // if ( pInstr && AudioEngine::get_instance()->get_sampler()->istInstrumentPlaying( pInstr ) ){248 // pEngine->addRealtimeNote( nInstrument, fVelocity, fPan_L, fPan_R, 0.0, true, true );249 // }250 259 pEngine->midi_noteOff( pNewNote ); 251 260 252 261 } 253 262 254 263 unsigned long MidiInput::computeDeltaNoteOnOfftime() 264 { 265 unsigned long __notelenghtTicks = __noteOffTick - __noteOnTick; 266 //INFOLOG( QString( "notenlÀnge %1" ).arg( __notelenghtTicks )); 267 return __notelenghtTicks; 268 269 } 255 270 256 271 void MidiInput::handleSysexMessage( const MidiMessage& msg ) branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/hydrogen.cpp
r583 r588 1903 1903 std::make_pair( column, note ) 1904 1904 ); 1905 /* 1905 1906 if ( noteOff ) { 1906 1907 note->set_noteoff( true ); 1907 1908 note->set_lenght( 1 ); 1908 1909 } 1909 1910 */ 1910 1911 // hear note if its not in the future 1911 1912 if ( pref->getHearNewNotes() … … 2948 2949 } 2949 2950 2951 int Hydrogen::__get_selected_PatterNumber() 2952 { 2953 return m_nSelectedPatternNumber; 2954 } 2955 2950 2956 2951 2957 }; branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/sampler/sampler.cpp
r583 r588 37 37 #include <hydrogen/sample.h> 38 38 #include <hydrogen/Song.h> 39 #include <hydrogen/Pattern.h> 40 41 #include "gui/src/HydrogenApp.h" 42 #include "gui/src/PatternEditor/PatternEditorPanel.h" 43 #include "gui/src/PatternEditor/DrumPatternEditor.h" 39 44 40 45 #include <hydrogen/fx/Effects.h> … … 760 765 } 761 766 762 bool Sampler::istInstrumentPlaying( Instrument* instrument ) 763 { 767 768 769 void Sampler::setPlayingNotelenght( Instrument* instrument, unsigned long ticks, unsigned long noteOnTick ) 770 { 771 764 772 if ( instrument ) { // stop all notes using this instrument 765 for ( unsigned i = 0; i < __playing_notes_queue.size(); ) { 766 Note *pNote = __playing_notes_queue[ i ]; 767 assert( pNote ); 768 if ( pNote->get_instrument() == instrument ) { 769 return true; 773 Hydrogen *pEngine = Hydrogen::get_instance(); 774 Song* mSong = pEngine->getSong(); 775 int selectedpattern = pEngine->__get_selected_PatterNumber(); 776 Pattern* currentPattern = NULL; 777 PatternList *pPatternList = mSong->get_pattern_list(); 778 779 if ( ( selectedpattern != -1 ) 780 && ( selectedpattern < ( int )pPatternList->get_size() ) ) { 781 currentPattern = pPatternList->get( selectedpattern ); 782 } 783 784 785 if ( currentPattern ) { 786 int patternsize = currentPattern->get_lenght(); 787 788 for ( unsigned nNote = 0 ; 789 nNote < currentPattern->get_lenght() ; 790 nNote++ ) { 791 std::multimap <int, Note*>::iterator pos; 792 for ( pos = currentPattern->note_map.lower_bound( nNote ) ; 793 pos != currentPattern->note_map.upper_bound( nNote ) ; 794 ++pos ) { 795 Note *pNote = pos->second; 796 if ( pNote!=NULL ) { 797 if ( pNote->get_instrument() == instrument 798 && pNote->get_position() == noteOnTick ) { 799 AudioEngine::get_instance()->lock("Sample::setnotelenght_event"); 800 801 802 if ( ticks > patternsize ) ticks = -1; 803 pNote->set_lenght( ticks ); 804 Hydrogen::get_instance()->getSong()->__is_modified = true; 805 AudioEngine::get_instance()->unlock(); // unlock the audio engine 806 807 } 808 } 809 } 810 } 770 811 } 771 ++i; 772 } 773 } else { 774 return false; 775 } 776 } 777 812 813 } 814 815 HydrogenApp::getInstance()->getPatternEditorPanel()->getDrumPatternEditor()->updateEditor(); 816 817 } 778 818 }; 779 819
