summaryrefslogtreecommitdiff
path: root/src/wx/film_viewer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/wx/film_viewer.cc')
-rw-r--r--src/wx/film_viewer.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index c05e76f83..726d5c918 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -664,8 +664,12 @@ FilmViewer::config_changed (Config::Property p)
unsigned int st = 0;
if (Config::instance()->sound_output()) {
while (st < _audio.getDeviceCount()) {
- if (_audio.getDeviceInfo(st).name == Config::instance()->sound_output().get()) {
- break;
+ try {
+ if (_audio.getDeviceInfo(st).name == Config::instance()->sound_output().get()) {
+ break;
+ }
+ } catch (RtAudioError&) {
+ /* Something went wrong with the device so we don't want to use it anyway */
}
++st;
}
@@ -676,13 +680,12 @@ FilmViewer::config_changed (Config::Property p)
st = _audio.getDefaultOutputDevice();
}
- _audio_channels = _audio.getDeviceInfo(st).outputChannels;
-
- RtAudio::StreamParameters sp;
- sp.deviceId = st;
- sp.nChannels = _audio_channels;
- sp.firstChannel = 0;
try {
+ _audio_channels = _audio.getDeviceInfo(st).outputChannels;
+ RtAudio::StreamParameters sp;
+ sp.deviceId = st;
+ sp.nChannels = _audio_channels;
+ sp.firstChannel = 0;
_audio.openStream (&sp, 0, RTAUDIO_FLOAT32, 48000, &_audio_block_size, &rtaudio_callback, this);
} catch (RtAudioError& e) {
error_dialog (