mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
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:
@@ -28,6 +28,7 @@
|
||||
#include "common/Module.h"
|
||||
#include "common/StringMap.h"
|
||||
#include "Source.h"
|
||||
#include "RecordingDevice.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -189,34 +190,20 @@ public:
|
||||
virtual float getDopplerScale() const = 0;
|
||||
|
||||
/**
|
||||
* Begins recording audio input from the microphone.
|
||||
* @return Number of recording devices.
|
||||
**/
|
||||
virtual void record() = 0;
|
||||
virtual int getRecordingDeviceCount() const = 0;
|
||||
|
||||
/**
|
||||
* Gets a section of recorded audio.
|
||||
* Per OpenAL, the measurement begins from the start of the
|
||||
* audio data in memory, which is after the last time this function
|
||||
* was called. If this function has not been called yet this recording
|
||||
* session, it just grabs from the beginning.
|
||||
* @return All the recorded SoundData thus far.
|
||||
* @param index Index number of recording device. 0 is default device.
|
||||
* @return Selected recording device.
|
||||
**/
|
||||
virtual love::sound::SoundData *getRecordedData() = 0;
|
||||
virtual RecordingDevice *getRecordingDevice(int index) const = 0;
|
||||
|
||||
/**
|
||||
* Stops recording and, if passed true, returns all the recorded audio
|
||||
* not already gotten by getRecordedData.
|
||||
* @param returnData Whether to return recorded audio.
|
||||
* @return if returnData, all the recorded audio yet to be gotten,
|
||||
* otherwise NULL.
|
||||
* @return Index number of a recording device, -1 if not present.
|
||||
**/
|
||||
virtual love::sound::SoundData *stopRecording(bool returnData) = 0;
|
||||
|
||||
/**
|
||||
* Checks whether LOVE is able to record audio input.
|
||||
* @return hasMic Whether LOVE has a microphone enabled.
|
||||
**/
|
||||
virtual bool canRecord() = 0;
|
||||
virtual int getRecordingDeviceIndex(RecordingDevice *device) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the distance model used for attenuation.
|
||||
|
||||
Reference in New Issue
Block a user