1 /*
2  * Seven Kingdoms: Ancient Adversaries
3  * AudioStream
4  *
5  * Copyright 2010 Unavowed <unavowed@vexillium.org>
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #include <stddef.h>
23 #include <stdint.h>
24 
25 #ifndef AUDIO_STREAM_H
26 #define AUDIO_STREAM_H
27 
28 class AudioStream
29 {
30 public:
~AudioStream()31 	virtual ~AudioStream() {};
32 	virtual long read(void *buffer, size_t frame_count) = 0;
33 	virtual bool seek(size_t frame_no) = 0;
34 	virtual int32_t frame_rate() const = 0; /* in PCM frames per sec */
35 	virtual int channels() const = 0;
36 	virtual int sample_size() const = 0;    /* in bytes */
37 
frame_size()38 	int frame_size() const
39 	{
40 		return (this->channels() * this->sample_size());
41 	}
42 };
43 
44 #endif
45