Browse Source

made RecordingDevice throw errors on invalid parameters

--HG--
branch : minor-mic-input
Raidho 8 years ago
parent
commit
424d2704ec
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/modules/audio/openal/RecordingDevice.cpp

+ 6 - 0
src/modules/audio/openal/RecordingDevice.cpp

@@ -71,6 +71,12 @@ bool RecordingDevice::startRecording(int samples, int sampleRate, int bitDepth,
 	if (format == AL_NONE)
 		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);
 	if (device == nullptr)
 		return false;