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:
parent
e7ddcaf876
commit
057de1544b
|
|
@ -73,6 +73,7 @@ namespace Nz
|
||||||
|
|
||||||
bool FillAndQueueBuffer(unsigned int buffer);
|
bool FillAndQueueBuffer(unsigned int buffer);
|
||||||
void MusicThread();
|
void MusicThread();
|
||||||
|
void StopThread();
|
||||||
|
|
||||||
static MusicLoader::LoaderList s_loaders;
|
static MusicLoader::LoaderList s_loaders;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
if (m_impl)
|
if (m_impl)
|
||||||
{
|
{
|
||||||
Stop();
|
StopThread();
|
||||||
|
|
||||||
delete m_impl;
|
delete m_impl;
|
||||||
m_impl = nullptr;
|
m_impl = nullptr;
|
||||||
|
|
@ -339,13 +339,8 @@ namespace Nz
|
||||||
{
|
{
|
||||||
NazaraAssert(m_impl, "Music not created");
|
NazaraAssert(m_impl, "Music not created");
|
||||||
|
|
||||||
if (m_impl->streaming)
|
StopThread();
|
||||||
{
|
SetPlayingOffset(0);
|
||||||
m_impl->streaming = false;
|
|
||||||
m_impl->thread.Join();
|
|
||||||
|
|
||||||
SetPlayingOffset(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Music::FillAndQueueBuffer(unsigned int buffer)
|
bool Music::FillAndQueueBuffer(unsigned int buffer)
|
||||||
|
|
@ -444,5 +439,14 @@ namespace Nz
|
||||||
alDeleteBuffers(NAZARA_AUDIO_STREAMED_BUFFER_COUNT, buffers);
|
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;
|
MusicLoader::LoaderList Music::s_loaders;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue