Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mauser committed May 25, 2020
2 parents 2840c18 + d29d9e0 commit 97ed43c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/core/src/IO/disk_writer_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ void* diskWriterDriver_thread( void* param )
//pDriver->m_transport.m_nFrames = frameNumber;

int ret = pDriver->m_processCallback( usedBuffer, nullptr );
while( ret != 0) {
ret = pDriver->m_processCallback( usedBuffer, nullptr );
}

for ( unsigned i = 0; i < usedBuffer; i++ ) {
if(pData_L[i] > 1){
Expand Down
10 changes: 8 additions & 2 deletions src/core/src/hydrogen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ static void audioEngine_noteOn( Note *note );
latter will be set to @a nframes.
* \param arg Unused.
* \return
* - __2__ : Failed to aquire the audio engine lock, no processing took place.
* - __1__ : kill the audio driver thread. This will be used if either
* the DiskWriterDriver or FakeDriver are used and the end of the Song
* is reached (audioEngine_updateNoteQueue() returned -1 ).
Expand Down Expand Up @@ -1268,9 +1269,14 @@ int audioEngine_process( uint32_t nframes, void* /*arg*/ )
* The "try_lock" was introduced for Bug #164 (Deadlock after during
* alsa driver shutdown). The try_lock *should* only fail in rare circumstances
* (like shutting down drivers). In such cases, it seems to be ok to interrupt
* audio processing.
* audio processing. Returning the special return value "2" enables the disk
* writer driver to repeat the processing of the current data.
*/
if(!AudioEngine::get_instance()->try_lock( RIGHT_HERE )){
if(!AudioEngine::get_instance()->try_lock( RIGHT_HERE )) {
if ( m_pAudioDriver->class_name() == DiskWriterDriver::class_name() ) {
return 2; // inform the caller that we could not aquire the lock
}

return 0;
}

Expand Down
7 changes: 7 additions & 0 deletions src/gui/src/PatternEditor/PatternEditorRuler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ void PatternEditorRuler::updateEditor( bool bRedrawAll )
static int oldNTicks = 0;

Hydrogen *pEngine = Hydrogen::get_instance();

//Do not redraw anything if Export is active.
//https://github.com/hydrogen-music/hydrogen/issues/857
if( pEngine->getIsExportSessionActive() ) {
return;
}

PatternList *pPatternList = pEngine->getSong()->get_pattern_list();
int nSelectedPatternNumber = pEngine->getSelectedPatternNumber();
if ( (nSelectedPatternNumber != -1) && ( (uint)nSelectedPatternNumber < pPatternList->size() ) ) {
Expand Down
7 changes: 7 additions & 0 deletions src/gui/src/SongEditor/SongEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,13 @@ void SongEditorPatternList::createBackground()
boldTextFont.setBold( true );

Hydrogen *pEngine = Hydrogen::get_instance();

//Do not redraw anything if Export is active.
//https://github.com/hydrogen-music/hydrogen/issues/857
if( pEngine->getIsExportSessionActive() ) {
return;
}

Song *pSong = pEngine->getSong();
int nPatterns = pSong->get_pattern_list()->size();
int nSelectedPattern = pEngine->getSelectedPatternNumber();
Expand Down

0 comments on commit 97ed43c

Please sign in to comment.