1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003-2004 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef AUDIO_H_INCLUDED
22 #define AUDIO_H_INCLUDED
30 #define GEM_SND_RELATIVE 1
31 #define GEM_SND_LOOPING 2
32 #define GEM_SND_SPEECH IE_STR_SPEECH // 4
33 #define GEM_SND_VOL_MUSIC 1
34 #define GEM_SND_VOL_AMBIENTS 2
39 class GEM_EXPORT SoundHandle
: public Held
<SoundHandle
> {
41 virtual bool Playing() = 0;
42 virtual void SetPos(int XPos
, int YPos
) = 0;
43 virtual void Stop() = 0;
44 virtual void StopLooping() = 0;
45 virtual ~SoundHandle();
48 class GEM_EXPORT Audio
: public Plugin
{
50 static const TypeID ID
;
54 virtual bool Init(void) = 0;
55 virtual Holder
<SoundHandle
> Play(const char* ResRef
, int XPos
, int YPos
, unsigned int flags
= 0, unsigned int *length
= 0) = 0;
56 virtual Holder
<SoundHandle
> Play(const char* ResRef
, unsigned int *length
= 0) { return Play(ResRef
, 0, 0, GEM_SND_RELATIVE
, length
); }
57 virtual bool IsSpeaking() = 0;
58 virtual AmbientMgr
* GetAmbientMgr() { return ambim
; }
59 virtual void UpdateVolume(unsigned int flags
= GEM_SND_VOL_MUSIC
| GEM_SND_VOL_AMBIENTS
) = 0;
60 virtual bool CanPlay() = 0;
61 virtual void ResetMusics() = 0;
62 virtual bool Play() = 0;
63 virtual bool Stop() = 0;
64 virtual int CreateStream(Holder
<SoundMgr
>) = 0;
65 virtual void UpdateListenerPos(int XPos
, int YPos
) = 0;
66 virtual void GetListenerPos(int &XPos
, int &YPos
) = 0;
67 virtual bool ReleaseStream(int stream
, bool HardStop
=false ) = 0;
68 virtual int SetupNewStream( ieWord x
, ieWord y
, ieWord z
,
69 ieWord gain
, bool point
, bool Ambient
) = 0;
70 virtual int QueueAmbient(int stream
, const char* sound
) = 0;
71 virtual void SetAmbientStreamVolume(int stream
, int volume
) = 0;
72 virtual void QueueBuffer(int stream
, unsigned short bits
,
73 int channels
, short* memory
, int size
, int samplerate
) = 0;
80 #endif // AUDIO_H_INCLUDED