ScummVM API documentation
pc_speaker_stream.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_STREAM_H
23 #define NUVIE_SOUND_MIXER_DECODER_PC_SPEAKER_STREAM_H
24 
25 #include "ultima/shared/std/string.h"
26 #include "ultima/nuvie/sound/decoder/pc_speaker.h"
27 #include "audio/audiostream.h"
28 
29 namespace Ultima {
30 namespace Nuvie {
31 
33 public:
34  PCSpeakerStream() {
35  pcspkr = new PCSpeaker(SPKR_OUTPUT_RATE);
36  finished = false;
37  }
38 
39  ~PCSpeakerStream() override {
40  delete pcspkr;
41  }
42 
44  bool isStereo() const override {
45  return false;
46  }
47 
49  int getRate() const override {
50  return SPKR_OUTPUT_RATE;
51  }
52 
60  bool endOfData() const override {
61  return finished;
62  }
63 
64  bool rewind() override {
65  return false;
66  }
67 
68 protected:
69  PCSpeaker *pcspkr;
70  bool finished;
71 };
72 
73 
75 public:
77 
78  }
79 
80  PCSpeakerFreqStream(uint start, uint16 d);
81  ~PCSpeakerFreqStream() override;
82  uint32 getLengthInMsec();
83  int readBuffer(sint16 *buffer, const int numSamples) override;
84 
85 protected:
86 
87  uint32 frequency;
88  uint32 duration;
89  uint32 total_samples_played;
90 
91 };
92 
94 public:
96 
97  }
98 
99  PCSpeakerSweepFreqStream(uint start, uint end, uint16 d, uint16 s);
100  ~PCSpeakerSweepFreqStream() override;
101  uint32 getLengthInMsec();
102  int readBuffer(sint16 *buffer, const int numSamples) override;
103 
104 protected:
105 
106  uint32 start_freq;
107  uint32 finish_freq;
108  uint32 cur_freq;
109  uint16 duration;
110  uint16 stepping;
111 
112  uint32 freq_step;
113  float samples_per_step;
114  float sample_pos;
115  uint32 total_samples_played;
116  uint32 num_steps;
117  uint32 cur_step;
118 
119 };
120 
122 public:
124 
125  }
126 
127  PCSpeakerRandomStream(uint start, uint16 d, uint16 s);
128  ~PCSpeakerRandomStream() override;
129  uint32 getLengthInMsec();
130  uint16 getNextFreqValue();
131  int readBuffer(sint16 *buffer, const int numSamples) override;
132 
133 protected:
134 
135  uint16 base_val;
136  uint16 duration;
137  uint16 stepping;
138 
139  uint32 rand_value;
140  uint32 sample_pos;
141  uint32 total_samples_played;
142  uint32 samples_per_step;
143  uint32 num_steps;
144  uint32 cur_step;
145 
146 };
147 
149 public:
151 
152  }
153 
154  PCSpeakerStutterStream(sint16 a0, uint16 a2, uint16 a4, uint16 a6, uint16 a8);
155  ~PCSpeakerStutterStream() override;
156  uint32 getLengthInMsec();
157  int readBuffer(sint16 *buffer, const int numSamples) override;
158 
159 protected:
160 
161  sint16 arg_0;
162  uint16 arg_2;
163  uint16 arg_4;
164  uint16 arg_6;
165  uint16 arg_8;
166 
167  uint16 dx;
168  uint16 cx;
169  float delay;
170  float delay_remaining;
171 
172 };
173 
174 Audio::AudioStream *makePCSpeakerSlugDissolveSfxStream(uint rate);
175 Audio::AudioStream *makePCSpeakerGlassSfxStream(uint rate);
176 Audio::AudioStream *makePCSpeakerMagicCastingP1SfxStream(uint rate, uint8 magic_circle);
177 Audio::AudioStream *makePCSpeakerMagicCastingP2SfxStream(uint rate, uint8 magic_circle);
178 Audio::AudioStream *makePCSpeakerAvatarDeathSfxStream(uint rate);
179 Audio::AudioStream *makePCSpeakerKalLorSfxStream(uint rate);
180 Audio::AudioStream *makePCSpeakerHailStoneSfxStream(uint rate);
181 Audio::AudioStream *makePCSpeakerEarthQuakeSfxStream(uint rate);
182 
183 } // End of namespace Nuvie
184 } // End of namespace Ultima
185 
186 #endif
virtual int readBuffer(int16 *buffer, const int numSamples)=0
Definition: pc_speaker_stream.h:121
bool endOfData() const override
Definition: pc_speaker_stream.h:60
int getRate() const override
Definition: pc_speaker_stream.h:49
bool isStereo() const override
Definition: pc_speaker_stream.h:44
Definition: pc_speaker_stream.h:93
Definition: pc_speaker_stream.h:74
Definition: detection.h:27
Definition: pc_speaker.h:32
Definition: audiostream.h:50
Definition: pc_speaker_stream.h:148
Definition: audiostream.h:109
Definition: pc_speaker_stream.h:32
bool rewind() override
Definition: pc_speaker_stream.h:64