Audio/Music: Fix Stop not resetting playing offset if music was already stopped
Also prevented a useless seek at destruction
This commit is contained in:
@@ -73,6 +73,7 @@ namespace Nz
|
||||
|
||||
bool FillAndQueueBuffer(unsigned int buffer);
|
||||
void MusicThread();
|
||||
void StopThread();
|
||||
|
||||
static MusicLoader::LoaderList s_loaders;
|
||||
};
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Nz
|
||||
{
|
||||
if (m_impl)
|
||||
{
|
||||
Stop();
|
||||
StopThread();
|
||||
|
||||
delete m_impl;
|
||||
m_impl = nullptr;
|
||||
@@ -339,14 +339,9 @@ namespace Nz
|
||||
{
|
||||
NazaraAssert(m_impl, "Music not created");
|
||||
|
||||
if (m_impl->streaming)
|
||||
{
|
||||
m_impl->streaming = false;
|
||||
m_impl->thread.Join();
|
||||
|
||||
StopThread();
|
||||
SetPlayingOffset(0);
|
||||
}
|
||||
}
|
||||
|
||||
bool Music::FillAndQueueBuffer(unsigned int buffer)
|
||||
{
|
||||
@@ -444,5 +439,14 @@ namespace Nz
|
||||
alDeleteBuffers(NAZARA_AUDIO_STREAMED_BUFFER_COUNT, buffers);
|
||||
}
|
||||
|
||||
void Music::StopThread()
|
||||
{
|
||||
if (m_impl->streaming)
|
||||
{
|
||||
m_impl->streaming = false;
|
||||
m_impl->thread.Join();
|
||||
}
|
||||
}
|
||||
|
||||
MusicLoader::LoaderList Music::s_loaders;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user