Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
sound2dhandle.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/sound2dhandle.cpp $*
26 * *
27 * Author:: Patrick Smith *
28 * *
29 * $Modtime:: 8/23/01 5:07p $*
30 * *
31 * $Revision:: 2 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#include "sound2dhandle.h"
38#include "audiblesound.h"
39
40
42//
43// Sound2DHandleClass
44//
51
52
54//
55// ~Sound2DHandleClass
56//
62
63
65//
66// Initialize
67//
69void
71{
73
74 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
75
76 //
77 // Make sure this handle is fresh
78 //
79 ::AIL_init_sample (SampleHandle);
80
81 //
82 // Pass the actual sound data onto the sample
83 //
84 if (Buffer != NULL) {
85 ::AIL_set_named_sample_file (SampleHandle, (char *)Buffer->Get_Filename (),
86 Buffer->Get_Raw_Buffer (), Buffer->Get_Raw_Length (), 0);
87 }
88 }
89
90 return ;
91}
92
93
95//
96// Start_Sample
97//
99void
101{
102 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
103 ::AIL_start_sample (SampleHandle);
104 }
105
106 return ;
107}
108
109
111//
112// Stop_Sample
113//
115void
117{
118 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
119 ::AIL_stop_sample (SampleHandle);
120 }
121
122 return ;
123}
124
125
127//
128// Resume_Sample
129//
131void
133{
134 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
135 ::AIL_resume_sample (SampleHandle);
136 }
137
138 return ;
139}
140
141
143//
144// End_Sample
145//
147void
149{
150 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
151 ::AIL_end_sample (SampleHandle);
152 }
153
154 return ;
155}
156
157
159//
160// Set_Sample_Pan
161//
163void
165{
166 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
167 ::AIL_set_sample_pan (SampleHandle, pan);
168 }
169
170 return ;
171}
172
173
175//
176// Get_Sample_Pan
177//
179S32
181{
182 S32 retval = 0;
183
184 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
185 retval = ::AIL_sample_pan (SampleHandle);
186 }
187
188 return retval;
189}
190
191
193//
194// Set_Sample_Volume
195//
197void
199{
200 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
201 ::AIL_set_sample_volume (SampleHandle, volume);
202 }
203 return ;
204}
205
206
208//
209// Get_Sample_Volume
210//
212S32
214{
215 S32 retval = 0;
216
217 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
218 retval = ::AIL_sample_volume (SampleHandle);
219 }
220
221 return retval;
222}
223
224
226//
227// Set_Sample_Loop_Count
228//
230void
232{
233 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
234 ::AIL_set_sample_loop_count (SampleHandle, count);
235 }
236
237 return ;
238}
239
240
242//
243// Get_Sample_Loop_Count
244//
246U32
248{
249 U32 retval = 0;
250
251 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
252 retval = ::AIL_sample_loop_count (SampleHandle);
253 }
254
255 return retval;
256}
257
258
260//
261// Set_Sample_MS_Position
262//
264void
266{
267 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
268 ::AIL_set_sample_ms_position (SampleHandle, ms);
269 }
270
271 return ;
272}
273
274
276//
277// Get_Sample_MS_Position
278//
280void
282{
283 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
284 ::AIL_sample_ms_position (SampleHandle, len, pos);
285 }
286
287 return ;
288}
289
290
292//
293// Set_Sample_User_Data
294//
296void
298{
299 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
300 ::AIL_set_sample_user_data (SampleHandle, i, val);
301 }
302
303 return ;
304}
305
306
308//
309// Get_Sample_User_Data
310//
312U32
314{
315 U32 retval = 0;
316
317 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
318 retval = ::AIL_sample_user_data (SampleHandle, i);
319 }
320
321 return retval;
322}
323
324
326//
327// Get_Sample_Playback_Rate
328//
330S32
332{
333 S32 retval = 0;
334
335 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
336 retval = ::AIL_sample_playback_rate (SampleHandle);
337 }
338
339 return retval;
340}
341
342
344//
345// Set_Sample_Playback_Rate
346//
348void
350{
351 if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) {
352 ::AIL_set_sample_playback_rate (SampleHandle, rate);
353 }
354
355 return ;
356}
357
358
360//
361// Set_Miles_Handle
362//
364void
366{
367 SampleHandle = (HSAMPLE)handle;
368 return ;
369}
const MILES_HANDLE INVALID_MILES_HANDLE
#define NULL
Definition BaseType.h:92
unsigned long uint32
Definition bittype.h:46
void Set_Sample_Volume(S32 volume)
void Set_Sample_Pan(S32 pan)
void Set_Sample_User_Data(S32 i, U32 val)
void Get_Sample_MS_Position(S32 *len, S32 *pos)
void Set_Sample_Loop_Count(U32 count)
U32 Get_Sample_User_Data(S32 i)
void Set_Sample_Playback_Rate(S32 rate)
S32 Get_Sample_Playback_Rate(void)
U32 Get_Sample_Loop_Count(void)
void Set_Sample_MS_Position(U32 ms)
void Initialize(SoundBufferClass *buffer)
void Set_Miles_Handle(uint32 handle)
SoundBufferClass * Buffer
virtual void Initialize(SoundBufferClass *buffer)
#define S32
Definition md5.cpp:62
else return(RetVal)