Microphone input implemented.

RecordingDevice class added
(number)love.audio.getRecordingDeviceCount() and (table)love.audio.getRecordingDevices() exposed
(bool):startRecording([samples, sampleRate, bitDepth, channels], (SoundData):stopRecording([SoundData]),
(SoundData):getData([SoundData]), (number):getSampleCount(), (number):getSampleRate(), (number):getBitDepth(),
(number):getChannels(), (string):getName(), (number):getID(), (bool):isRecording() member functions exposed
previously existed stub implementation removed
getFormat moved to love::audio::openal::Audio
getFormat arguments order swapped to (bitDepth, channels)
getFormat now returns AL_NONE if format is invalid

--HG--
branch : minor-mic-input
This commit is contained in:
Raidho
2016-10-23 17:56:52 +03:00
parent e5be492431
commit 87f0b2811e
21 changed files with 922 additions and 192 deletions
+15 -6
View File
@@ -29,6 +29,7 @@
// LOVE
#include "audio/Audio.h"
#include "audio/RecordingDevice.h"
#include "common/config.h"
#include "sound/SoundData.h"
@@ -65,6 +66,15 @@ public:
Audio();
~Audio();
/**
* Gets the OpenAL format identifier based on number of
* channels and bits.
* @param channels.
* @param bitDepth Either 8-bit samples, or 16-bit samples.
* @return One of AL_FORMAT_*, or AL_NONE if unsupported format.
**/
static ALenum getFormat(int bitDepth, int channels);
// Implements Module.
const char *getName() const;
@@ -95,10 +105,9 @@ public:
void setDopplerScale(float scale);
float getDopplerScale() const;
void record();
love::sound::SoundData *getRecordedData();
love::sound::SoundData *stopRecording(bool returnData);
bool canRecord();
int getRecordingDeviceCount() const;
love::audio::RecordingDevice *getRecordingDevice(int index) const;
int getRecordingDeviceIndex(love::audio::RecordingDevice *device) const;
DistanceModel getDistanceModel() const;
void setDistanceModel(DistanceModel distanceModel);
@@ -108,8 +117,8 @@ private:
// The OpenAL device.
ALCdevice *device;
// The OpenAL capture device (microphone).
ALCdevice *capture;
// The OpenAL capture devices.
std::vector<love::audio::RecordingDevice*> capture;
// The OpenAL context.
ALCcontext *context;