1 /**
2  * Copyright (c) 2006-2019 LOVE Development Team
3  *
4  * This software is provided 'as-is', without any express or implied
5  * warranty.  In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  *
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  *
12  * 1. The origin of this software must not be misrepresented; you must not
13  *    claim that you wrote the original software. If you use this software
14  *    in a product, an acknowledgment in the product documentation would be
15  *    appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  *    misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  **/
20 
21 #ifndef LOVE_AUDIO_OPENAL_RECORDING_DEVICE_H
22 #define LOVE_AUDIO_OPENAL_RECORDING_DEVICE_H
23 
24 #include "common/config.h"
25 
26 #ifdef LOVE_APPLE_USE_FRAMEWORKS
27 #ifdef LOVE_IOS
28 #include <OpenAL/alc.h>
29 #include <OpenAL/al.h>
30 #else
31 #include <OpenAL-Soft/alc.h>
32 #include <OpenAL-Soft/al.h>
33 #endif
34 #else
35 #include <AL/alc.h>
36 #include <AL/al.h>
37 #endif
38 
39 #include "audio/RecordingDevice.h"
40 #include "sound/SoundData.h"
41 
42 namespace love
43 {
44 namespace audio
45 {
46 namespace openal
47 {
48 
49 class RecordingDevice : public love::audio::RecordingDevice
50 {
51 public:
52 
53 	RecordingDevice(const char *name);
54 	virtual ~RecordingDevice();
55 	virtual bool start(int samples, int sampleRate, int bitDepth, int channels);
56 	virtual void stop();
57 	virtual love::sound::SoundData *getData();
58 	virtual const char *getName() const;
59 	virtual int getSampleCount() const;
60 	virtual int getMaxSamples() const;
61 	virtual int getSampleRate() const;
62 	virtual int getBitDepth() const;
63 	virtual int getChannelCount() const;
64 	virtual bool isRecording() const;
65 
66 private:
67 
68 	int samples = DEFAULT_SAMPLES;
69 	int sampleRate = DEFAULT_SAMPLE_RATE;
70 	int bitDepth = DEFAULT_BIT_DEPTH;
71 	int channels = DEFAULT_CHANNELS;
72 
73 	std::string name;
74 	ALCdevice *device = nullptr;
75 
76 }; //RecordingDevice
77 
78 } //openal
79 } //audio
80 } //love
81 
82 #endif //LOVE_AUDIO_OPENAL_RECORDING_DEVICE_H
83