Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
soundstreamhandle.cpp
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : wwaudio *
24 * *
25 * $Archive:: /Commando/Code/WWAudio/soundstreamhandle.cpp $*
26 * *
27 * Author:: Patrick Smith *
28 * *
29 * $Modtime:: 8/23/01 4:47p $*
30 * *
31 * $Revision:: 2 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#include "soundstreamhandle.h"
38#include "audiblesound.h"
39
40
42//
43// SoundStreamHandleClass
44//
52
53
55//
56// ~SoundStreamHandleClass
57//
63
64
66//
67// Initialize
68//
70void
72{
74
75 if (Buffer != NULL) {
76
77 //
78 // Create a stream from the sample handle
79 //
80 StreamHandle = ::AIL_open_stream_by_sample (WWAudioClass::Get_Instance ()->Get_2D_Driver (),
81 SampleHandle, buffer->Get_Filename (), 0);
82
83 /*StreamHandle = ::AIL_open_stream (WWAudioClass::Get_Instance ()->Get_2D_Driver (),
84 buffer->Get_Filename (), 0);*/
85 }
86
87 return ;
88}
89
90
92//
93// Start_Sample
94//
96void
98{
99 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
100 ::AIL_start_stream (StreamHandle);
101 }
102 return ;
103}
104
105
107//
108// Stop_Sample
109//
111void
113{
114 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
115 ::AIL_pause_stream (StreamHandle, 1);
116 }
117 return ;
118}
119
120
122//
123// Resume_Sample
124//
126void
128{
129 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
130 ::AIL_pause_stream (StreamHandle, 0);
131 }
132 return ;
133}
134
135
137//
138// End_Sample
139//
141void
143{
144 //
145 // Stop the sample and then release our hold on the stream handle
146 //
147 Stop_Sample ();
148
149 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
150 ::AIL_close_stream (StreamHandle);
152 }
153 return ;
154}
155
156
158//
159// Set_Sample_Pan
160//
162void
164{
165 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
166 ::AIL_set_stream_pan (StreamHandle, pan);
167 }
168 return ;
169}
170
171
173//
174// Get_Sample_Pan
175//
177S32
179{
180 S32 retval = 0;
181
182 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
183 retval = ::AIL_stream_pan (StreamHandle);
184 }
185
186 return retval;
187}
188
189
191//
192// Set_Sample_Volume
193//
195void
197{
198 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
199 ::AIL_set_stream_volume (StreamHandle, volume);
200 }
201 return ;
202}
203
204
206//
207// Get_Sample_Volume
208//
210S32
212{
213 S32 retval = 0;
214
215 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
216 retval = ::AIL_stream_volume (StreamHandle);
217 }
218
219 return retval;
220}
221
222
224//
225// Set_Sample_Loop_Count
226//
228void
230{
231 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
232 ::AIL_set_stream_loop_block (StreamHandle, 0, -1);
233 ::AIL_set_stream_loop_count (StreamHandle, count);
234 }
235 return ;
236}
237
238
240//
241// Get_Sample_Loop_Count
242//
244U32
246{
247 U32 retval = 0;
248
249 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
250 ::AIL_stream_loop_count (StreamHandle);
251 }
252
253 return retval;
254}
255
256
258//
259// Set_Sample_MS_Position
260//
262void
264{
265 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
266 ::AIL_set_stream_ms_position (StreamHandle, ms);
267 }
268 return ;
269}
270
271
273//
274// Get_Sample_MS_Position
275//
277void
279{
280 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
281 ::AIL_stream_ms_position (StreamHandle, len, pos);
282 }
283
284 return ;
285}
286
287
289//
290// Set_Sample_User_Data
291//
293void
295{
296 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
297 ::AIL_set_sample_user_data (SampleHandle, i, val);
298 }
299
300 return ;
301}
302
303
305//
306// Get_Sample_User_Data
307//
309U32
311{
312 U32 retval = 0;
313
314 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
315 retval = ::AIL_sample_user_data (SampleHandle, i);
316 }
317
318 return retval;
319}
320
321
323//
324// Get_Sample_Playback_Rate
325//
327S32
329{
330 S32 retval = 0;
331
332 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
333 retval = ::AIL_stream_playback_rate (StreamHandle);
334 }
335
336 return retval;
337}
338
339
341//
342// Set_Sample_Playback_Rate
343//
345void
347{
348 if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) {
349 ::AIL_set_stream_playback_rate (StreamHandle, rate);
350 }
351
352 return ;
353}
354
355
357//
358// Set_Miles_Handle
359//
361void
363{
364 SampleHandle = (HSAMPLE)handle;
365 return ;
366}
const MILES_HANDLE INVALID_MILES_HANDLE
#define NULL
Definition BaseType.h:92
unsigned long uint32
Definition bittype.h:46
SoundBufferClass * Buffer
virtual void Initialize(SoundBufferClass *buffer)
void Set_Miles_Handle(uint32 handle)
void Set_Sample_Volume(S32 volume)
void Initialize(SoundBufferClass *buffer)
void Set_Sample_Loop_Count(U32 count)
void Set_Sample_User_Data(S32 i, U32 val)
void Set_Sample_Playback_Rate(S32 rate)
void Get_Sample_MS_Position(S32 *len, S32 *pos)
static WWAudioClass * Get_Instance(void)
Definition WWAudio.h:174
#define S32
Definition md5.cpp:62
else return(RetVal)