changed copyright years in source files
[fegdk.git] / core / code / audio / openal / openalsounddriver.h
bloba3f9b22559c7dbc23fd7deaa99abb677960950a7
1 /*
2 fegdk: FE Game Development Kit
3 Copyright (C) 2001-2008 Alexey "waker" Yakovenko
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 Alexander Maltsev
20 keltar@users.sourceforge.net
23 #ifndef __F_OPENALSOUNDDRIVER_H
24 #define __F_OPENALSOUNDDRIVER_H
26 #include "basesounddriver.h"
28 namespace fe
31 class openalSoundDriverData;
32 class openalSoundDriver;
34 class FE_API openalSoundBuffer : public baseSoundBuffer
36 private:
37 bool mbPaused;
38 std::vector <uint> mSourceIds;
39 int mNumBuffers;
40 struct buffer_t
42 uint id;
43 buffer_t *next;
45 buffer_t* mpBuffers;
46 buffer_t* mpCurrentBuffer;
47 bool mbLooping;
48 genericCallback *mpFeeder;
49 openalSoundDriver* mpDriver;
50 float mVolume;
52 void addBuffer (void);
53 void freeBuffers (void);
54 buffer_t *getNextBuffer (buffer_t *buffer);
55 public:
56 openalSoundBuffer (openalSoundDriver *driver, int freq, int sample_rate, bool stereo, size_t size, bool streaming);
57 ~openalSoundBuffer (void);
59 void write (void *data, int size, int fmt, int sample_rate);
60 void setLooping (bool onOff);
61 void play (void);
62 void stop (void);
63 int getChannelsCount (void) const;
64 bool isPlaying (void) const;
65 void setFeeder (genericCallback *callback);
66 void update (void);
67 void setVolume (float vol);
68 void setMaxSources (int num);
69 void pause (bool onoff);
70 int getNumBuffers (void) const;
73 class FE_API openalSoundDriver : public baseSoundDriver
75 friend class openalSoundBuffer;
76 private:
77 openalSoundDriverData *mpData;
78 openalSoundBuffer** mpBuffers;
79 int mMaxBuffers;
80 int mNumBuffers;
82 protected:
84 void addBuffer (openalSoundBuffer *buf);
85 void removeBuffer (openalSoundBuffer *buf);
87 public:
88 openalSoundDriver (void);
89 ~openalSoundDriver (void);
91 void update (void);
92 // openalSoundDriverData *getData (void);
93 openalSoundBuffer* createBuffer (int freq, int sample_rate, bool stereo, size_t size, bool streaming);
95 protected:
96 void createPool ();
101 #endif // __F_OPENALSOUNDDRIVER_H