From 47921d7fe301cdc1521a594c2737414cb81c827d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bourdeauducq?= Date: Sun, 19 Jan 2025 10:08:00 +0800 Subject: [PATCH] check sound device parameters --- sndlock.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sndlock.cpp b/sndlock.cpp index 864fc1a..8e09e7b 100644 --- a/sndlock.cpp +++ b/sndlock.cpp @@ -75,6 +75,16 @@ static void dsp_thread() sio_close(hdl); return; } + if(par.sig != 1 + || par.bits != SND_BITS + || par.pchan != SND_PCHAN + || par.rchan != SND_RCHAN + || par.rate != SND_RATE + || par.le != SIO_LE_NATIVE) { + std::cerr << "sound device parameter mismatch" << std::endl; + sio_close(hdl); + return; + } if(!sio_start(hdl)) { std::cerr << "failed to start sound device" << std::endl;