mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Major developments to love.audio/love.sound. Music and Sound are gone. There are only Sources now, which is much cleaner.
The audio module was not really stable in 0.6.0, it takes very little messing around to cause OpenAL to do horrible things. It should now be much more stable, and you *should* be able to play/stop/pause/resume/rewind/loop like a madman without disasters. Seek and tell, however, are still not tested and verified for all decoders, but that's less important. Also, all objects now have object:type() and object:typeOf(), which returns the type name of the object, and checks whether an object is of a certain type, respectively.
This commit is contained in:
@@ -23,11 +23,14 @@
|
||||
|
||||
#include <common/Module.h>
|
||||
#include "Source.h"
|
||||
#include "Sound.h"
|
||||
#include "Music.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace sound
|
||||
{
|
||||
class Decoder;
|
||||
class SoundData;
|
||||
}
|
||||
namespace audio
|
||||
{
|
||||
/**
|
||||
@@ -42,26 +45,9 @@ namespace audio
|
||||
**/
|
||||
virtual ~Audio(){};
|
||||
|
||||
/**
|
||||
* Creates a new Sound with the specified SoundData.
|
||||
* @param data The SoundData from which to create the sound.
|
||||
* @return A new Sound if successful, zero otherwise.
|
||||
**/
|
||||
virtual Sound * newSound(love::sound::SoundData * data) = 0;
|
||||
|
||||
/**
|
||||
* Creates a new Music (stream) using the specified SoundData.
|
||||
* @param decoder The object to use to decode the sound stream.
|
||||
**/
|
||||
virtual Music * newMusic(love::sound::Decoder * decoder) = 0;
|
||||
|
||||
/**
|
||||
* Creates a new Source.
|
||||
* @returns A new Source.
|
||||
**/
|
||||
virtual Source * newSource(Sound * sound) = 0;
|
||||
virtual Source * newSource(Music * music) = 0;
|
||||
|
||||
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.
|
||||
@@ -80,26 +66,6 @@ namespace audio
|
||||
**/
|
||||
virtual void play(Source * source) = 0;
|
||||
|
||||
/**
|
||||
* Plays one Sound on the specified Source. We need separate
|
||||
* Sound and Music play functions because Music must be cloned,
|
||||
* whereas Sound needs not be.
|
||||
*
|
||||
* @param sound The Sound to play.
|
||||
* @param source The Source on which to play the Sound.
|
||||
**/
|
||||
virtual void play(Sound * sound) = 0;
|
||||
|
||||
/**
|
||||
* Plays one Music on the specified Source. We need separate
|
||||
* Sound and Music play functions because Music must be cloned,
|
||||
* whereas Sound needs not be.
|
||||
*
|
||||
* @param music The Music to play.
|
||||
* @param source The Source on which to play the Music.
|
||||
**/
|
||||
virtual void play(Music * music) = 0;
|
||||
|
||||
/**
|
||||
* Stops playback on the specified source.
|
||||
* @param source The source on which to stop the playback.
|
||||
|
||||
Reference in New Issue
Block a user