00001
00027 #ifndef SOUND_ALSA_H
00028 #define SOUND_ALSA_H 1
00029
00030
00031 #include <dmn/sound.h>
00032
00033 #include "soundogg.h"
00034
00035 #include <alsa/asoundlib.h>
00036
00037 namespace dmn
00038 {
00044 class SoundAlsa: public Sound
00045 {
00046 private:
00048 struct data_pcm_t {
00049 char *buffer;
00050 unsigned long length;
00051 };
00052
00053 Core *core_;
00054 snd_pcm_t *playback_handle_;
00055 data_pcm_t *mix_, *play_domino_, *pass_;
00066 data_pcm_t *new_pcm(char *filename, short *channels, unsigned long *rate);
00067
00076 int init_alsa(short channels, unsigned long rate);
00077
00081 void end_alsa();
00082
00091 int play_alsa(char buffer[], int length);
00092
00093 public:
00097 SoundAlsa();
00098
00102 SoundAlsa::~SoundAlsa();
00103
00104 bool configure(Core *core);
00105 void mix_dominoes();
00106 void domino_played(ID player, Domino domino, HalfDomino half);
00107 void player_pass(ID player);
00108 };
00109 };
00110
00111 #endif // SOUND_ALSA_H