|
@@ -56,19 +56,8 @@ RecordingDevice::~RecordingDevice()
|
|
alcCaptureCloseDevice(device);
|
|
alcCaptureCloseDevice(device);
|
|
}
|
|
}
|
|
|
|
|
|
-bool RecordingDevice::start()
|
|
|
|
-{
|
|
|
|
- return start(samples, sampleRate, bitDepth, channels);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
bool RecordingDevice::start(int samples, int sampleRate, int bitDepth, int channels)
|
|
bool RecordingDevice::start(int samples, int sampleRate, int bitDepth, int channels)
|
|
{
|
|
{
|
|
- if (isRecording())
|
|
|
|
- {
|
|
|
|
- alcCaptureStop(device);
|
|
|
|
- alcCaptureCloseDevice(device);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
ALenum format = Audio::getFormat(bitDepth, channels);
|
|
ALenum format = Audio::getFormat(bitDepth, channels);
|
|
if (format == AL_NONE)
|
|
if (format == AL_NONE)
|
|
throw InvalidFormatException(channels, bitDepth);
|
|
throw InvalidFormatException(channels, bitDepth);
|
|
@@ -79,15 +68,20 @@ bool RecordingDevice::start(int samples, int sampleRate, int bitDepth, int chann
|
|
if (sampleRate <= 0)
|
|
if (sampleRate <= 0)
|
|
throw love::Exception("Invalid sample rate.");
|
|
throw love::Exception("Invalid sample rate.");
|
|
|
|
|
|
|
|
+ if (isRecording())
|
|
|
|
+ stop();
|
|
|
|
+
|
|
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;
|
|
|
|
|
|
alcCaptureStart(device);
|
|
alcCaptureStart(device);
|
|
|
|
+
|
|
this->samples = samples;
|
|
this->samples = samples;
|
|
this->sampleRate = sampleRate;
|
|
this->sampleRate = sampleRate;
|
|
this->bitDepth = bitDepth;
|
|
this->bitDepth = bitDepth;
|
|
this->channels = channels;
|
|
this->channels = channels;
|
|
|
|
+
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|