dungeon_crawler

view prototype/src/audio/stream.h @ 54:995191474cc0

writting the stream audio player
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 19 Sep 2012 05:22:43 +0300
parents 1ea56011c1ff
children 4c427e28ca00
line source
1 #ifndef AUDIO_STREAM_H_
2 #define AUDIO_STREAM_H_
4 #include <thread>
6 struct AudioStreamBuffer {
7 void *samples;
8 int num_samples;
9 int channels;
10 int sample_rate;
11 };
13 class AudioStream {
14 private:
15 std::thread play_thread;
16 bool done, loop;
17 unsigned int poll_interval;
18 unsigned int alsrc;
20 virtual bool more_samples(AudioStreamBuffer *buf) = 0;
22 void poll_loop();
24 public:
25 AudioStream();
26 virtual ~AudioStream();
28 void play(bool loop = false);
29 void stop();
31 virtual void rewind() = 0;
32 };
34 #endif // AUDIO_STREAM_H_