Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
Sound.cpp
1/*
2Copyright (C) 2017,2018,2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#include "aeongames/Sound.hpp"
17#include "aeongames/Utilities.hpp"
18#include "aeongames/ResourceCache.hpp"
19#include "Decoder.h"
20#include <unordered_map>
21#include <utility>
22
23namespace AeonGames
24{
25 bool RegisterSoundDecoder ( const std::string& aMagick, const std::function < bool ( Sound&, size_t, const void* ) > & aDecoder )
26 {
27 return Decoder<Sound>::RegisterDecoder ( aMagick, aDecoder );
28 }
29
30 bool UnregisterSoundDecoder ( const std::string& aMagick )
31 {
32 return Decoder<Sound>::UnregisterDecoder ( aMagick );
33 }
34
40 bool DecodeSound ( Sound& aSound, const void* aBuffer, size_t aBufferSize )
41 {
42 return Decoder<Sound>::Decode ( aSound, aBuffer, aBufferSize );
43 }
44
45 bool DecodeSound ( Sound& aSound, const std::string& aFileName )
46 {
47 return Decoder<Sound>::Decode ( aSound, aFileName );
48 }
49}
static bool Decode(T &aOutput, uint32_t aId)
Decodes a resource identified by its CRC32 id.
Definition Decoder.h:39
static bool RegisterDecoder(const std::string &aMagick, const std::function< bool(T &, size_t, const void *) > &aDecoder)
Registers a decoder function for the given magic byte sequence.
Definition Decoder.h:88
static bool UnregisterDecoder(const std::string &aMagick)
Unregisters the decoder for the given magic byte sequence.
Definition Decoder.h:105
Abstract base class representing a decoded sound resource.
Definition Sound.hpp:27
<- This is here just for the literals
Definition AABB.hpp:31
DLL bool RegisterSoundDecoder(const std::string &aMagick, const std::function< bool(Sound &, size_t, const void *) > &aDecoder)
Register a sound decoder for the given magic identifier.
Definition Sound.cpp:25
DLL bool DecodeSound(Sound &aSound, size_t aBufferSize, const void *aBuffer)
Decode sound data from a memory buffer.
DLL bool UnregisterSoundDecoder(const std::string &aMagick)
Unregister a previously registered sound decoder.
Definition Sound.cpp:30