mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
made RecordingDevice throw errors on invalid parameters
--HG-- branch : minor-mic-input
This commit is contained in:
@@ -71,6 +71,12 @@ bool RecordingDevice::startRecording(int samples, int sampleRate, int bitDepth,
|
|||||||
if (format == AL_NONE)
|
if (format == AL_NONE)
|
||||||
throw InvalidFormatException(channels, bitDepth);
|
throw InvalidFormatException(channels, bitDepth);
|
||||||
|
|
||||||
|
if (samples <= 0)
|
||||||
|
throw love::Exception("Invalid number of samples.");
|
||||||
|
|
||||||
|
if (sampleRate <= 0)
|
||||||
|
throw love::Exception("Invalid sample rate.");
|
||||||
|
|
||||||
device = alcCaptureOpenDevice(name.c_str(), sampleRate, format, samples);
|
device = alcCaptureOpenDevice(name.c_str(), sampleRate, format, samples);
|
||||||
if (device == nullptr)
|
if (device == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user