mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
New audio playback API
Instead of having three states, stopped, paused and playing, now there's only two states: paused and playing. This means resume() is gone, as is isStopped(), and isPaused() has become isPlaying(). stop() now pauses and rewinds, whereas pause() only pauses. rewind() has been removed, and should either be replaced with stop() or seek(0). The same has been applied to the functions in the love.audio module, except they get some extra magic: - love.audio.pause() now returns a table/list of Source objects, which contains only the sources it has just paused. This means you can then later restart only them, instead of everything (as before). - love.audio.play/pause/stop now have variants that take a list of Source objects, and it starts or stops them all at the same time, this means calling play(srcA, srcB) should mean srcA and srcB are much more (but possibly not exactly) synchronised than they were with play(srcA); play(srcB). --HG-- branch : minor
This commit is contained in:
@@ -66,10 +66,19 @@ bool Audio::play(love::audio::Source *)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Audio::play(const std::vector<love::audio::Source*>&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Audio::stop(love::audio::Source *)
|
||||
{
|
||||
}
|
||||
|
||||
void Audio::stop(const std::vector<love::audio::Source*>&)
|
||||
{
|
||||
}
|
||||
|
||||
void Audio::stop()
|
||||
{
|
||||
}
|
||||
@@ -78,24 +87,13 @@ void Audio::pause(love::audio::Source *)
|
||||
{
|
||||
}
|
||||
|
||||
void Audio::pause()
|
||||
void Audio::pause(const std::vector<love::audio::Source*>&)
|
||||
{
|
||||
}
|
||||
|
||||
void Audio::resume(love::audio::Source *)
|
||||
{
|
||||
}
|
||||
|
||||
void Audio::resume()
|
||||
{
|
||||
}
|
||||
|
||||
void Audio::rewind(love::audio::Source *)
|
||||
{
|
||||
}
|
||||
|
||||
void Audio::rewind()
|
||||
std::vector<love::audio::Source*> Audio::pause()
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
void Audio::setVolume(float volume)
|
||||
|
||||
@@ -49,14 +49,13 @@ public:
|
||||
int getSourceCount() const;
|
||||
int getMaxSources() const;
|
||||
bool play(love::audio::Source *source);
|
||||
bool play(const std::vector<love::audio::Source*> &sources);
|
||||
void stop(love::audio::Source *source);
|
||||
void stop(const std::vector<love::audio::Source*> &sources);
|
||||
void stop();
|
||||
void pause(love::audio::Source *source);
|
||||
void pause();
|
||||
void resume(love::audio::Source *source);
|
||||
void resume();
|
||||
void rewind(love::audio::Source *source);
|
||||
void rewind();
|
||||
void pause(const std::vector<love::audio::Source*> &sources);
|
||||
std::vector<love::audio::Source*> pause();
|
||||
void setVolume(float volume);
|
||||
float getVolume() const;
|
||||
|
||||
|
||||
@@ -55,20 +55,7 @@ void Source::pause()
|
||||
{
|
||||
}
|
||||
|
||||
void Source::resume()
|
||||
{
|
||||
}
|
||||
|
||||
void Source::rewind()
|
||||
{
|
||||
}
|
||||
|
||||
bool Source::isStopped() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Source::isPaused() const
|
||||
bool Source::isPlaying() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -42,10 +42,7 @@ public:
|
||||
virtual bool play();
|
||||
virtual void stop();
|
||||
virtual void pause();
|
||||
virtual void resume();
|
||||
virtual void rewind();
|
||||
virtual bool isStopped() const;
|
||||
virtual bool isPaused() const;
|
||||
virtual bool isPlaying() const;
|
||||
virtual bool isFinished() const;
|
||||
virtual bool update();
|
||||
virtual void setPitch(float pitch);
|
||||
|
||||
Reference in New Issue
Block a user