7 #ifndef NAZARA_SOUNDBUFFER_HPP 8 #define NAZARA_SOUNDBUFFER_HPP 10 #include <Nazara/Prerequesites.hpp> 11 #include <Nazara/Audio/Config.hpp> 12 #include <Nazara/Audio/Enums.hpp> 13 #include <Nazara/Core/MovablePtr.hpp> 14 #include <Nazara/Core/ObjectRef.hpp> 15 #include <Nazara/Core/ObjectLibrary.hpp> 16 #include <Nazara/Core/RefCounted.hpp> 17 #include <Nazara/Core/Resource.hpp> 18 #include <Nazara/Core/ResourceLoader.hpp> 19 #include <Nazara/Core/ResourceManager.hpp> 20 #include <Nazara/Core/ResourceParameters.hpp> 21 #include <Nazara/Core/Signal.hpp> 25 struct SoundBufferParams : ResourceParameters
27 bool forceMono =
false;
35 using SoundBufferConstRef = ObjectRef<const SoundBuffer>;
36 using SoundBufferLibrary = ObjectLibrary<SoundBuffer>;
37 using SoundBufferLoader = ResourceLoader<SoundBuffer, SoundBufferParams>;
38 using SoundBufferManager = ResourceManager<SoundBuffer, SoundBufferParams>;
39 using SoundBufferRef = ObjectRef<SoundBuffer>;
41 struct SoundBufferImpl;
46 friend SoundBufferLibrary;
58 bool Create(
AudioFormat format, UInt64 sampleCount, UInt32 sampleRate,
const Int16* samples);
61 UInt32 GetDuration()
const;
63 const Int16* GetSamples()
const;
64 UInt64 GetSampleCount()
const;
65 UInt32 GetSampleRate()
const;
69 bool LoadFromFile(
const String& filePath,
const SoundBufferParams& params = SoundBufferParams());
70 bool LoadFromMemory(
const void* data, std::size_t size,
const SoundBufferParams& params = SoundBufferParams());
71 bool LoadFromStream(
Stream& stream,
const SoundBufferParams& params = SoundBufferParams());
74 template<
typename... Args>
static SoundBufferRef New(Args&&... args);
80 NazaraSignal(OnSoundBufferDestroy,
const SoundBuffer* );
81 NazaraSignal(OnSoundBufferRelease,
const SoundBuffer* );
84 unsigned int GetOpenALBuffer()
const;
86 static bool Initialize();
87 static void Uninitialize();
91 static SoundBufferLibrary::LibraryMap s_library;
92 static SoundBufferLoader::LoaderList s_loaders;
93 static SoundBufferManager::ManagerMap s_managerMap;
94 static SoundBufferManager::ManagerParams s_managerParameters;
98 #include <Nazara/Audio/SoundBuffer.inl> 100 #endif // NAZARA_SOUNDBUFFER_HPP TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
AudioFormat
WARNING: The integer value is the number of canals owned by the format.
Definition: Enums.hpp:12
Core class that represents a string.
Definition: String.hpp:22
Audio class that represents the module initializer of Audio.
Definition: Audio.hpp:18
Core class that represents a loader of resources.
Definition: ResourceLoader.hpp:23
Core class that represents a resource.
Definition: Resource.hpp:15
Core class that represents a reference with a counter.
Definition: RefCounted.hpp:21
Core class that represents a reference to an object.
Definition: ObjectRef.hpp:18
Audio class that represents a sound.
Definition: Sound.hpp:17
Core class that represents a resource manager.
Definition: ResourceManager.hpp:18
Audio class that represents a buffer for sound.
Definition: SoundBuffer.hpp:43
Core class that represents a stream.
Definition: Stream.hpp:19