Changeset 597
- Timestamp:
- 10/26/08 21:30:33 (2 months ago)
- Files:
-
- branches/new_fx_rack_and_sample_fun/gui/src/MainForm.cpp (modified) (1 diff)
- branches/new_fx_rack_and_sample_fun/gui/src/PatternEditor/PatternEditorPanel.cpp (modified) (2 diffs)
- branches/new_fx_rack_and_sample_fun/gui/src/PatternEditor/PatternEditorPanel.h (modified) (1 diff)
- branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/Preferences.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/src/IO/midi_input.cpp (modified) (2 diffs)
- branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/hydrogen.cpp (modified) (4 diffs)
- branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/preferences.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/new_fx_rack_and_sample_fun/gui/src/MainForm.cpp
r570 r597 1372 1372 float pan_R = 1.0; 1373 1373 1374 engine->addRealtimeNote (row, velocity, pan_L, pan_R );1374 engine->addRealtimeNote (row, velocity, pan_L, pan_R, NULL, NULL, NULL , row + 36); 1375 1375 1376 1376 return TRUE; // eat event branches/new_fx_rack_and_sample_fun/gui/src/PatternEditor/PatternEditorPanel.cpp
r593 r597 202 202 // editor_top_hbox_2->addWidget( pZoom ); 203 203 204 QComboBox *selInstrument = new QComboBox( NULL ); 205 selInstrument->setFixedSize( 170, 20 ); 206 selInstrument->move( 2, 1 ); 207 selInstrument->addItem ( QString( "keyb: play drumset" )); 208 selInstrument->addItem ( QString( "keyb: play instrument" )); 209 editor_top_hbox_2->addWidget( selInstrument ); 210 connect( selInstrument, SIGNAL( currentIndexChanged( QString ) ), this, SLOT( playselectedinstrument(QString) ) ); 211 204 212 // zoom-in btn 205 213 Button *zoom_in_btn = new Button( … … 1015 1023 } 1016 1024 } 1025 1026 1027 void PatternEditorPanel::playselectedinstrument( QString text ) 1028 { 1029 if ( text == "keyb: play drumset" ){ 1030 Preferences::getInstance()->__playselectedinstrument = false; 1031 }else 1032 { 1033 Preferences::getInstance()->__playselectedinstrument = true; 1034 } 1035 } branches/new_fx_rack_and_sample_fun/gui/src/PatternEditor/PatternEditorPanel.h
r593 r597 97 97 void moveUpBtnClicked(Button *); 98 98 99 void playselectedinstrument( QString text ); 100 99 101 private: 100 102 H2Core::Pattern *m_pPattern; branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/Preferences.h
r582 r597 149 149 bool __playsamplesonclicking; // audio file browser 150 150 151 bool __playselectedinstrument; 152 151 153 bool m_bFollowPlayhead; 152 154 branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/hydrogen.h
r596 r597 80 80 void removeSong(); 81 81 82 void addRealtimeNote ( int instrument, float velocity, float pan_L=1.0, float pan_R=1.0, float pitch=0.0, bool noteoff=false, bool forcePlay=false );82 void addRealtimeNote ( int instrument, float velocity, float pan_L=1.0, float pan_R=1.0, float pitch=0.0, bool noteoff=false, bool forcePlay=false, int msg1=0 ); 83 83 84 84 float getMasterPeak_L(); branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/IO/midi_input.cpp
r596 r597 188 188 return; 189 189 } 190 191 192 193 190 194 191 … … 213 210 } 214 211 215 pEngine->addRealtimeNote( nInstrument, fVelocity, fPan_L, fPan_R, 0.0, false, true );212 pEngine->addRealtimeNote( nInstrument, fVelocity, fPan_L, fPan_R, 0.0, false, true, nNote ); 216 213 } 217 214 } branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/hydrogen.cpp
r596 r597 1814 1814 float pitch, 1815 1815 bool noteOff, 1816 bool forcePlay ) 1816 bool forcePlay, 1817 int msg1 ) 1817 1818 { 1818 1819 UNUSED( pitch ); … … 1827 1828 AudioEngine::get_instance()->lock( "Hydrogen::addRealtimeNote" ); 1828 1829 1830 1829 1831 Song *song = getSong(); 1830 if ( instrument >= ( int )song->get_instrument_list()->get_size() ) { 1831 // unused instrument 1832 AudioEngine::get_instance()->unlock(); 1833 return; 1832 if ( !pref->__playselectedinstrument ){ 1833 if ( instrument >= ( int )song->get_instrument_list()->get_size() ) { 1834 // unused instrument 1835 AudioEngine::get_instance()->unlock(); 1836 return; 1837 } 1834 1838 } 1835 1839 … … 1866 1870 unsigned position = column; 1867 1871 m_naddrealtimenotetickposition = column; 1868 1872 1869 1873 1870 1874 Instrument *instrRef = 0; … … 1907 1911 } 1908 1912 } else { 1909 // create the new note 1910 Note *note = new Note( instrRef, 1911 position, 1912 velocity, 1913 pan_L, 1914 pan_R, 1915 -1, 1916 0 ); 1917 currentPattern->note_map.insert( 1918 std::make_pair( column, note ) 1919 ); 1920 /* 1921 if ( noteOff ) { 1922 note->set_noteoff( true ); 1923 note->set_lenght( 1 ); 1924 } 1925 */ 1926 // hear note if its not in the future 1927 if ( pref->getHearNewNotes() 1928 && position <= getTickPosition() ) { 1929 hearnote = true; 1930 } 1931 1932 song->__is_modified = true; 1933 1934 EventQueue::get_instance()->push_event( EVENT_PATTERN_MODIFIED, -1 ); 1913 if ( !pref->__playselectedinstrument ){ 1914 // create the new note 1915 Note *note = new Note( instrRef, 1916 position, 1917 velocity, 1918 pan_L, 1919 pan_R, 1920 -1, 1921 0 ); 1922 currentPattern->note_map.insert( 1923 std::make_pair( column, note ) 1924 ); 1925 /* 1926 if ( noteOff ) { 1927 note->set_noteoff( true ); 1928 note->set_lenght( 1 ); 1929 } 1930 */ 1931 // hear note if its not in the future 1932 if ( pref->getHearNewNotes() 1933 && position <= getTickPosition() ) { 1934 hearnote = true; 1935 } 1936 1937 song->__is_modified = true; 1938 1939 EventQueue::get_instance()->push_event( EVENT_PATTERN_MODIFIED, -1 ); 1940 } 1941 else if ( pref->__playselectedinstrument ){ 1942 1943 Note *note = new Note( song->get_instrument_list()->get( getSelectedInstrumentNumber()), 1944 position, 1945 velocity, 1946 pan_L, 1947 pan_R, 1948 -1, 1949 0 ); 1950 1951 int divider = msg1 / 12; 1952 int octave = divider -3; 1953 int notehigh = msg1 - (12 * divider); 1954 note->m_noteKey.m_nOctave = octave; 1955 if ( notehigh == 0) note->m_noteKey.m_key = H2Core::NoteKey::C; 1956 else if ( notehigh == 1 ) note->m_noteKey.m_key = H2Core::NoteKey::Cs; 1957 else if ( notehigh == 2 ) note->m_noteKey.m_key = H2Core::NoteKey::D; 1958 else if ( notehigh == 3 ) note->m_noteKey.m_key = H2Core::NoteKey::Ef; 1959 else if ( notehigh == 4 ) note->m_noteKey.m_key = H2Core::NoteKey::E; 1960 else if ( notehigh == 5 ) note->m_noteKey.m_key = H2Core::NoteKey::F; 1961 else if ( notehigh == 6 ) note->m_noteKey.m_key = H2Core::NoteKey::Fs; 1962 else if ( notehigh == 7 ) note->m_noteKey.m_key = H2Core::NoteKey::G; 1963 else if ( notehigh == 8 ) note->m_noteKey.m_key = H2Core::NoteKey::Af; 1964 else if ( notehigh == 9 ) note->m_noteKey.m_key = H2Core::NoteKey::A; 1965 else if ( notehigh == 10 ) note->m_noteKey.m_key = H2Core::NoteKey::Bf; 1966 else if ( notehigh == 11 ) note->m_noteKey.m_key = H2Core::NoteKey::B; 1967 1968 currentPattern->note_map.insert( 1969 std::make_pair( column, note ) 1970 ); 1971 1972 // hear note if its not in the future 1973 if ( pref->getHearNewNotes() 1974 && position <= getTickPosition() ) { 1975 hearnote = true; 1976 } 1977 1978 song->__is_modified = true; 1979 1980 EventQueue::get_instance()->push_event( EVENT_PATTERN_MODIFIED, -1 ); 1981 } 1935 1982 } 1936 1983 } else if ( pref->getHearNewNotes() ) { 1937 1984 hearnote = true; 1938 1985 } 1939 1940 if ( hearnote && instrRef ) { 1941 Note *note2 = new Note( instrRef, 1942 realcolumn, 1943 velocity, 1944 pan_L, 1945 pan_R, 1946 -1, 1947 0 ); 1948 midi_noteOn( note2 ); 1949 } 1986 1987 if ( !pref->__playselectedinstrument ){ 1988 if ( hearnote && instrRef ) { 1989 Note *note2 = new Note( instrRef, 1990 realcolumn, 1991 velocity, 1992 pan_L, 1993 pan_R, 1994 -1, 1995 0 ); 1996 midi_noteOn( note2 ); 1997 } 1998 }else 1999 { 2000 if ( hearnote ) { 2001 Note *note2 = new Note( song->get_instrument_list()->get( getSelectedInstrumentNumber()), 2002 realcolumn, 2003 velocity, 2004 pan_L, 2005 pan_R, 2006 -1, 2007 0 ); 2008 2009 int divider = msg1 / 12; 2010 int octave = divider -3; 2011 int notehigh = msg1 - (12 * divider); 2012 2013 ERRORLOG( QString( "octave: %1, note: %2, instrument %3" ).arg( octave ).arg(notehigh).arg(instrument)); 2014 note2->m_noteKey.m_nOctave = octave; 2015 if ( notehigh == 0) note2->m_noteKey.m_key = H2Core::NoteKey::C; 2016 else if ( notehigh == 1 ) note2->m_noteKey.m_key = H2Core::NoteKey::Cs; 2017 else if ( notehigh == 2 ) note2->m_noteKey.m_key = H2Core::NoteKey::D; 2018 else if ( notehigh == 3 ) note2->m_noteKey.m_key = H2Core::NoteKey::Ef; 2019 else if ( notehigh == 4 ) note2->m_noteKey.m_key = H2Core::NoteKey::E; 2020 else if ( notehigh == 5 ) note2->m_noteKey.m_key = H2Core::NoteKey::F; 2021 else if ( notehigh == 6 ) note2->m_noteKey.m_key = H2Core::NoteKey::Fs; 2022 else if ( notehigh == 7 ) note2->m_noteKey.m_key = H2Core::NoteKey::G; 2023 else if ( notehigh == 8 ) note2->m_noteKey.m_key = H2Core::NoteKey::Af; 2024 else if ( notehigh == 9 ) note2->m_noteKey.m_key = H2Core::NoteKey::A; 2025 else if ( notehigh == 10 ) note2->m_noteKey.m_key = H2Core::NoteKey::Bf; 2026 else if ( notehigh == 11 ) note2->m_noteKey.m_key = H2Core::NoteKey::B; 2027 2028 midi_noteOn( note2 ); 2029 } 2030 2031 } 2032 1950 2033 1951 2034 AudioEngine::get_instance()->unlock(); // unlock the audio engine branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/preferences.cpp
r582 r597 128 128 __lastsampleDirectory = QDir::homePath(); //audio file browser 129 129 __playsamplesonclicking = false; // audio file browser 130 __playselectedinstrument = false; // midi keyboard and keyboard play only selected instrument 130 131 131 132 loadPreferences( true ); // Global settings
