// Copyright (C) 2015 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 #pragma once #ifndef NAZARA_MUSIC_HPP #define NAZARA_MUSIC_HPP #include #include #include #include #include struct NzMusicParams { bool forceMono = false; bool IsValid() const; }; class NzMusic; class NzSoundStream; using NzMusicLoader = NzResourceLoader; struct NzMusicImpl; class NAZARA_AUDIO_API NzMusic : public NzResource, public NzSoundEmitter { friend NzMusicLoader; public: NzMusic() = default; NzMusic(const NzMusic&) = delete; NzMusic(NzMusic&&) = delete; ///TODO ~NzMusic(); bool Create(NzSoundStream* soundStream); void Destroy(); void EnableLooping(bool loop); nzUInt32 GetDuration() const; nzAudioFormat GetFormat() const; nzUInt32 GetPlayingOffset() const; nzUInt32 GetSampleCount() const; nzUInt32 GetSampleRate() const; nzSoundStatus GetStatus() const; bool IsLooping() const; bool OpenFromFile(const NzString& filePath, const NzMusicParams& params = NzMusicParams()); bool OpenFromMemory(const void* data, std::size_t size, const NzMusicParams& params = NzMusicParams()); bool OpenFromStream(NzInputStream& stream, const NzMusicParams& params = NzMusicParams()); void Pause(); void Play(); void SetPlayingOffset(nzUInt32 offset); void Stop(); NzMusic& operator=(const NzMusic&) = delete; NzMusic& operator=(NzMusic&&) = delete; ///TODO private: NzMusicImpl* m_impl = nullptr; bool FillAndQueueBuffer(unsigned int buffer); void MusicThread(); static NzMusicLoader::LoaderList s_loaders; }; #endif // NAZARA_MUSIC_HPP