* Move AudioEngine::unlock() to the very *end* of audioEngine_startAudioDrivers. This ensures that the engine does not start process() before all buffers have been initialized.
On my system, the premature unlock() caused seemingly random segmentation faults during H2 startup (because m_pMainBuffer_L/R were not allocated), in particular when loading songs with large drumkits. - Kristian
Index: libs/hydrogen/src/Hydrogen.cpp
===================================================================
--- libs/hydrogen/src/Hydrogen.cpp (revision 202)
+++ libs/hydrogen/src/Hydrogen.cpp (working copy)
@@ -1498,8 +1498,6 @@
// update the audiodriver reference in the sampler
AudioEngine::getInstance()->getSampler()->setAudioOutput( m_pAudioDriver );
- AudioEngine::getInstance()->unlock(); // test...
-
if ( m_pAudioDriver ) {
int res = m_pAudioDriver->connect();
if (res != 0) {
@@ -1542,6 +1540,8 @@
else if ( m_audioEngineState == STATE_READY ) {
EventQueue::getInstance()->pushEvent( EVENT_STATE, STATE_READY );
}
+
+ AudioEngine::getInstance()->unlock(); // Unlocking earlier might execute the jack process() callback before we are fully initialized.
}
pgp3hnfHSlDUJ.pgp
Description: PGP signature
