TORCS  1.3.9
The Open Racing Car Simulator
OpenALMusicPlayer.h
Go to the documentation of this file.
1 #ifndef __OpenALMusicPlayer_h__
2 #define __OpenALMusicPlayer_h__
3 
4 /***************************************************************************
5 
6  file : OpenAlMusicPlayer.h
7  created : Fri Dec 23 17:35:18 CET 2011
8  copyright : (C) 2011 Bernhard Wymann
9  email : berniw@bluewin.ch
10  version : $Id$
11 
12  ***************************************************************************/
13 
14 /***************************************************************************
15  * *
16  * This program is free software; you can redistribute it and/or modify *
17  * it under the terms of the GNU General Public License as published by *
18  * the Free Software Foundation; either version 2 of the License, or *
19  * (at your option) any later version. *
20  * *
21  ***************************************************************************/
22 
23 #include <AL/al.h>
24 #include <AL/alc.h>
25 #include "SoundStream.h"
26 
28 {
29  public:
30  OpenALMusicPlayer(SoundStream* soundStream);
31  virtual ~OpenALMusicPlayer();
32 
33  virtual void start();
34  virtual void stop();
35  virtual void rewind();
36  virtual bool playAndManageBuffer();
37 
38  protected:
39  virtual bool initContext();
40  virtual bool initBuffers();
41  virtual bool initSource();
42  virtual bool check();
43  virtual bool startPlayback();
44  virtual bool isPlaying();
45  virtual bool streamBuffer(ALuint buffer);
46 
47  ALCdevice* device;
48  ALCcontext* context;
49  ALuint source; // audio source
50  ALuint buffers[2]; // front and back buffers
51 
53  bool ready; // initialization sucessful
54  static const int BUFFERSIZE;
55 };
56 #endif // __OpenALMusicPlayer_h__
OpenALMusicPlayer(SoundStream *soundStream)
SoundStream * stream
virtual bool initBuffers()
ALCcontext * context
virtual bool initSource()
virtual bool initContext()
virtual bool startPlayback()
virtual bool streamBuffer(ALuint buffer)
virtual bool isPlaying()
virtual bool playAndManageBuffer()
static const int BUFFERSIZE