1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef AGI_SOUND_COCO3_H
24 #define AGI_SOUND_COCO3_H
25 
26 #include "audio/audiostream.h"
27 
28 namespace Agi {
29 
30 struct CoCoNote {
31 	uint8  freq;
32 	uint8  volume;
33 	uint16 duration;    ///< Note duration
34 
35 	/** Reads a CoCoNote through the given pointer. */
readCoCoNote36 	void read(const uint8 *ptr) {
37 		freq = *ptr;
38 		volume = *(ptr + 1);
39 		duration = READ_LE_UINT16(ptr + 2);
40 	}
41 };
42 
43 class SoundGenCoCo3 : public SoundGen, public Audio::AudioStream {
44 public:
45 	SoundGenCoCo3(AgiBase *vm, Audio::Mixer *pMixer);
46 	~SoundGenCoCo3();
47 
48 	void play(int resnum);
49 	void stop(void);
50 
51 	// AudioStream API
52 	int readBuffer(int16 *buffer, const int numSamples);
53 
isStereo()54 	bool isStereo() const {
55 		return false;
56 	}
57 
endOfData()58 	bool endOfData() const {
59 		return false;
60 	}
61 
getRate()62 	int getRate() const {
63 		// FIXME: Ideally, we should use _sampleRate.
64 		return 22050;
65 	}
66 };
67 
68 } // End of namespace Agi
69 
70 #endif /* AGI_SOUND_COCO3_H */
71