From e9ba002aa837f16e44b03e4a332df32d51ceafb1 Mon Sep 17 00:00:00 2001 From: Csaba Hruska Date: Sun, 14 Sep 2008 11:51:54 +0000 Subject: [PATCH] bugfix: portaudio backend now handles blocked device correctly. git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1605 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 5 +++++ src/core/audio/audio_portaudio.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3a83248f9..958a7a334 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-09-14 Csaba Hruska + + * src/core/audio/audio_portaudio.cpp: + Bugfix: Fixed segfault when other app uses and blocks the audio device + 2008-09-08 Paul Giblock * src/core/timeline.cpp: diff --git a/src/core/audio/audio_portaudio.cpp b/src/core/audio/audio_portaudio.cpp index a4b635227..37a167c9b 100644 --- a/src/core/audio/audio_portaudio.cpp +++ b/src/core/audio/audio_portaudio.cpp @@ -113,6 +113,11 @@ audioPortAudio::audioPortAudio( bool & _success_ful, mixer * _mixer ) : outDevIdx = Pa_GetDefaultOutputDevice(); } + if( inDevIdx < 0 || outDevIdx < 0) + { + return; + } + double inLatency = (double)getMixer()->framesPerPeriod() / (double)sampleRate(); double outLatency = (double)getMixer()->framesPerPeriod() / (double)sampleRate();