From 642385f4ced8227454d7b244324520f3b69a4dcf Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Wed, 21 May 2008 05:07:32 +0000 Subject: [PATCH] Piano-roll scroll bug fixed. Added record-with-accompaniment demo git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1007 0778d3d1-df1d-0410-868b-ea421aaaa00d --- data/themes/default/record_accompany.png | Bin 0 -> 937 bytes include/piano_roll.h | 2 + src/gui/piano_roll.cpp | 46 +++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 data/themes/default/record_accompany.png diff --git a/data/themes/default/record_accompany.png b/data/themes/default/record_accompany.png new file mode 100644 index 0000000000000000000000000000000000000000..166339f17cae77a43ecf47eb57444f1dfd239264 GIT binary patch literal 937 zcmV;a16KTrP)WFU8GbZ8({Xk{QrNlj4iWF>9@00Rw4L_t(Y$K};uPaI_w z2JqiIe|BLDT`07*2C0S{p*NanW2$}-*MH!bOKcrPlpY2?&g&z**Wk^J`Hbm| z$(+gR`P4KQ&hQ#`Hu+&>m!x?%#dFE0ruK zO2Pwto98Z%j{2!q(=JQ(vNSeCl92SM-C}c{#T_;V=aKH;{W$OBECkYk?GXH!=N9wa zZjx9@QyU>T-R-I)uSjyTX-+M3>kf4kSrd}-y z7djmi7$rHzM3=LeQe}}0TejT?P9x#S0tvx#t>&{v!__RaRrx)V>@tC|f&9Y+dPmen z+?Pp=QH)WqEbR`~2$8G;5A6nHW7?d9X1Aev|DF`Tho1I(&z_{eJj3f#2w^v6|3s zGFOsM#h6bKPE>l2^!q@0k7B6;zsi>_zQRrY&e}Vyo5p*z*SWjQ;v$$#dj92&iLnnzIYM*x}g@lhsTJ1;y=0n%}8p*%(OkBoi%E zGLPVRCH>ftF?y9-?p2bs4;nb(3CC(y^|f>;CRQY!qekX`KJ@setWhatsThis( + tr( "Click here, if you want to record notes from a MIDI-" + "device or the virtual test-piano of the according " + "channel-window to the current pattern. When recording " + "all notes you play will be written to this pattern " + "and you will hear the song or BB track in the background." ) ); m_stopButton->setWhatsThis( tr( "Click here, if you want to stop playing of current " "pattern." ) ); @@ -398,6 +408,7 @@ pianoRoll::pianoRoll( void ) : tb_layout->addSpacing( 5 ); tb_layout->addWidget( m_playButton ); tb_layout->addWidget( m_recordButton ); + tb_layout->addWidget( m_recordAccompanyButton ); tb_layout->addWidget( m_stopButton ); tb_layout->addSpacing( 10 ); tb_layout->addWidget( m_drawButton ); @@ -459,6 +470,7 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern ) { m_pattern = _new_pattern; m_currentPosition = 0; + m_currentNote = NULL; m_startKey = INITIAL_START_KEY; if( validPattern() == FALSE ) @@ -470,6 +482,7 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern ) return; } + m_leftRightScroll->setValue( 0 ); const noteVector & notes = m_pattern->notes(); int central_key = 0; @@ -2179,12 +2192,40 @@ void pianoRoll::record( void ) } m_recording = TRUE; + engine::getSong()->playPattern( m_pattern, FALSE ); } +void pianoRoll::recordAccompany( void ) +{ + if( engine::getSong()->isPlaying() ) + { + stop(); + } + if( m_recording == TRUE || validPattern() == FALSE ) + { + return; + } + + m_recording = TRUE; + + if( m_pattern->getTrack()->getTrackContainer() == engine::getSong() ) + { + engine::getSong()->play(); + } + else + { + engine::getSong()->playBB(); + } +} + + + + + void pianoRoll::stop( void ) { engine::getSong()->stop(); @@ -2201,9 +2242,14 @@ void pianoRoll::recordNote( const note & _n ) { if( m_recording == TRUE && validPattern() == TRUE ) { + note n( _n.length(), engine::getSong()->getPlayPos( + engine::getSong()->playMode() ) - _n.length(), + _n.key(), _n.getVolume(), _n.getPanning() ); + /* note n( _n.length(), engine::getSong()->getPlayPos( song::Mode_PlayPattern ) - _n.length(), _n.key(), _n.getVolume(), _n.getPanning() ); + */ n.quantizeLength( quantization() ); m_pattern->addNote( n ); update();