diff --git a/CMakeLists.txt b/CMakeLists.txt index a0306c5c273..6e1861eba56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ SET(PROJECT_COPYRIGHT "2008-${PROJECT_YEAR} ${PROJECT_AUTHOR}") SET(VERSION_MAJOR "1") SET(VERSION_MINOR "2") SET(VERSION_RELEASE "0") -SET(VERSION_STAGE "rc3") +SET(VERSION_STAGE "rc4") SET(VERSION_BUILD "0") SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}") IF(VERSION_STAGE) diff --git a/include/AudioSndio.h b/include/AudioSndio.h index 11e1f91e4e0..22a15abc5c7 100644 --- a/include/AudioSndio.h +++ b/include/AudioSndio.h @@ -72,6 +72,8 @@ class AudioSndio : public AudioDevice, public QThread struct sio_hdl *m_hdl; struct sio_par m_par; + + bool m_convertEndian; } ; diff --git a/include/MainWindow.h b/include/MainWindow.h index 1a58f868c02..7ba2ac63079 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -249,11 +249,4 @@ private slots: } ; -class AutoSaveThread : public QThread -{ - Q_OBJECT -public: - void run(); -} ; - #endif diff --git a/include/RemotePlugin.h b/include/RemotePlugin.h index b3ac4b676f1..2d811487587 100644 --- a/include/RemotePlugin.h +++ b/include/RemotePlugin.h @@ -621,6 +621,11 @@ class EXPORT RemotePluginBase fetchAndProcessNextMessage(); } } + + static bool isMainThreadWaiting() + { + return waitDepthCounter() > 0; + } #endif virtual bool processMessage( const message & _m ) = 0; @@ -657,6 +662,14 @@ class EXPORT RemotePluginBase private: +#ifndef BUILD_REMOTE_PLUGIN_CLIENT + static int & waitDepthCounter() + { + static int waitDepth = 0; + return waitDepth; + } +#endif + #ifdef SYNC_WITH_SHM_FIFO shmFifo * m_in; shmFifo * m_out; @@ -1089,6 +1102,26 @@ RemotePluginBase::message RemotePluginBase::waitForMessage( _busy_waiting = QThread::currentThread() == QCoreApplication::instance()->thread(); } + + struct WaitDepthCounter + { + WaitDepthCounter( int & depth, bool busy ) : + m_depth( depth ), + m_busy( busy ) + { + if( m_busy ) { ++m_depth; } + } + + ~WaitDepthCounter() + { + if( m_busy ) { --m_depth; } + } + + int & m_depth; + bool m_busy; + }; + + WaitDepthCounter wdc( waitDepthCounter(), _busy_waiting ); #endif while( !isInvalid() ) { diff --git a/src/core/InstrumentFunctions.cpp b/src/core/InstrumentFunctions.cpp index 4a542b08175..2860045b8df 100644 --- a/src/core/InstrumentFunctions.cpp +++ b/src/core/InstrumentFunctions.cpp @@ -305,7 +305,7 @@ InstrumentFunctionArpeggio::InstrumentFunctionArpeggio( Model * _parent ) : m_arpCycleModel( 0.0f, 0.0f, 6.0f, 1.0f, this, tr( "Cycle steps" ) ), m_arpSkipModel( 0.0f, 0.0f, 100.0f, 1.0f, this, tr( "Skip rate" ) ), m_arpMissModel( 0.0f, 0.0f, 100.0f, 1.0f, this, tr( "Miss rate" ) ), - m_arpTimeModel( 100.0f, 25.0f, 2000.0f, 1.0f, 2000, this, tr( "Arpeggio time" ) ), + m_arpTimeModel( 200.0f, 25.0f, 2000.0f, 1.0f, 2000, this, tr( "Arpeggio time" ) ), m_arpGateModel( 100.0f, 1.0f, 200.0f, 1.0f, this, tr( "Arpeggio gate" ) ), m_arpDirectionModel( this, tr( "Arpeggio direction" ) ), m_arpModeModel( this, tr( "Arpeggio mode" ) ) @@ -396,14 +396,13 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n ) frames_processed += remaining_frames_for_cur_arp; - // init with zero - int cur_arp_idx = 0; - // in sorted mode: is it our turn or do we have to be quiet for // now? if( m_arpModeModel.value() == SortMode && ( ( cur_frame / arp_frames ) % total_range ) / range != (f_cnt_t) _n->index() ) { + // Set master note if not playing arp note or it will play as an ordinary note + _n->setMasterNote(); // update counters frames_processed += arp_frames; cur_frame += arp_frames; @@ -416,10 +415,9 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n ) if( 100 * ( (float) rand() / (float)( RAND_MAX + 1.0f ) ) < m_arpSkipModel.value() ) { - if( cur_arp_idx == 0 ) - { - _n->setMasterNote(); - } + // Set master note to prevent the note to extend over skipped notes + // This may only be needed for lb302 + _n->setMasterNote(); // update counters frames_processed += arp_frames; cur_frame += arp_frames; @@ -440,6 +438,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n ) } } + int cur_arp_idx = 0; // process according to arpeggio-direction... if( dir == ArpDirUp ) { @@ -525,6 +524,13 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n ) frames_processed += arp_frames; cur_frame += arp_frames; } + + // make sure note is handled as arp-base-note, even + // if we didn't add a sub-note so far + if( m_arpModeModel.value() != FreeMode ) + { + _n->setMasterNote(); + } } diff --git a/src/core/audio/AudioSndio.cpp b/src/core/audio/AudioSndio.cpp index ca889d88cd0..3145eb21868 100644 --- a/src/core/audio/AudioSndio.cpp +++ b/src/core/audio/AudioSndio.cpp @@ -27,9 +27,9 @@ #ifdef LMMS_HAVE_SNDIO -#include -#include -#include +#include +#include +#include #include "endian_handling.h" #include "LcdSpinBox.h" @@ -52,9 +52,10 @@ AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) : AudioDevice( tLimit( ConfigManager::inst()->value( "audiosndio", "channels" ).toInt(), - DEFAULT_CHANNELS, SURROUND_CHANNELS ), _mixer ) + DEFAULT_CHANNELS, SURROUND_CHANNELS ), _mixer ), + m_convertEndian ( false ) { - _success_ful = FALSE; + _success_ful = false; QString dev = ConfigManager::inst()->value( "audiosndio", "device" ); @@ -64,7 +65,7 @@ AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) : } else { - m_hdl = sio_open( dev.toAscii().data(), SIO_PLAY, 0 ); + m_hdl = sio_open( dev.toLatin1().constData(), SIO_PLAY, 0 ); } if( m_hdl == NULL ) @@ -82,6 +83,11 @@ AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) : m_par.round = mixer()->framesPerPeriod(); m_par.appbufsz = m_par.round * 2; + if ( (isLittleEndian() && (m_par.le == 0)) || + (!isLittleEndian() && (m_par.le == 1))) { + m_convertEndian = true; + } + struct sio_par reqpar = m_par; if (!sio_setpar(m_hdl, &m_par)) @@ -98,7 +104,7 @@ AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) : if (reqpar.pchan != m_par.pchan || reqpar.bits != m_par.bits || reqpar.le != m_par.le || - (abs(reqpar.rate - m_par.rate) * 100)/reqpar.rate > 2) + (::abs(static_cast(reqpar.rate) - static_cast(m_par.rate)) * 100)/reqpar.rate > 2) { printf( "sndio: returned params not as requested\n" ); return; @@ -110,7 +116,7 @@ AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) : return; } - _success_ful = TRUE; + _success_ful = true; } @@ -160,7 +166,7 @@ void AudioSndio::run( void ) int_sample_t * outbuf = new int_sample_t[mixer()->framesPerPeriod() * channels()]; - while( TRUE ) + while( true ) { const fpp_t frames = getNextBuffer( temp ); if( !frames ) @@ -169,7 +175,7 @@ void AudioSndio::run( void ) } uint bytes = convertToS16( temp, frames, - mixer()->masterGain(), outbuf, FALSE ); + mixer()->masterGain(), outbuf, m_convertEndian ); if( sio_write( m_hdl, outbuf, bytes ) != bytes ) { break; diff --git a/src/core/midi/MidiSndio.cpp b/src/core/midi/MidiSndio.cpp index 6827fbf81e8..4a1ed061419 100644 --- a/src/core/midi/MidiSndio.cpp +++ b/src/core/midi/MidiSndio.cpp @@ -27,8 +27,8 @@ #ifdef LMMS_HAVE_SNDIO -#include -#include +#include +#include #ifdef LMMS_HAVE_STDLIB_H #include @@ -42,7 +42,7 @@ MidiSndio::MidiSndio( void ) : MidiClientRaw(), - m_quit( FALSE ) + m_quit( false ) { QString dev = probeDevice(); @@ -52,7 +52,7 @@ MidiSndio::MidiSndio( void ) : } else { - m_hdl = mio_open( dev.toAscii().data(), MIO_IN | MIO_OUT, 0 ); + m_hdl = mio_open( dev.toLatin1().constData(), MIO_IN | MIO_OUT, 0 ); } if( m_hdl == NULL ) @@ -69,7 +69,7 @@ MidiSndio::~MidiSndio() { if( isRunning() ) { - m_quit = TRUE; + m_quit = true; wait( 1000 ); terminate(); } @@ -97,7 +97,7 @@ void MidiSndio::run( void ) char buf[0x100], *p; size_t n; int ret; - while( m_quit == FALSE && m_hdl ) + while( m_quit == false && m_hdl ) { nfds = mio_pollfd( m_hdl, &pfd, POLLIN ); ret = poll( &pfd, nfds, 100 ); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 9bb4bfea667..b91fe3ef2fa 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -54,6 +54,7 @@ #include "PluginView.h" #include "ProjectJournal.h" #include "ProjectNotes.h" +#include "RemotePlugin.h" #include "SetupDialog.h" #include "SideBar.h" #include "SongEditor.h" @@ -1535,14 +1536,14 @@ void MainWindow::browseHelp() void MainWindow::autoSave() { if( !Engine::getSong()->isExporting() && + !Engine::getSong()->isLoadingProject() && + !RemotePluginBase::isMainThreadWaiting() && !QApplication::mouseButtons() && - ( ConfigManager::inst()->value( "ui", - "enablerunningautosave" ).toInt() || - ! Engine::getSong()->isPlaying() ) ) + ( ConfigManager::inst()->value( "ui", + "enablerunningautosave" ).toInt() || + ! Engine::getSong()->isPlaying() ) ) { - AutoSaveThread * ast = new AutoSaveThread(); - connect( ast, SIGNAL( finished() ), ast, SLOT( deleteLater() ) ); - ast->start(); + Engine::getSong()->saveProjectFile(ConfigManager::inst()->recoveryFile()); autoSaveTimerReset(); // Reset timer } else @@ -1554,11 +1555,3 @@ void MainWindow::autoSave() } } } - - - - -void AutoSaveThread::run() -{ - Engine::getSong()->saveProjectFile(ConfigManager::inst()->recoveryFile()); -}