diff --git a/ChangeLog b/ChangeLog index b0d22f67c..efc62a186 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2005-12-06 Tobias Doerffel + + * src/core/note_play_handle.cpp: + * src/core/piano_roll.cpp: + * src/core/piano_widget.cpp: + * src/tracks/channel_track.cpp: + moved output-MIDI-event-generation-code from channel-track to + note-play-handles for covering arpeggio/chords and having exactly + timed events - makes it now possible to control other MIDI-based + synths etc. from patterns (which was not possible before because + of a small bug) - will drop MIDI-out-plugin very soon as it isn't + needed anymore + +2005-12-05 Tobias Doerffel + + * include/piano_roll.h: + * src/core/piano_roll.cpp: + - when moving mouse draw a bar at current key + - re-enabled mouse-tracking for cursor-changes when mouse is over tail + of note etc. + + * resources/zoom.png: + * src/core/song_editor.cpp: + * src/core/piano_roll.cpp: + added small zoom-icon to zoom-combobox + 2005-12-04 Tobias Doerffel * include/midi_alsa_raw.h: diff --git a/TODO b/TODO index 8b182ad42..dca5ad360 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,8 @@ to be done as soon as possible: +- fix midi-channel-selection stuff and add possibility to select destination-MIDI-port inside LMMS - add note-len- and note-alignment-selectbox to piano-roll - make it possible in bb-editor to add single beats to beat-patterns -- MIDI/note-debug!! - select connected midi-device in midi-setup-tabwidget - fix audio/midi-settings stuff/translation - arpeggio: send midi-out-events via channel-track diff --git a/configure.in b/configure.in index bd9e3935f..10cd208db 100644 --- a/configure.in +++ b/configure.in @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) -AC_INIT(lmms, 0.1.1-cvs20051204, tobydox/at/users.sourceforge.net) -AM_INIT_AUTOMAKE(lmms, 0.1.1-cvs20051204) +AC_INIT(lmms, 0.1.1-cvs20051206, tobydox/at/users.sourceforge.net) +AM_INIT_AUTOMAKE(lmms, 0.1.1-cvs20051206) AM_CONFIG_HEADER(config.h) diff --git a/include/piano_roll.h b/include/piano_roll.h index dc1328489..e1de9538d 100644 --- a/include/piano_roll.h +++ b/include/piano_roll.h @@ -215,7 +215,7 @@ private: bool m_controlPressed; int m_startKey; // first key when drawing - + int m_keyMouseOver; int m_lastKey; noteVector m_notesToCopy; diff --git a/resources/zoom.png b/resources/zoom.png new file mode 100644 index 000000000..8dbfc51eb Binary files /dev/null and b/resources/zoom.png differ diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index 51214479e..60dd3ca74 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -29,6 +29,9 @@ #include "note_play_handle.h" #include "channel_track.h" #include "envelope_tab_widget.h" +#include "midi.h" +#include "midi_port.h" +#include "song_editor.h" notePlayHandle::notePlayHandle( channelTrack * _chnl_trk, Uint32 _frames_ahead, @@ -50,6 +53,15 @@ notePlayHandle::notePlayHandle( channelTrack * _chnl_trk, Uint32 _frames_ahead, m_muted( FALSE ) { setFrames( _frames ); + // send MIDI-note-on-event + m_channelTrack->processOutEvent( midiEvent( NOTE_ON, + m_channelTrack->m_midiPort->outputChannel(), + key(), + (Uint16) ( ( getVolume() / 100.0f ) * + ( m_channelTrack->getVolume() / 100.0f ) * + 127 ) ), + midiTime::fromFrames( m_framesAhead, + songEditor::inst()->framesPerTact() ) ); } @@ -57,6 +69,11 @@ notePlayHandle::notePlayHandle( channelTrack * _chnl_trk, Uint32 _frames_ahead, notePlayHandle::~notePlayHandle() { + if( m_released == FALSE ) + { + noteOff( 0 ); + } + if( m_channelTrack != NULL ) { m_channelTrack->deleteNotePluginData( this ); @@ -205,6 +222,13 @@ void notePlayHandle::noteOff( Uint32 _s ) { m_releaseFramesToDo = m_channelTrack->m_envWidget->releaseFrames(); + // send MIDI-note-off-event + m_channelTrack->processOutEvent( midiEvent( NOTE_OFF, + m_channelTrack->m_midiPort->outputChannel(), + key(), 0 ), + midiTime::fromFrames( + m_framesBeforeRelease, + songEditor::inst()->framesPerTact() ) ); } else { diff --git a/src/core/piano_roll.cpp b/src/core/piano_roll.cpp index fe2a85bf4..cf115a011 100644 --- a/src/core/piano_roll.cpp +++ b/src/core/piano_roll.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #else @@ -43,6 +44,7 @@ #include #include #include +#include #define setChecked setOn @@ -141,6 +143,7 @@ pianoRoll::pianoRoll( void ) : m_shiftPressed( FALSE ), m_controlPressed( FALSE ), m_startKey( INITIAL_START_KEY ), + m_keyMouseOver( INITIAL_START_KEY ), m_lastKey( 0 ), m_editMode( DRAW ), m_scrollBack( FALSE ) @@ -376,6 +379,8 @@ pianoRoll::pianoRoll( void ) : + QLabel * zoom_lbl = new QLabel( m_toolBar ); + zoom_lbl->setPixmap( embed::getIconPixmap( "zoom" ) ); // setup zooming-stuff m_zoomingComboBox = new QComboBox( m_toolBar ); @@ -407,7 +412,9 @@ pianoRoll::pianoRoll( void ) : tb_layout->addWidget( m_pasteButton ); tb_layout->addSpacing( 10 ); m_timeLine->addToolButtons( m_toolBar ); - tb_layout->addSpacing( 10 ); + tb_layout->addSpacing( 15 ); + tb_layout->addWidget( zoom_lbl ); + tb_layout->addSpacing( 5 ); tb_layout->addWidget( m_zoomingComboBox ); tb_layout->addStretch(); @@ -419,7 +426,7 @@ pianoRoll::pianoRoll( void ) : #ifndef QT4 setBackgroundMode( Qt::NoBackground ); #endif - //setMouseTracking( TRUE ); + setMouseTracking( TRUE ); hide(); @@ -674,7 +681,14 @@ void pianoRoll::paintEvent( QPaintEvent * ) } // draw key-line p.drawLine( WHITE_KEY_WIDTH, key_line_y, width(), key_line_y ); - + if( key == m_keyMouseOver ) + { + p.fillRect( WHITE_KEY_WIDTH, key_line_y - + KEY_LINE_HEIGHT, + width() - WHITE_KEY_WIDTH, + KEY_LINE_HEIGHT, + QColor( 64, 64, 64 ) ); + } ++key; } @@ -1232,7 +1246,8 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me ) songEditor::inst()->playing() == FALSE ) { m_pattern->getChannelTrack()->processInEvent( - midiEvent( NOTE_ON, 0, key_num, vol ), + midiEvent( NOTE_ON, 0, key_num, + vol * 127 / 100 ), midiTime() ); } } @@ -1249,12 +1264,12 @@ void pianoRoll::mouseReleaseEvent( QMouseEvent * _me ) { m_pattern->getChannelTrack()->processInEvent( midiEvent( NOTE_OFF, 0, - m_currentNote->key() ), midiTime() ); + m_currentNote->key(), 0 ), midiTime() ); } else { m_pattern->getChannelTrack()->processInEvent( - midiEvent( NOTE_OFF, 0, getKey( _me->y() ) ), + midiEvent( NOTE_OFF, 0, getKey( _me->y() ), 0 ), midiTime() ); } } @@ -1289,6 +1304,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) PR_BOTTOM_MARGIN - m_notesEditHeight ); int key_num = getKey( _me->y() ); + m_keyMouseOver = key_num; int x = _me->x(); // is the calculated key different from current key? @@ -1296,10 +1312,16 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) // but is still on the same key) if( key_num != released_key && m_action != CHANGE_NOTE_VOLUME && - edit_note == FALSE ) + edit_note == FALSE && +#ifdef QT4 + _me->buttons() & +#else + _me->state() == +#endif + Qt::LeftButton ) { m_pattern->getChannelTrack()->processInEvent( - midiEvent( NOTE_OFF, 0, released_key ), + midiEvent( NOTE_OFF, 0, released_key, 0 ), midiTime() ); if( #ifdef QT4 @@ -1315,7 +1337,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) { m_pattern->getChannelTrack()->processInEvent( midiEvent( NOTE_ON, 0, key_num, - DEFAULT_VOLUME ), + DEFAULT_VOLUME * 127 / 100 ), midiTime() ); } } @@ -1339,7 +1361,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) m_currentNote->setVolume( vol ); m_pattern->getChannelTrack()->processInEvent( midiEvent( KEY_PRESSURE, 0, key_num, - vol ), + vol * 127 / 100 ), midiTime() ); } } diff --git a/src/core/piano_widget.cpp b/src/core/piano_widget.cpp index 444fbf0fa..e72c1fa1b 100644 --- a/src/core/piano_widget.cpp +++ b/src/core/piano_widget.cpp @@ -238,7 +238,8 @@ void pianoWidget::mousePressEvent( QMouseEvent * _me ) } // set note on m_channelTrack->processInEvent( - midiEvent( NOTE_ON, 0, key_num, vol ), + midiEvent( NOTE_ON, 0, key_num, + vol * 127 / 100 ), midiTime() ); m_pressedKeys[key_num] = TRUE; } diff --git a/src/core/song_editor.cpp b/src/core/song_editor.cpp index 205be5ee6..bef7b4ca9 100644 --- a/src/core/song_editor.cpp +++ b/src/core/song_editor.cpp @@ -362,6 +362,9 @@ songEditor::songEditor() : #endif + QLabel * zoom_lbl = new QLabel( m_toolBar ); + zoom_lbl->setPixmap( embed::getIconPixmap( "zoom" ) ); + // setup zooming-stuff m_zoomingComboBox = new QComboBox( m_toolBar ); m_zoomingComboBox->setGeometry( 580, 4, 80, 24 ); @@ -387,7 +390,9 @@ songEditor::songEditor() : tb_layout->addWidget( m_removeBarButton ); tb_layout->addSpacing( 10 ); tl->addToolButtons( m_toolBar ); - tb_layout->addSpacing( 10 ); + tb_layout->addSpacing( 15 ); + tb_layout->addWidget( zoom_lbl ); + tb_layout->addSpacing( 5 ); tb_layout->addWidget( m_zoomingComboBox ); tb_layout->addStretch();