OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AdlibMusic.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_ADLIBMUSIC_H
20 #define OPENXCOM_ADLIBMUSIC_H
21 
22 #include "Music.h"
23 #include <map>
24 #include <string>
25 #include <SDL_mixer.h>
26 
27 namespace OpenXcom
28 {
29 
34 class AdlibMusic : public Music
35 {
36 private:
37  char *_data;
38  size_t _size;
39  float _volume;
40  static int delay, rate;
41  static std::map<int, int> delayRates;
42 public:
44  AdlibMusic(float volume = 1.0f);
46  ~AdlibMusic();
48  void load(const std::string &filename);
50  void load(const void *data, int size);
52  void play(int loop = -1) const;
54  static void player(void *udata, Uint8 *stream, int len);
55 };
56 
57 }
58 
59 #endif
Container for music tracks.
Definition: Music.h:32
void load(const std::string &filename)
Loads music from the specified file.
Definition: AdlibMusic.cpp:89
~AdlibMusic()
Cleans up the music track.
Definition: AdlibMusic.cpp:69
static void player(void *udata, Uint8 *stream, int len)
Adlib music player.
Definition: AdlibMusic.cpp:139
AdlibMusic(float volume=1.0f)
Creates a blank music track.
Definition: AdlibMusic.cpp:42
void play(int loop=-1) const
Plays the music.
Definition: AdlibMusic.cpp:120
Container for Adlib music tracks.
Definition: AdlibMusic.h:34