Audio: Minor fixes
This commit is contained in:
parent
d121393267
commit
28f1d8aa76
|
|
@ -32,7 +32,6 @@ namespace Nz
|
||||||
|
|
||||||
bool IsLooping() const override;
|
bool IsLooping() const override;
|
||||||
bool IsPlayable() const;
|
bool IsPlayable() const;
|
||||||
bool IsPlaying() const;
|
|
||||||
|
|
||||||
bool LoadFromFile(const std::filesystem::path& filePath, const SoundBufferParams& params = SoundBufferParams());
|
bool LoadFromFile(const std::filesystem::path& filePath, const SoundBufferParams& params = SoundBufferParams());
|
||||||
bool LoadFromMemory(const void* data, std::size_t size, const SoundBufferParams& params = SoundBufferParams());
|
bool LoadFromMemory(const void* data, std::size_t size, const SoundBufferParams& params = SoundBufferParams());
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ namespace Nz
|
||||||
float GetVolume() const;
|
float GetVolume() const;
|
||||||
|
|
||||||
virtual bool IsLooping() const = 0;
|
virtual bool IsLooping() const = 0;
|
||||||
|
inline bool IsPlaying() const;
|
||||||
bool IsSpatialized() const;
|
bool IsSpatialized() const;
|
||||||
|
|
||||||
virtual void Pause() = 0;
|
virtual void Pause() = 0;
|
||||||
|
|
@ -67,4 +68,7 @@ namespace Nz
|
||||||
unsigned int m_source;
|
unsigned int m_source;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Audio/SoundEmitter.inl>
|
||||||
|
|
||||||
#endif // NAZARA_SOUNDEMITTER_HPP
|
#endif // NAZARA_SOUNDEMITTER_HPP
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Audio module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Audio/SoundEmitter.hpp>
|
||||||
|
#include <Nazara/Audio/Debug.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
/*!
|
||||||
|
* \brief Checks whether the sound is playing
|
||||||
|
* \return true if it is the case
|
||||||
|
*/
|
||||||
|
bool SoundEmitter::IsPlaying() const
|
||||||
|
{
|
||||||
|
return GetStatus() == SoundStatus::Playing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Audio/DebugOff.hpp>
|
||||||
|
|
@ -308,7 +308,7 @@ namespace Nz
|
||||||
|
|
||||||
std::shared_ptr<SoundStream> LoadSoundStreamStream(Stream& stream, const SoundStreamParams& parameters)
|
std::shared_ptr<SoundStream> LoadSoundStreamStream(Stream& stream, const SoundStreamParams& parameters)
|
||||||
{
|
{
|
||||||
std::unique_ptr<sndfileStream> soundStream(new sndfileStream);
|
std::shared_ptr<sndfileStream> soundStream = std::make_shared<sndfileStream>();
|
||||||
if (!soundStream->Open(stream, parameters.forceMono))
|
if (!soundStream->Open(stream, parameters.forceMono))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to open music stream");
|
NazaraError("Failed to open music stream");
|
||||||
|
|
|
||||||
|
|
@ -497,9 +497,9 @@ namespace Nz
|
||||||
void Music::StopThread()
|
void Music::StopThread()
|
||||||
{
|
{
|
||||||
if (m_impl->streaming)
|
if (m_impl->streaming)
|
||||||
{
|
|
||||||
m_impl->streaming = false;
|
m_impl->streaming = false;
|
||||||
|
|
||||||
|
if (m_impl->thread.joinable())
|
||||||
m_impl->thread.join();
|
m_impl->thread.join();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -119,15 +119,6 @@ namespace Nz
|
||||||
return m_buffer != nullptr;
|
return m_buffer != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Checks whether the sound is playing
|
|
||||||
* \return true if it is the case
|
|
||||||
*/
|
|
||||||
bool Sound::IsPlaying() const
|
|
||||||
{
|
|
||||||
return GetStatus() == SoundStatus::Playing;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Loads the sound from file
|
* \brief Loads the sound from file
|
||||||
* \return true if loading is successful
|
* \return true if loading is successful
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue