Skip to content

Commit e54aa34

Browse files
committed
FLTK: add extra audio error handling
1 parent 25622d2 commit e54aa34

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.gitmodules

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[submodule "src/lib/lodepng"]
88
path = src/lib/lodepng
99
url = https://github.com/lvandeve/lodepng.git
10+
ignore = untracked
1011
[submodule "src/lib/jsmn"]
1112
path = src/lib/jsmn
1213
url = https://github.com/zserge/jsmn.git

src/ui/audio.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ static void setup_format(ma_format format, ma_uint32 channels, ma_uint32 sampleR
114114
config.sampleRate != sampleRate) {
115115
audio_close();
116116
setup_config(format, channels, sampleRate);
117-
ma_device_init(nullptr, &config, &device);
117+
ma_result result = ma_device_init(nullptr, &config, &device);
118+
if (result != MA_SUCCESS) {
119+
err_throw("Failed to prepare sound device [%d]", result);
120+
}
118121
}
119122
}
120123

@@ -149,7 +152,10 @@ void osd_audio(const char *path) {
149152
cache.put(path, sound);
150153
ma_mutex_unlock(&device.lock);
151154
if (queue.size() == 1) {
152-
ma_device_start(&device);
155+
result = ma_device_start(&device);
156+
if (result != MA_SUCCESS) {
157+
err_throw("Failed to start audio [%d]", result);
158+
}
153159
}
154160
}
155161
}

0 commit comments

Comments
 (0)