1 | /** |
2 | * Copyright (c) 2006-2023 LOVE Development Team |
3 | * |
4 | * This software is provided 'as-is', without any express or implied |
5 | * warranty. In no event will the authors be held liable for any damages |
6 | * arising from the use of this software. |
7 | * |
8 | * Permission is granted to anyone to use this software for any purpose, |
9 | * including commercial applications, and to alter it and redistribute it |
10 | * freely, subject to the following restrictions: |
11 | * |
12 | * 1. The origin of this software must not be misrepresented; you must not |
13 | * claim that you wrote the original software. If you use this software |
14 | * in a product, an acknowledgment in the product documentation would be |
15 | * appreciated but is not required. |
16 | * 2. Altered source versions must be plainly marked as such, and must not be |
17 | * misrepresented as being the original software. |
18 | * 3. This notice may not be removed or altered from any source distribution. |
19 | **/ |
20 | |
21 | #ifndef LOVE_SOUND_LULLABY_GME_DECODER_H |
22 | #define LOVE_SOUND_LULLABY_GME_DECODER_H |
23 | |
24 | #ifdef LOVE_SUPPORT_GME |
25 | |
26 | // LOVE |
27 | #include "common/Data.h" |
28 | #include "sound/Decoder.h" |
29 | |
30 | #ifdef LOVE_APPLE_USE_FRAMEWORKS |
31 | #include <Game_Music_Emu/gme.h> |
32 | #else |
33 | #include <gme.h> |
34 | #endif |
35 | |
36 | namespace love |
37 | { |
38 | namespace sound |
39 | { |
40 | namespace lullaby |
41 | { |
42 | |
43 | class GmeDecoder : public Decoder |
44 | { |
45 | public: |
46 | |
47 | GmeDecoder(Data *data, int bufferSize); |
48 | virtual ~GmeDecoder(); |
49 | |
50 | static bool accepts(const std::string &ext); |
51 | |
52 | love::sound::Decoder *clone(); |
53 | int decode(); |
54 | bool seek(double s); |
55 | bool rewind(); |
56 | bool isSeekable(); |
57 | int getChannelCount() const; |
58 | int getBitDepth() const; |
59 | double getDuration(); |
60 | |
61 | private: |
62 | Music_Emu *emu; |
63 | int num_tracks; |
64 | int cur_track; |
65 | }; // Decoder |
66 | |
67 | } // lullaby |
68 | } // sound |
69 | } // love |
70 | |
71 | #endif // LOVE_SUPPORT_GME |
72 | |
73 | #endif // LOVE_SOUND_LULLABY_GME_DECODER_H |
74 | |