ScummVM API documentation
pc_speaker.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 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 #ifndef NUVIE_SOUND_MIXER_DECODER_PC_SPEAKER_H
23 #define NUVIE_SOUND_MIXER_DECODER_PC_SPEAKER_H
24 
25 #include "ultima/nuvie/files/nuvie_io_file.h"
26 
27 namespace Ultima {
28 namespace Nuvie {
29 
30 #define SPKR_OUTPUT_RATE 22050 //11025 //FIXME may need to fiddle with this.
31 
32 class PCSpeaker {
33 private:
34  uint32 rate;
35  uint16 frequency;
36  float half_period;
37  float cur_vol;
38  float want_vol;
39  float time_left;
40 
41  uint32 osc_length;
42  uint32 osc_samples;
43 
44 private:
45 
46  NuvieIOFileWrite dataFile;
47  uint32 wav_length;
48 
49 public:
50  PCSpeaker(uint32 mixer_rate);
51  ~PCSpeaker() { }
52  void SetOn();
53  void SetOff();
54  void SetFrequency(uint16 freq, float offset = 0.0f);
55 
56  void PCSPEAKER_CallBack(sint16 *stream, const uint32 len);
57 };
58 
59 } // End of namespace Nuvie
60 } // End of namespace Ultima
61 
62 #endif
Definition: nuvie_io_file.h:75
Definition: detection.h:27
Definition: pc_speaker.h:32