1 /* 2 * Seven Kingdoms: Ancient Adversaries 3 * 4 * Copyright 1997,1998 Enlight Software Ltd. 5 * Copyright 2010 Unavowed <unavowed@vexillium.org> 6 * 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * 20 */ 21 #ifndef AUDIO_BASE_H 22 #define AUDIO_BASE_H 23 24 #include <ORESX.h> 25 #include <OVOLUME.h> 26 27 class AudioBase 28 { 29 public: 30 bool init_flag; 31 32 bool mid_init_flag; // whether the midi driver has been installed 33 bool wav_init_flag; // whether the wave driver has been installed 34 bool cd_init_flag; 35 36 // flag determing whether MIDI music should be playing 37 bool mid_flag; 38 39 // flag determing whether WAV sound effects should be playing 40 bool wav_flag; 41 42 // flag determing whether Audio CD track should be playing 43 bool cd_flag; 44 45 ResourceIdx wav_res; 46 47 public: ~AudioBase()48 virtual ~AudioBase() {}; 49 50 virtual int init() = 0; 51 virtual void deinit() = 0; 52 53 virtual void yield() = 0; // called by sys every some time 54 55 virtual int play_mid(char *) = 0; 56 57 // functions on short wave 58 virtual int play_wav(char *, const DsVolume &) = 0; 59 virtual int play_wav(short resIdx, const DsVolume &) = 0; 60 virtual int play_resided_wav(char *, const DsVolume &) = 0; 61 virtual int get_free_wav_ch() = 0; 62 virtual int stop_wav(int) = 0; 63 virtual int is_wav_playing(int) = 0; 64 65 // functions on long wave 66 virtual int play_long_wav(const char *, const DsVolume &) = 0; 67 virtual int stop_long_wav(int) = 0; 68 virtual int is_long_wav_playing(int) = 0; 69 virtual void volume_long_wav(int ch, const DsVolume &) = 0; 70 71 // functions on loop wave 72 virtual int play_loop_wav(const char *, int repeatOffset, 73 const DsVolume &) = 0; 74 virtual void stop_loop_wav(int ch) = 0; 75 virtual void volume_loop_wav(int ch, const DsVolume &) = 0; 76 virtual void fade_out_loop_wav(int ch, int fadeRate) = 0; 77 virtual DsVolume get_loop_wav_volume(int ch) = 0; 78 virtual int is_loop_wav_fading(int ch) = 0; 79 80 virtual int play_cd(int, int retVolume) = 0; 81 82 virtual void stop_mid() = 0; 83 virtual void stop_wav() = 0; // and stop also long wav 84 virtual void stop_cd() = 0; 85 86 virtual int is_mid_playing() = 0; 87 virtual int is_wav_playing() = 0; 88 virtual int is_cd_playing() = 0; 89 90 virtual void toggle_mid(bool) = 0; 91 virtual void toggle_wav(bool) = 0; 92 virtual void toggle_cd(bool) = 0; 93 94 virtual void set_mid_volume(int) = 0; 95 virtual void set_wav_volume(int) = 0; // 0 to 100 96 virtual void set_cd_volume(int) = 0; 97 98 virtual int get_wav_volume() const = 0; // 0 to 100 99 }; 100 101 #endif 102