|
@@ -16,48 +16,48 @@
|
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
* misrepresented as being the original software.
|
|
* misrepresented as being the original software.
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
-**/
|
|
|
|
-
|
|
|
|
-#ifndef LOVE_AUDIO_AUDIO_H
|
|
|
|
-#define LOVE_AUDIO_AUDIO_H
|
|
|
|
-
|
|
|
|
-#include <common/Module.h>
|
|
|
|
|
|
+**/
|
|
|
|
+
|
|
|
|
+#ifndef LOVE_AUDIO_AUDIO_H
|
|
|
|
+#define LOVE_AUDIO_AUDIO_H
|
|
|
|
+
|
|
|
|
+#include <common/Module.h>
|
|
#include "Source.h"
|
|
#include "Source.h"
|
|
-
|
|
|
|
-namespace love
|
|
|
|
-{
|
|
|
|
-namespace sound
|
|
|
|
-{
|
|
|
|
- class Decoder;
|
|
|
|
- class SoundData;
|
|
|
|
-}
|
|
|
|
-namespace audio
|
|
|
|
-{
|
|
|
|
- /**
|
|
|
|
- * The Audio module is responsible for playing back raw sound samples.
|
|
|
|
- **/
|
|
|
|
- class Audio : public Module
|
|
|
|
- {
|
|
|
|
- public:
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Destructor.
|
|
|
|
- **/
|
|
|
|
- virtual ~Audio(){};
|
|
|
|
-
|
|
|
|
- virtual Source * newSource(love::sound::Decoder * decoder) = 0;
|
|
|
|
- virtual Source * newSource(love::sound::SoundData * soundData) = 0;
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Gets the current number of simulatenous playing sources.
|
|
|
|
- * @return The current number of simulatenous playing sources.
|
|
|
|
- **/
|
|
|
|
- virtual int getNumSources() const = 0;
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Gets the maximum supported number of simulatenous playing sources.
|
|
|
|
- * @return The maximum supported number of simulatenous playing sources.
|
|
|
|
- **/
|
|
|
|
|
|
+
|
|
|
|
+namespace love
|
|
|
|
+{
|
|
|
|
+namespace sound
|
|
|
|
+{
|
|
|
|
+ class Decoder;
|
|
|
|
+ class SoundData;
|
|
|
|
+}
|
|
|
|
+namespace audio
|
|
|
|
+{
|
|
|
|
+ /**
|
|
|
|
+ * The Audio module is responsible for playing back raw sound samples.
|
|
|
|
+ **/
|
|
|
|
+ class Audio : public Module
|
|
|
|
+ {
|
|
|
|
+ public:
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Destructor.
|
|
|
|
+ **/
|
|
|
|
+ virtual ~Audio(){};
|
|
|
|
+
|
|
|
|
+ virtual Source * newSource(love::sound::Decoder * decoder) = 0;
|
|
|
|
+ virtual Source * newSource(love::sound::SoundData * soundData) = 0;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets the current number of simultaneous playing sources.
|
|
|
|
+ * @return The current number of simultaneous playing sources.
|
|
|
|
+ **/
|
|
|
|
+ virtual int getNumSources() const = 0;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets the maximum supported number of simultaneous playing sources.
|
|
|
|
+ * @return The maximum supported number of simultaneous playing sources.
|
|
|
|
+ **/
|
|
virtual int getMaxSources() const = 0;
|
|
virtual int getMaxSources() const = 0;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -121,49 +121,79 @@ namespace audio
|
|
* Gets the master volume.
|
|
* Gets the master volume.
|
|
* @return The current master volume.
|
|
* @return The current master volume.
|
|
**/
|
|
**/
|
|
- virtual float getVolume() const = 0;
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Gets the position of the listener.
|
|
|
|
- * @param v A float array of size 3 containing (x,y,z) in that order.
|
|
|
|
- **/
|
|
|
|
- virtual void getPosition(float * v) const = 0;
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Sets the position of the listener.
|
|
|
|
- * @param v A float array of size 3 containing [x,y,z] in that order.
|
|
|
|
- **/
|
|
|
|
- virtual void setPosition(float * v) = 0;
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Gets the orientation of the listener.
|
|
|
|
- * @param v A float array of size 6 containing [x,y,z] for the forward
|
|
|
|
- * vector, followed by [x,y,z] for the up vector.
|
|
|
|
- **/
|
|
|
|
- virtual void getOrientation(float * v) const = 0;
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Sets the orientation of the listener.
|
|
|
|
- * @param v A float array of size 6 containing [x,y,z] for the forward
|
|
|
|
- * vector, followed by [x,y,z] for the up vector.
|
|
|
|
- **/
|
|
|
|
- virtual void setOrientation(float * v) = 0;
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Gets the velocity of the listener.
|
|
|
|
- * @param v A float array of size 3 containing [x,y,z] in that order.
|
|
|
|
- **/
|
|
|
|
- virtual void getVelocity(float * v) const = 0;
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Sets the velocity of the listener.
|
|
|
|
- * @param v A float array of size 3 containing [x,y,z] in that order.
|
|
|
|
- **/
|
|
|
|
- virtual void setVelocity(float * v) = 0;
|
|
|
|
-
|
|
|
|
- }; // Audio
|
|
|
|
-
|
|
|
|
-} // audio
|
|
|
|
-} // love
|
|
|
|
-
|
|
|
|
-#endif // LOVE_AUDIO_AUDIO_H
|
|
|
|
|
|
+ virtual float getVolume() const = 0;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets the position of the listener.
|
|
|
|
+ * @param v A float array of size 3 containing (x,y,z) in that order.
|
|
|
|
+ **/
|
|
|
|
+ virtual void getPosition(float * v) const = 0;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Sets the position of the listener.
|
|
|
|
+ * @param v A float array of size 3 containing [x,y,z] in that order.
|
|
|
|
+ **/
|
|
|
|
+ virtual void setPosition(float * v) = 0;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets the orientation of the listener.
|
|
|
|
+ * @param v A float array of size 6 containing [x,y,z] for the forward
|
|
|
|
+ * vector, followed by [x,y,z] for the up vector.
|
|
|
|
+ **/
|
|
|
|
+ virtual void getOrientation(float * v) const = 0;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Sets the orientation of the listener.
|
|
|
|
+ * @param v A float array of size 6 containing [x,y,z] for the forward
|
|
|
|
+ * vector, followed by [x,y,z] for the up vector.
|
|
|
|
+ **/
|
|
|
|
+ virtual void setOrientation(float * v) = 0;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets the velocity of the listener.
|
|
|
|
+ * @param v A float array of size 3 containing [x,y,z] in that order.
|
|
|
|
+ **/
|
|
|
|
+ virtual void getVelocity(float * v) const = 0;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Sets the velocity of the listener.
|
|
|
|
+ * @param v A float array of size 3 containing [x,y,z] in that order.
|
|
|
|
+ **/
|
|
|
|
+ virtual void setVelocity(float * v) = 0;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Begins recording audio input from the microphone.
|
|
|
|
+ **/
|
|
|
|
+ virtual void record() = 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.
|
|
|
|
+ **/
|
|
|
|
+ virtual love::sound::SoundData * getRecordedData() = 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.
|
|
|
|
+ **/
|
|
|
|
+ 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;
|
|
|
|
+
|
|
|
|
+ }; // Audio
|
|
|
|
+
|
|
|
|
+} // audio
|
|
|
|
+} // love
|
|
|
|
+
|
|
|
|
+#endif // LOVE_AUDIO_AUDIO_H
|