Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
ix.h
Go to the documentation of this file.
1/*
2 * ix -- Origin Systems audio library (C++), original dev tree D:\Rnd\Prj\ix.
3 *
4 * The predecessor image establishes this library's original module layout:
5 * its live assert __FILE__/__LINE__ anchors show that the linker laid each
6 * object file out contiguously:
7 *
8 * streamer.cpp 0x00442750 - 0x00443DA5
9 * thread.cpp 0x00443DA6 - 0x0044490F
10 * dsp.cpp 0x00444910 - 0x004451B4
11 * dsps.cpp 0x004451B5 - 0x00445F5F
12 * mixer.cpp 0x00445F60 - 0x004467C4
13 * dspv.cpp 0x004467C5 - 0x004471FF
14 * system.cpp 0x00447200 - 0x00447CD7
15 * sound.cpp 0x00447CD8 - 0x0044879B
16 * sample.cpp 0x0044879C - 0x004492DF
17 *
18 * Everything from 0x004492E0 upward in that image is the MSVC 4.2 static
19 * debug CRT.
20 */
21#ifndef IX_H
22#define IX_H
23
24#include <windows.h> /* CRITICAL_SECTION, used by the stream/voice state below */
25#include <stdio.h> /* FILE, held by developer-mode stream-file objects */
26
27/* --------------------------------------------------------------------------
28 * Diagnostics. Every ix module reports through this one variadic printer, and
29 * the calls come in pairs:
30 * ix_log_printf("Fatal [%s - %d]:\n", __FILE__, __LINE__);
31 * ix_log_printf("human readable message");
32 * Fatal paths then call exit(-1). 107 call sites; keep __FILE__/__LINE__
33 * accurate, they are the module map.
34 * -------------------------------------------------------------------------- */
35void ix_log_printf(const char *fmt, ...); /* 0x428BD4 */
36
37/* --------------------------------------------------------------------------
38 * DSP voice. Array at 0x005981A8, stride 32 bytes; count at 0x00598600.
39 * Field offsets are confirmed from the accessor bodies.
40 * -------------------------------------------------------------------------- */
43 IX_VOICE_FLAG4 = 0x04, /* set elsewhere; meaning not yet established */
44 IX_VOICE_16BIT = 0x08, /* set by ix_dspv_set_bits_per_sample(16) */
45 IX_VOICE_STEREO = 0x10 /* set by ix_dspv_set_channels(2) */
46};
47
48struct IxVoice { /* 32 bytes; offsets confirmed from the accessors */
49 unsigned int flags; /* +0x00 */
50 unsigned char *cursor; /* +0x04 current read pointer */
51 unsigned char *start; /* +0x08 buffer start */
52 unsigned char *end; /* +0x0C buffer end */
53 short field_10; /* +0x10 not yet identified */
54 short rate; /* +0x12 (freq << 8) / 22050 */
55 unsigned short volume; /* +0x14 */
56 unsigned char leftGainHi; /* +0x16 high byte of leftGain */
57 unsigned char rightGainHi; /* +0x17 high byte of rightGain */
58 short leftGain; /* +0x18 */
59 short rightGain; /* +0x1A */
60 short panAngle; /* +0x1C 0..0x7F, wraps at +-0x40 */
61 short panPos; /* +0x1E 0..0xFF, indexes the pan table */
62 /* Declared, never defined: voices are not assigned whole. It also
63 * makes the record a non-aggregate, so the voice table gets the
64 * (empty) dynamic initializer retail has at 0x48A210. */
66};
67
68/* Sample and sound layouts are fixed by system.cpp/sound.cpp field accesses. */
69struct IxSample {
70 unsigned int flags; /* +0x00 */
71 unsigned char *buffer; /* +0x04 */
72 unsigned int sampleCount; /* +0x08 */
73 unsigned int bitsPerSample; /* +0x0C */
74 unsigned int channels; /* +0x10 */
75 unsigned int bytesPerFrame; /* +0x14 */
76 unsigned int rateNumerator; /* +0x18 */
77 unsigned int rateDenominator; /* +0x1C */
78 unsigned int frequency; /* +0x20 */
79 unsigned int loopStart; /* +0x24 */
80 unsigned int loopEnd; /* +0x28 */
81 IxSample *previous; /* +0x2C */
82 IxSample *next; /* +0x30 */
83
84 void ix_sample_construct(void);
85 void ix_sample_destruct(void);
86 int ix_sample_load_aiff(void *data, int bytes);
87 int ix_sample_load_wav(void *data, int bytes);
88 int ix_sample_load_raw(void *data, int bytes, int frequency,
89 int bitsPerSample, int channels);
90 long ix_sample_convert_from_ieee_extended(unsigned char *bytes);
91};
92
94 IX_SAMPLE_READY = 0x00000001,
95 IX_SAMPLE_LOOPING = 0x00000002,
96 IX_SAMPLE_LOADING = 0x80000000
97};
98
110
111struct IxSound {
112 unsigned int flags; /* +0x00 */
113 IxSample *sample; /* +0x04 */
114 int voice; /* +0x08 */
115 unsigned int startTime; /* +0x0C */
116 unsigned int stopTime; /* +0x10 */
117 unsigned int priority; /* +0x14 */
118 int pitchOffset; /* +0x18 */
119 unsigned short volume; /* +0x1C */
120 unsigned short pan; /* +0x1E */
121 unsigned char basePriority; /* +0x20 */
122 IxSound *previous; /* +0x24 */
123 IxSound *next; /* +0x28 */
124
125 void ix_system_sound_init(IxSample *newSample,
126 unsigned char newBasePriority,
127 unsigned int initialVolume,
128 int newPitchOffset,
129 unsigned short newPan);
130 void ix_system_sound_construct(IxSample *newSample,
131 unsigned char newBasePriority);
134 void ix_system_sound_set_volume(unsigned short newVolume);
135 void ix_system_sound_set_pan(unsigned short newPan);
136 void ix_system_sound_set_frequency(int newPitchOffset);
137 void ix_system_sound_set_priority(unsigned char newBasePriority);
138 void ix_sound_reprioritise(void);
140};
141
142/* Sound-unit declaration order preserves the retail list comparisons. */
143#ifdef IX_SOUND_CPP
144extern IxSound *g_1_pWaitingSoundList; /* 0x005c4b34 */
145#else
146extern unsigned int g_dwIxSystemBits; /* 0x005c4b1c */
147#endif
148extern IxSound *g_1_pFreeSoundHead; /* 0x005c4b20 */
149extern int g_nActiveVoices; /* 0x005c4b28 */
150extern int g_nSystemVoiceCount; /* 0x005c4b2c */
151extern IxSound *g_1_pActiveSoundList; /* 0x005c4b30 */
152extern void *(__cdecl *g_pIxMalloc)(unsigned int); /* 0x004a0c18 */
153extern void (__cdecl *g_pIxFree)(void *); /* 0x004a0c1c */
154
155/* Master volume and the stereo pan table (two shorts per position). */
156extern unsigned short g_nMasterVolume; /* 0x004a0c14 */
157extern short g_3_anPanTable[]; /* 0x005c4ee8 */
158extern CRITICAL_SECTION g_7_csMixer; /* 0x005c5730 */
159
160#define IX_MIXER_BASE_RATE 22050 /* 0x5622, the divisor in set_frequency */
161
162/* Globals keep their original address in the name (see AGENTS.md). */
163extern IxVoice g_2_voices[]; /* 0x005c52f0 */
164extern int g_nVoiceCapacity; /* 0x005c5748 */
165
166/* The ix source tree lived on D: -- each assert site carries its own copy of
167 * this literal (the build did not use /Gf, so identical strings are not
168 * merged; writing it out per site is what matches). */
169#define IX_DSPV_FILE "D:\\rnd\\prj\\ix\\win95\\dsp\\dspv.cpp"
170
171void ix_dspv_set_active(int voice); /* 0x004467C5 flags |= ACTIVE */
172void ix_dspv_clear_active(int voice); /* 0x00446829 flags &= ~ACTIVE */
173void ix_dspv_clear_flag4(int voice); /* 0x48A2FE */
174unsigned int ix_dspv_get_flags(int voice); /* 0x48A362 */
175void ix_dspv_set_buffer(int voice, unsigned char *p, int len); /* 0x48A3FF */
176int ix_dspv_get_position(int voice); /* 0x00446A2B cursor - start */
177void ix_dspv_set_position(int voice, int off); /* 0x00446AA0 cursor = start + off */
178void ix_dspv_set_volume(int voice, short vol); /* 0x48A588 */
179void ix_dspv_set_pan(int voice, unsigned short a); /* 0x48A5FC */
180void ix_dspv_set_frequency(int voice, unsigned int hz); /* 0x48A721 */
181void ix_dspv_set_bits_per_sample(int voice, int bps); /* 0x00446D2C 8 or 16 */
182void ix_dspv_set_channels(int voice, int ch); /* 0x00446DF5 1 or 2 */
183void ix_dspv_set_flag4(int voice, int on); /* 0x48A3C6 */
184void ix_dspv_recalc_mix(int voice); /* 0x48A92F */
185extern "C" void ix_dspv_mix(void *outputBuffer, unsigned int outputBytes); /* 0x48BFF8 */
186
187/* --------------------------------------------------------------------------
188 * DSP stream. Array at 0x00598138, stride 0x38; count at 0x00598130.
189 * Streams occupy voice slots AFTER the regular voices:
190 * voice[voice_count + stream_index].
191 * -------------------------------------------------------------------------- */
197
198struct IxStream { /* 0x38 bytes */
199 unsigned int flags; /* +0x00 */
200 unsigned char *buffer; /* +0x04 */
201 unsigned int size; /* +0x08 */
202 unsigned int writePos; /* +0x0C */
203 unsigned int playPos; /* +0x10 */
204 unsigned int pending; /* +0x14 */
205 unsigned char *lockPtr; /* +0x18 */
206 unsigned int lockLen; /* +0x1C */
207 CRITICAL_SECTION cs; /* +0x20, 24 bytes */
208 /* Declared, never defined, as for IxVoice: the stream table gets the
209 * empty dynamic initializer retail has at 0x48A9F0. */
211};
212
213extern IxStream g_1_streams[]; /* 0x005c5758 */
214extern int g_3_nStreamCount; /* 0x005c5750 */
215extern int g_nStreamsTaken; /* 0x005c5754 */
216
217#define IX_DSPS_FILE "D:\\rnd\\prj\\ix\\win95\\dsp\\dsps.cpp"
218void ix_dsps_alloc(int stream, unsigned int size, int frequency,
219 int bitsPerSample, int channels); /* 0x48AA15 */
220void ix_dsps_free(int stream); /* 0x48ACCB */
221void ix_dsps_prepare(int stream); /* 0x48ADE2 */
222void ix_dsps_play(int stream); /* 0x48AF38 */
223void ix_dsps_stop(int stream); /* 0x48B068 */
224void ix_dsps_set_volume(int stream, unsigned short vol); /* 0x48B166 */
225unsigned int ix_dsps_get_flags(int stream); /* 0x48B26B */
226int ix_dsps_get_buffer_free(int stream); /* 0x48B2CF */
227void ix_dsps_lock(int stream, unsigned int requestedBytes,
228 unsigned char **buffer, unsigned int *lockedBytes); /* 0x48B53B */
229void ix_dsps_unlock(int stream); /* 0x48B69C */
230
231/* --------------------------------------------------------------------------
232 * Mixer (DirectSound), DSP core, system, sound, sample.
233 * -------------------------------------------------------------------------- */
234DWORD WINAPI ix_mixer_thread_proc(void *parameter); /* 0x48B7C0 */
235int ix_mixer_service(void); /* 0x48BC5C */
236const char *ix_dsp_result_to_text(int hr); /* 0x48A017 */
237
238int ix_dsp_init(void); /* 0x489990 */
239void ix_dsp_shutdown(void); /* 0x489A4F */
240void ix_dsp_configure(int option, void *value); /* 0x489AE2 */
241unsigned int ix_dsp_get_tick(void); /* 0x489C7D */
242unsigned int ix_dsp_get_flags(void); /* 0x489C92 */
243void ix_dsp_set_config_bit1(int enabled); /* 0x489CA7 */
244void ix_dsp_set_config_bit3(int enabled); /* 0x489CD4 */
245int ix_dsp_get_voice_count(void); /* 0x489D01 */
246void ix_dsp_set_voice_count(int n); /* 0x489D16 */
247int ix_dsp_get_stream_count(void); /* 0x489D98 */
248void ix_dsp_set_stream_count(int n); /* 0x489DAD */
249unsigned short ix_dsp_get_master_volume(void); /* 0x489E2F */
250void ix_dsp_set_master_volume(unsigned short vol); /* 0x489E45 */
251void ix_dsp_build_pan_tables(void); /* 0x489ED2 */
252void *ix_dsp_alloc(unsigned int bytes); /* 0x48A1A3 */
253void *ix_dsp_copy(void *destination, const void *source,
254 unsigned int bytes); /* 0x48A1C0 */
255void ix_dsp_free(void *memory); /* 0x48A1E4 */
256
257extern "C" int ix_system_init(void); /* 0x469C80 */
258extern "C" void ix_system_service_sounds(void); /* 0x469D27 */
259extern "C" void ix_system_shutdown(void); /* 0x469E73 */
260extern "C" void ix_system_configure(int option, void *value); /* 0x469EA6 */
261extern "C" unsigned short ix_system_get_master_volume(void); /* 0x469EC6 */
262extern "C" void ix_system_set_master_volume(unsigned short vol); /* 0x469EDB */
263extern "C" int ix_system_get_voice_count(void); /* 0x469EF7 */
264extern "C" void ix_system_set_voice_count(int n); /* 0x469F0C */
265extern "C" IxSample *ix_system_new_sample(void); /* 0x469F63 */
266extern "C" void ix_system_delete_sample(IxSample *sample); /* 0x469F99 */
267extern "C" void ix_system_delete_all_samples(void); /* 0x469FC8 */
268extern "C" IxSound *ix_system_new_sound(IxSample *sample); /* 0x46A00D */
269extern "C" void ix_system_delete_sound(IxSound *sound); /* 0x46A047 */
270extern "C" void ix_system_delete_all_sounds(void); /* 0x46A090 */
271int ix_system_release_voice(IxSound *sound); /* 0x46A139 */
272void ix_system_assign_voice(IxSound *sound, int voice); /* 0x46A17A */
274 unsigned int minimumPriority); /* 0x46A3A1 */
276 unsigned int maximumPriority); /* 0x46A3F4 */
277int ix_system_find_free_voice(void); /* 0x46A447 */
278
279/* The sample list and the queue of sounds waiting for a voice. */
280extern IxSample *g_7_pSampleList; /* 0x005c4b24 */
281#ifdef IX_SOUND_CPP
282extern unsigned int g_dwIxSystemBits; /* 0x005c4b1c */
283#else
284extern IxSound *g_1_pWaitingSoundList; /* 0x005c4b34 */
285#endif
286
287extern "C" void __fastcall ix_sound_start(IxSound *sound); /* 0x46A758 */
288extern "C" void __fastcall ix_sound_release(IxSound *sound); /* 0x46AA9E */
289extern "C" void __fastcall ix_sound_stop(IxSound *sound); /* 0x46AB4F */
290extern "C" int __fastcall ix_sound_is_playing(IxSound *sound); /* 0x46B0F8 */
291
292/* --------------------------------------------------------------------------
293 * Streamer. Global state word at 0x00597CD0; wake event at 0x00597CD4.
294 * bit2 0x004 playing bit3 0x008 paused
295 * bit7 0x080 has audio bit10 0x400 request flag (meaning TBD)
296 * -------------------------------------------------------------------------- */
301
316
318 unsigned int id; /* +0x00 */
319 unsigned int version; /* +0x04 */
320 unsigned char channels; /* +0x08 */
321 unsigned char bitsPerSample; /* +0x09 */
322 unsigned short frequency; /* +0x0A */
323 unsigned int audioBufferSize; /* +0x0C */
324 unsigned int dspConfigValue; /* +0x10 */
325 unsigned int audioChunkTableOffset; /* +0x14 */
326 unsigned int audioChunkCount; /* +0x18 */
327 unsigned int branchTableOffset; /* +0x1C */
328 unsigned int branchCount; /* +0x20 */
329 unsigned int triggerTableOffset; /* +0x24 */
330 unsigned int triggerCount; /* +0x28 */
331 unsigned int fileBufferSize; /* +0x2C */
332 unsigned int fileEntryTableOffset; /* +0x30 */
333 unsigned int fileEntryCount; /* +0x34 */
334 unsigned int fileChunkTableOffset; /* +0x38 */
335 unsigned int fileChunkCount; /* +0x3C */
336 unsigned int packetTableOffset; /* +0x40 */
337 unsigned int packetCount; /* +0x44 */
338 unsigned int reserved_48; /* +0x48 */
339 unsigned int reserved_4c; /* +0x4C */
340 unsigned int reserved_50; /* +0x50 */
341 unsigned int reserved_54; /* +0x54 */
342 unsigned int reserved_58; /* +0x58 */
343 unsigned int reserved_5c; /* +0x5C */
344 unsigned int reserved_60; /* +0x60 */
345 unsigned int reserved_64; /* +0x64 */
346};
347
349 unsigned int nameHash; /* +0x00 */
350 unsigned int size; /* +0x04 */
351 unsigned int chunkCount; /* +0x08 */
352 unsigned int firstChunk; /* +0x0C */
353};
354
356 unsigned int fileOffset; /* +0x00 */
357 unsigned int fileEnd; /* +0x04 */
358 unsigned int triggerCount; /* +0x08 */
359 unsigned int firstTrigger; /* +0x0C */
360 unsigned int branchCount; /* +0x10 */
361 unsigned int firstBranch; /* +0x14 */
362};
363
364#pragma pack(push, 1)
366 unsigned char intensity; /* +0x00 */
367 unsigned int audioChunk; /* +0x01 */
368};
369
371 unsigned char tag; /* +0x00 */
372 unsigned int audioChunk; /* +0x01 */
373};
374#pragma pack(pop)
375
377 int packedSize; /* +0x00, negative means compressed */
378 unsigned int fileOffset; /* +0x04 */
379 unsigned int fileEnd; /* +0x08 */
380 unsigned int packetCount; /* +0x0C */
381 unsigned int firstPacket; /* +0x10 */
382};
383
385 unsigned int flags; /* +0x00 */
386 IxStreamerFileEntry *entry; /* +0x04, packed-stream mode */
387 FILE *file; /* +0x08, developer mode */
388 unsigned int size; /* +0x0C */
389 unsigned char priority; /* +0x10 */
390 unsigned int serviceTick; /* +0x14 */
391 unsigned int position; /* +0x18 */
392 unsigned int remaining; /* +0x1C */
393 unsigned char *destination; /* +0x20 */
394 HANDLE completionEvent; /* +0x24 */
395 IxStreamFile *previous; /* +0x28 */
396 IxStreamFile *next; /* +0x2C */
397
398 unsigned int ix_stream_file_read(void *destination,
399 unsigned int bytes);
400 void ix_stream_file_seek(unsigned int position);
401 unsigned int ix_stream_file_tell(void);
402 unsigned int ix_stream_file_size(void);
403 void ix_stream_file_wait();
405};
406
407/* C++ empty parameter lists recover each sound/sample unit's declaration context. */
408#if defined(IX_SOUND_CPP) || defined(IX_SAMPLE_CPP)
409extern "C" int ix_streamer_init(); /* 0x46BD50 */
410extern "C" void ix_streamer_destroy(); /* 0x46BE6F */
411extern "C" void ix_streamer_configure(int option, void *value); /* 0x46BF1E */
412void ix_streamer_set_dev_mode(int mode); /* 0x46BF3E */
413extern "C" int ix_streamer_open_stream_file(char *path); /* 0x46BFB6 */
414extern "C" void ix_streamer_close_stream_file(); /* 0x46C67A */
415extern "C" void ix_streamer_audio_play(); /* 0x46C7F3 */
416extern "C" void ix_streamer_audio_stop(); /* 0x46C853 */
417void ix_streamer_audio_pause(); /* 0x46C8B6 */
418void ix_streamer_audio_reprepare(); /* 0x46C90F */
419extern "C" void ix_streamer_set_intensity(unsigned char intensity); /* 0x46C96B */
420unsigned char ix_streamer_get_intensity(); /* 0x46C9AC */
421extern "C" void ix_streamer_set_trigger(char trigger); /* 0x46C9C1 */
422char ix_streamer_get_trigger(); /* 0x46CA19 */
423extern "C" void ix_streamer_force_trigger(char trigger); /* 0x46CA2E */
424extern "C" void ix_streamer_set_volume(unsigned short vol); /* 0x46CBBE */
425extern "C" unsigned short ix_streamer_get_volume(); /* 0x46CC3B */
426unsigned int ix_streamer_get_audio_chunk(); /* 0x46CC51 */
427void ix_streamer_seek_chunk(unsigned int chunk); /* 0x46CC66 */
428unsigned int ix_streamer_hash_name(unsigned char *name); /* 0x46CCC0 */
429IxStreamerFileEntry *ix_streamer_find_entry(unsigned int hash); /* 0x46CD55 */
430#ifdef IX_SOUND_CPP
431unsigned int ix_streamer_service_audio(); /* 0x46D2C0 */
432#else
433unsigned int ix_streamer_service_audio(void); /* 0x46D2C0 */
434#endif
435#else
436extern "C" int ix_streamer_init(void); /* 0x46BD50 */
437extern "C" void ix_streamer_destroy(void); /* 0x46BE6F */
438extern "C" void ix_streamer_configure(int option, void *value); /* 0x46BF1E */
439void ix_streamer_set_dev_mode(int mode); /* 0x46BF3E */
440extern "C" int ix_streamer_open_stream_file(char *path); /* 0x46BFB6 */
441extern "C" void ix_streamer_close_stream_file(void); /* 0x46C67A */
442extern "C" void ix_streamer_audio_play(void); /* 0x46C7F3 */
443extern "C" void ix_streamer_audio_stop(void); /* 0x46C853 */
444void ix_streamer_audio_pause(void); /* 0x46C8B6 */
445void ix_streamer_audio_reprepare(void); /* 0x46C90F */
446extern "C" void ix_streamer_set_intensity(unsigned char intensity); /* 0x46C96B */
447unsigned char ix_streamer_get_intensity(void); /* 0x46C9AC */
448extern "C" void ix_streamer_set_trigger(char trigger); /* 0x46C9C1 */
449char ix_streamer_get_trigger(void); /* 0x46CA19 */
450extern "C" void ix_streamer_force_trigger(char trigger); /* 0x46CA2E */
451extern "C" void ix_streamer_set_volume(unsigned short vol); /* 0x46CBBE */
452extern "C" unsigned short ix_streamer_get_volume(void); /* 0x46CC3B */
453unsigned int ix_streamer_get_audio_chunk(void); /* 0x46CC51 */
454void ix_streamer_seek_chunk(unsigned int chunk); /* 0x46CC66 */
455unsigned int ix_streamer_hash_name(unsigned char *name); /* 0x46CCC0 */
456IxStreamerFileEntry *ix_streamer_find_entry(unsigned int hash); /* 0x46CD55 */
457unsigned int ix_streamer_service_audio(void); /* 0x46D2C0 */
458#endif
459IxStreamFile *ix_streamer_open_file(unsigned char *name,
460 unsigned char priority); /* 0x46CDE3 */
461void ix_streamer_close_file(IxStreamFile *streamFile); /* 0x46D05D */
462DWORD WINAPI ix_streamer_thread_proc(void *parameter); /* 0x46D110 */
463
464void ix_thread_handle_file_chunk(IxStreamFile *streamFile); /* 0x46D3A6 */
465unsigned int ix_thread_service_streams(void); /* 0x46D7C6 */
466void ix_thread_advance_audio_chunk(void); /* 0x46D916 */
467void ix_thread_lock_stream_buffer(void); /* 0x46DBC9 */
468unsigned int ix_thread_get_audio_chunk_size(void); /* 0x46DCA6 */
469extern "C" void ix_lzo1x_decompress(unsigned char *source,
470 unsigned char *destination,
471 unsigned int destinationBytes); /* 0x48C290 */
472extern "C" FILE *ix_file_open(const char *path,
473 int mode); /* 0x48C420 */
474extern "C" void ix_file_close(FILE *file); /* 0x48C48E */
475extern "C" void ix_file_seek(FILE *file, long position); /* 0x48C4AA */
476extern "C" long ix_file_tell(FILE *file); /* 0x48C4CC */
477extern "C" unsigned int ix_file_read(FILE *file, void *destination,
478 unsigned int bytes); /* 0x48C4E8 */
479extern "C" long ix_file_size(FILE *file); /* 0x48C534 */
480
481extern unsigned int *g_7_pStreamerPacketOffsets; /* 0x005c4b38 */
482extern unsigned int g_18_dwStreamerThreadTick; /* 0x005c4b3c */
483extern FILE *g_1_pFeederPackageDisk; /* 0x005c4b44 */
484extern IxStreamFile *g_48_pPumpIdleFiles; /* 0x005c4b48 */
485extern unsigned int g_13_adwPlayerBranchingStack[32]; /* 0x005c4b50 */
486extern unsigned char *g_126_pReaderCompressedBuf; /* 0x005c4bd0 */
487extern IxStreamFile *g_1_pPlayerReadQueue; /* 0x005c4bd4 */
488extern unsigned int g_49_nStreamerAudioBufferSize; /* 0x005c4bd8 */
489extern unsigned char *g_pStreamerFileStore; /* 0x005c4bdc */
490extern unsigned char g_6_bFeederLevel; /* 0x005c4be0 */
491extern HANDLE g_4_hStreamerWorker; /* 0x005c4be4 */
492/* Keep the reader's disk-chunk comparison in retail operand order. */
493#ifdef IX_THREAD_CPP
494extern unsigned int g_nSpoolerDiskChunk; /* 0x005c4c40 */
495#else
496extern IxStreamerFileEntry *g_3_pReaderFileEntries; /* 0x005c4be8 */
497#endif
498extern IxStreamerHeader *g_pStreamPrologue; /* 0x005c4bec */
499extern IxStreamerAudioChunk *g_15_pStreamerSoundChunks; /* 0x005c4bf0 */
500extern IxStreamerBranch *g_7_pStreamBranches; /* 0x005c4bf4 */
501extern IxStreamerFileChunk *g_17_pStreamerFileParts; /* 0x005c4bf8 */
502extern CRITICAL_SECTION g_csStreamerFileFifo; /* 0x005c4c00 */
503extern CRITICAL_SECTION g_49_csStreamWorker; /* 0x005c4c18 */
504extern unsigned int g_6_dwStreamSoundChunk; /* 0x005c4c30 */
505extern DWORD g_dwStreamThreadId; /* 0x005c4c34 */
506extern "C" unsigned int g_dwStreamerMode; /* 0x005c4c38 */
507extern HANDLE g_1_hStreamRouseEvent; /* 0x005c4c3c */
508#ifdef IX_THREAD_CPP
509extern IxStreamerFileEntry *g_3_pReaderFileEntries; /* 0x005c4be8 */
510#else
511extern unsigned int g_nSpoolerDiskChunk; /* 0x005c4c40 */
512#endif
513extern unsigned int g_16_nStreamerBytesEachSecond; /* 0x005c4c44 */
514extern unsigned short g_nStreamerVolume; /* 0x0049e150 */
515extern char g_cStreamerBranchTag; /* 0x0049e154 */
516extern unsigned int g_nStreamerBranchStackIndex; /* 0x0049e158 */
517extern CRITICAL_SECTION g_1_csStreamer; /* 0x005c4c48 */
518extern IxStreamerTrigger *g_6_pFeederTriggers; /* 0x005c4c60 */
519
520#endif /* IX_H */
void ix_dsp_build_pan_tables(void)
Definition dsp.cpp:236
int ix_dsp_get_stream_count(void)
Definition dsp.cpp:191
unsigned short g_nMasterVolume
Definition dsp.cpp:35
int ix_dsp_init(void)
Definition dsp.cpp:40
void ix_dsp_configure(int option, void *value)
Definition dsp.cpp:82
int ix_dsp_get_voice_count(void)
Definition dsp.cpp:169
void ix_dsp_set_stream_count(int streamCount)
Definition dsp.cpp:197
unsigned int ix_dsp_get_tick(void)
Definition dsp.cpp:139
void ix_dsp_shutdown(void)
Definition dsp.cpp:63
unsigned int ix_dsp_get_flags(void)
Definition dsp.cpp:145
void ix_dsp_set_config_bit3(int enabled)
Definition dsp.cpp:160
void ix_dsp_set_voice_count(int voiceCount)
Definition dsp.cpp:175
void *__cdecl * g_pIxMalloc(unsigned int)
void ix_dsp_free(void *memory)
Definition dsp.cpp:318
unsigned short ix_dsp_get_master_volume(void)
Definition dsp.cpp:213
void ix_dsp_set_config_bit1(int enabled)
Definition dsp.cpp:151
short g_3_anPanTable[512]
Definition dsp.cpp:29
void * ix_dsp_copy(void *destination, const void *source, unsigned int bytes)
Definition dsp.cpp:312
void(__cdecl *g_pIxFree)(void *)
void ix_dsp_set_master_volume(unsigned short volume)
Definition dsp.cpp:219
const char * ix_dsp_result_to_text(int result)
Definition dsp.cpp:270
void * ix_dsp_alloc(unsigned int bytes)
Definition dsp.cpp:305
void ix_dsps_set_volume(int stream, unsigned short volume)
Definition dsps.cpp:188
void ix_dsps_prepare(int stream)
Definition dsps.cpp:109
void ix_dsps_unlock(int stream)
Definition dsps.cpp:296
IxStream g_1_streams[2]
Definition dsps.cpp:17
unsigned int ix_dsps_get_flags(int stream)
Definition dsps.cpp:212
int g_nStreamsTaken
Definition dsps.cpp:16
void ix_dsps_free(int stream)
Definition dsps.cpp:88
int g_3_nStreamCount
Definition dsps.cpp:15
void ix_dsps_stop(int stream)
Definition dsps.cpp:161
void ix_dsps_play(int stream)
Definition dsps.cpp:134
int ix_dsps_get_buffer_free(int stream)
Definition dsps.cpp:223
void ix_dsps_alloc(int stream, unsigned int size, int freq, int bps, int channels)
Definition dsps.cpp:30
void ix_dsps_lock(int stream, unsigned int requestedBytes, unsigned char **buffer, unsigned int *lockedBytes)
Definition dsps.cpp:265
void ix_dspv_set_channels(int voice, int channels)
Definition dspv.cpp:208
int g_nVoiceCapacity
Definition dspv.cpp:21
unsigned int ix_dspv_get_flags(int voice)
Definition dspv.cpp:66
void ix_dspv_set_active(int voice)
Definition dspv.cpp:31
void ix_dspv_set_flag4(int voice, int on)
Definition dspv.cpp:78
void ix_dspv_set_bits_per_sample(int voice, int bps)
Definition dspv.cpp:189
IxVoice g_2_voices[34]
Definition dspv.cpp:19
void ix_dspv_set_buffer(int voice, unsigned char *buffer, int length)
Definition dspv.cpp:87
void ix_dspv_set_pan(int voice, unsigned short angle)
Definition dspv.cpp:147
int ix_dspv_get_position(int voice)
Definition dspv.cpp:104
void ix_dspv_set_position(int voice, int offset)
Definition dspv.cpp:119
void ix_dspv_clear_flag4(int voice)
Definition dspv.cpp:55
void ix_dspv_set_frequency(int voice, unsigned int hz)
Definition dspv.cpp:177
CRITICAL_SECTION g_7_csMixer
Definition dspv.cpp:20
void ix_dspv_clear_active(int voice)
Definition dspv.cpp:42
void ix_dspv_set_volume(int voice, short volume)
Definition dspv.cpp:135
void ix_dspv_recalc_mix(int voice)
Definition dspv.cpp:227
int ix_system_init(void)
Definition system.cpp:25
void ix_system_set_master_volume(unsigned short volume)
Definition system.cpp:116
void ix_system_delete_all_samples(void)
Definition system.cpp:159
void __fastcall ix_sound_stop(IxSound *sound)
Definition sound.cpp:211
void ix_streamer_set_intensity(unsigned char intensity)
Definition streamer.cpp:383
int __fastcall ix_sound_is_playing(IxSound *sound)
Definition sound.cpp:361
void ix_streamer_configure(int option, void *value)
Definition streamer.cpp:99
IxSound * ix_system_new_sound(IxSample *sample)
Definition system.cpp:173
void ix_streamer_audio_play(void)
Definition streamer.cpp:333
void ix_system_shutdown(void)
Definition system.cpp:93
void ix_system_configure(int option, void *value)
Definition system.cpp:104
int ix_streamer_open_stream_file(char *path)
Definition streamer.cpp:120
void ix_system_set_voice_count(int voiceCount)
Definition system.cpp:128
void ix_streamer_set_trigger(char trigger)
Definition streamer.cpp:399
void ix_system_delete_all_sounds(void)
Definition system.cpp:197
void ix_streamer_destroy(void)
Definition streamer.cpp:78
IxSample * ix_system_new_sample(void)
Definition system.cpp:139
unsigned short ix_streamer_get_volume(void)
Definition streamer.cpp:487
int ix_streamer_init(void)
Definition streamer.cpp:48
void __fastcall ix_sound_start(IxSound *sound)
Definition sound.cpp:103
void ix_streamer_force_trigger(char trigger)
Definition streamer.cpp:420
void ix_system_delete_sound(IxSound *sound)
Definition system.cpp:184
void __fastcall ix_sound_release(IxSound *sound)
Definition sound.cpp:189
void ix_streamer_audio_stop(void)
Definition streamer.cpp:346
void ix_streamer_close_stream_file(void)
Definition streamer.cpp:294
void ix_streamer_set_volume(unsigned short volume)
Definition streamer.cpp:471
void ix_system_service_sounds(void)
Definition system.cpp:46
struct IxSample IxSample
Definition game.h:122
unsigned int g_dwStreamerMode
Definition ix.h:506
IxStreamerTrigger * g_6_pFeederTriggers
Definition streamer.cpp:41
IxStreamerHeader * g_pStreamPrologue
Definition streamer.cpp:28
unsigned short ix_system_get_master_volume(void)
Definition system.cpp:110
unsigned int g_nStreamerBranchStackIndex
Definition streamer.cpp:45
unsigned int * g_7_pStreamerPacketOffsets
Definition streamer.cpp:16
void ix_thread_handle_file_chunk(IxStreamFile *streamFile)
Definition thread.cpp:124
IxStreamFileFlags
Definition ix.h:297
@ IX_STREAM_FILE_OPEN
Definition ix.h:298
@ IX_STREAM_FILE_READING
Definition ix.h:299
void ix_file_close(FILE *file)
Definition ixfile.cpp:42
unsigned int ix_thread_get_audio_chunk_size(void)
Definition thread.cpp:405
void ix_streamer_close_file(IxStreamFile *streamFile)
Definition streamer.cpp:627
int ix_system_get_voice_count(void)
Definition system.cpp:122
int ix_system_find_free_voice(void)
Definition system.cpp:319
HANDLE g_1_hStreamRouseEvent
Definition streamer.cpp:37
HANDLE g_4_hStreamerWorker
Definition streamer.cpp:26
FILE * ix_file_open(const char *path, int mode)
Definition ixfile.cpp:28
unsigned int ix_streamer_get_audio_chunk(void)
Definition streamer.cpp:493
unsigned int ix_streamer_hash_name(unsigned char *name)
Definition streamer.cpp:514
IxStreamFile * g_48_pPumpIdleFiles
Definition streamer.cpp:19
IxStreamerFileEntry * ix_streamer_find_entry(unsigned int hash)
Definition streamer.cpp:536
IxSample * g_7_pSampleList
Definition system.cpp:16
void ix_thread_advance_audio_chunk(void)
Definition thread.cpp:290
int ix_mixer_service(void)
Definition mixer.cpp:159
void ix_streamer_audio_reprepare(void)
Definition streamer.cpp:371
unsigned int ix_file_read(FILE *file, void *destination, unsigned int bytes)
Definition ixfile.cpp:60
IxSound * g_1_pWaitingSoundList
Definition system.cpp:20
void ix_streamer_audio_pause(void)
Definition streamer.cpp:359
int g_nSystemVoiceCount
Definition system.cpp:18
FILE * g_1_pFeederPackageDisk
Definition streamer.cpp:18
IxStreamerFileEntry * g_3_pReaderFileEntries
Definition streamer.cpp:27
unsigned int g_nSpoolerDiskChunk
Definition streamer.cpp:38
IxSampleFlags
Definition ix.h:93
@ IX_SAMPLE_READY
Definition ix.h:94
@ IX_SAMPLE_LOOPING
Definition ix.h:95
@ IX_SAMPLE_LOADING
Definition ix.h:96
IxSound * g_1_pFreeSoundHead
Definition system.cpp:15
void ix_thread_lock_stream_buffer(void)
Definition thread.cpp:375
unsigned int ix_streamer_service_audio(void)
Definition thread.cpp:96
void ix_log_printf(const char *fmt,...)
Definition stream.cpp:164
void ix_dspv_mix(void *outputBuffer, unsigned int outputBytes)
void ix_file_seek(FILE *file, long position)
Definition ixfile.cpp:48
unsigned int g_49_nStreamerAudioBufferSize
Definition streamer.cpp:23
CRITICAL_SECTION g_csStreamerFileFifo
Definition streamer.cpp:32
long ix_file_tell(FILE *file)
Definition ixfile.cpp:54
void ix_streamer_seek_chunk(unsigned int chunk)
Definition streamer.cpp:499
unsigned int g_6_dwStreamSoundChunk
Definition streamer.cpp:34
IxStreamFlags
Definition ix.h:192
@ IX_STREAM_LOCKED
Definition ix.h:195
@ IX_STREAM_ALLOCATED
Definition ix.h:193
@ IX_STREAM_PLAYING
Definition ix.h:194
CRITICAL_SECTION g_49_csStreamWorker
Definition streamer.cpp:33
void ix_streamer_set_dev_mode(int mode)
Definition streamer.cpp:105
DWORD WINAPI ix_streamer_thread_proc(void *parameter)
Definition thread.cpp:21
IxSound * ix_system_find_lowest_playing(IxSound *sound, unsigned int maximumPriority)
Definition system.cpp:303
int ix_system_release_voice(IxSound *sound)
Definition system.cpp:225
IxSound * ix_system_find_highest_waiting(IxSound *sound, unsigned int minimumPriority)
Definition system.cpp:287
unsigned char * g_pStreamerFileStore
Definition streamer.cpp:24
unsigned short g_nStreamerVolume
Definition streamer.cpp:43
unsigned char ix_streamer_get_intensity(void)
Definition streamer.cpp:393
IxStreamFile * g_1_pPlayerReadQueue
Definition streamer.cpp:22
IxStreamFile * ix_streamer_open_file(unsigned char *name, unsigned char priority)
Definition streamer.cpp:560
char ix_streamer_get_trigger(void)
Definition streamer.cpp:414
IxSoundFlags
Definition ix.h:99
@ IX_SOUND_LOOPING
Definition ix.h:102
@ IX_SOUND_HAS_VOICE
Definition ix.h:104
@ IX_SOUND_VOLUME_DIRTY
Definition ix.h:105
@ IX_SOUND_RELEASE_PENDING
Definition ix.h:108
@ IX_SOUND_PAN_DIRTY
Definition ix.h:107
@ IX_SOUND_ALLOCATED
Definition ix.h:100
@ IX_SOUND_FREQUENCY_DIRTY
Definition ix.h:106
@ IX_SOUND_DELETE_ON_STOP
Definition ix.h:103
@ IX_SOUND_PLAYING
Definition ix.h:101
DWORD WINAPI ix_mixer_thread_proc(void *parameter)
Definition mixer.cpp:35
char g_cStreamerBranchTag
Definition streamer.cpp:44
unsigned char * g_126_pReaderCompressedBuf
Definition streamer.cpp:21
IxVoiceFlags
Definition ix.h:41
@ IX_VOICE_STEREO
Definition ix.h:45
@ IX_VOICE_FLAG4
Definition ix.h:43
@ IX_VOICE_16BIT
Definition ix.h:44
@ IX_VOICE_ACTIVE
Definition ix.h:42
int g_nActiveVoices
Definition system.cpp:17
void ix_system_assign_voice(IxSound *sound, int voice)
Definition system.cpp:237
void ix_lzo1x_decompress(unsigned char *source, unsigned char *destination, unsigned int destinationBytes)
Definition lzo1x.cpp:16
unsigned int g_13_adwPlayerBranchingStack[32]
Definition streamer.cpp:20
IxStreamerFileChunk * g_17_pStreamerFileParts
Definition streamer.cpp:31
void ix_system_delete_sample(IxSample *sample)
Definition system.cpp:150
IxSound * g_1_pActiveSoundList
Definition system.cpp:19
long ix_file_size(FILE *file)
Definition ixfile.cpp:75
CRITICAL_SECTION g_1_csStreamer
Definition streamer.cpp:40
IxStreamerBranch * g_7_pStreamBranches
Definition streamer.cpp:30
unsigned int g_dwIxSystemBits
Definition system.cpp:14
unsigned int g_16_nStreamerBytesEachSecond
Definition streamer.cpp:39
unsigned int ix_thread_service_streams(void)
Definition thread.cpp:247
IxStreamerFlags
Definition ix.h:302
@ IX_STREAMER_FILE_OPEN
Definition ix.h:304
@ IX_STREAMER_HAS_AUDIO
Definition ix.h:310
@ IX_STREAMER_DSP_PLAYING
Definition ix.h:308
@ IX_STREAMER_DEVELOPER_MODE
Definition ix.h:311
@ IX_STREAMER_AUDIO_PAUSED
Definition ix.h:306
@ IX_STREAMER_AUDIO_PLAYING
Definition ix.h:305
@ IX_STREAMER_THREAD_RUNNING
Definition ix.h:307
@ IX_STREAMER_SHUTDOWN
Definition ix.h:312
@ IX_STREAMER_REPREPARE_AUDIO
Definition ix.h:313
@ IX_STREAMER_END_TRIGGERED
Definition ix.h:314
@ IX_STREAMER_INITIALIZED
Definition ix.h:303
@ IX_STREAMER_DSP_PAUSED
Definition ix.h:309
DWORD g_dwStreamThreadId
Definition streamer.cpp:35
IxStreamerAudioChunk * g_15_pStreamerSoundChunks
Definition streamer.cpp:29
unsigned int g_18_dwStreamerThreadTick
Definition streamer.cpp:17
unsigned char g_6_bFeederLevel
Definition streamer.cpp:25
unsigned int flags
Definition game.h:128
unsigned char * buffer
Definition ix.h:71
unsigned int frequency
Definition ix.h:78
int ix_sample_load_wav(void *data, int bytes)
unsigned int sampleCount
Definition ix.h:72
IxSample * next
Definition ix.h:82
int ix_sample_load_raw(void *data, int bytes, int frequency, int bitsPerSample, int channels)
unsigned int bitsPerSample
Definition ix.h:73
void ix_sample_construct(void)
Definition sample.cpp:58
unsigned int channels
Definition ix.h:74
unsigned int loopStart
Definition ix.h:79
unsigned int loopEnd
Definition ix.h:80
unsigned int rateNumerator
Definition ix.h:76
unsigned int rateDenominator
Definition ix.h:77
long ix_sample_convert_from_ieee_extended(unsigned char *bytes)
Definition sample.cpp:318
IxSample * previous
Definition ix.h:81
unsigned int bytesPerFrame
Definition ix.h:75
void ix_sample_destruct(void)
Definition sample.cpp:70
int ix_sample_load_aiff(void *data, int bytes)
Definition sample.cpp:85
void ix_sound_unlink_from_free_list(void)
Definition sound.cpp:57
void ix_sound_reprioritise(void)
Definition sound.cpp:273
IxSound * next
Definition ix.h:123
unsigned short volume
Definition ix.h:119
void ix_system_sound_construct(IxSample *newSample, unsigned char newBasePriority)
Definition sound.cpp:44
void ix_system_sound_set_volume(unsigned short newVolume)
IxSound * previous
Definition ix.h:122
unsigned short pan
Definition ix.h:120
void ix_system_sound_set_frequency(int newPitchOffset)
Definition sound.cpp:84
unsigned int flags
Definition game.h:138
int voice
Definition ix.h:114
void ix_system_sound_set_pan(unsigned short newPan)
IxSample * sample
Definition game.h:139
unsigned int stopTime
Definition ix.h:116
unsigned int priority
Definition ix.h:117
void ix_system_sound_set_priority(unsigned char newBasePriority)
Definition sound.cpp:96
int pitchOffset
Definition ix.h:118
unsigned int startTime
Definition ix.h:115
void ix_system_sound_construct_centred(IxSample *newSample)
Definition sound.cpp:51
void ix_system_sound_init(IxSample *newSample, unsigned char newBasePriority, unsigned int initialVolume, int newPitchOffset, unsigned short newPan)
Definition sound.cpp:17
void ix_sound_set_delete_on_stop(int enabled)
unsigned char basePriority
Definition ix.h:121
unsigned int ix_stream_file_tell(void)
unsigned char priority
Definition ix.h:389
FILE * file
Definition ix.h:387
unsigned int ix_stream_file_read(void *destination, unsigned int bytes)
unsigned int remaining
Definition ix.h:392
unsigned char * destination
Definition ix.h:393
unsigned int size
Definition ix.h:388
IxStreamFile * previous
Definition ix.h:395
unsigned int position
Definition ix.h:391
int ix_stream_file_is_reading()
unsigned int ix_stream_file_size(void)
IxStreamFile * next
Definition ix.h:396
void ix_stream_file_seek(unsigned int position)
unsigned int flags
Definition ix.h:385
IxStreamerFileEntry * entry
Definition ix.h:386
HANDLE completionEvent
Definition ix.h:394
unsigned int serviceTick
Definition ix.h:390
void ix_stream_file_wait()
Definition ix.h:198
unsigned int playPos
Definition ix.h:203
unsigned char * buffer
Definition ix.h:200
IxStream & operator=(const IxStream &)
unsigned int pending
Definition ix.h:204
unsigned char * lockPtr
Definition ix.h:205
unsigned int writePos
Definition ix.h:202
unsigned int flags
Definition ix.h:199
unsigned int size
Definition ix.h:201
unsigned int lockLen
Definition ix.h:206
CRITICAL_SECTION cs
Definition ix.h:207
unsigned int triggerCount
Definition ix.h:358
unsigned int fileOffset
Definition ix.h:356
unsigned int firstBranch
Definition ix.h:361
unsigned int branchCount
Definition ix.h:360
unsigned int fileEnd
Definition ix.h:357
unsigned int firstTrigger
Definition ix.h:359
unsigned char intensity
Definition ix.h:366
unsigned int audioChunk
Definition ix.h:367
unsigned int firstPacket
Definition ix.h:381
unsigned int packetCount
Definition ix.h:380
unsigned int fileOffset
Definition ix.h:378
unsigned int fileEnd
Definition ix.h:379
unsigned int nameHash
Definition ix.h:349
unsigned int firstChunk
Definition ix.h:352
unsigned int chunkCount
Definition ix.h:351
unsigned int size
Definition ix.h:350
unsigned int reserved_5c
Definition ix.h:343
unsigned int reserved_48
Definition ix.h:338
unsigned int reserved_64
Definition ix.h:345
unsigned int reserved_4c
Definition ix.h:339
unsigned int fileChunkCount
Definition ix.h:335
unsigned int branchCount
Definition ix.h:328
unsigned int fileEntryTableOffset
Definition ix.h:332
unsigned int audioChunkCount
Definition ix.h:326
unsigned int fileEntryCount
Definition ix.h:333
unsigned int id
Definition ix.h:318
unsigned int triggerCount
Definition ix.h:330
unsigned int reserved_58
Definition ix.h:342
unsigned int reserved_54
Definition ix.h:341
unsigned int packetCount
Definition ix.h:337
unsigned int fileBufferSize
Definition ix.h:331
unsigned int packetTableOffset
Definition ix.h:336
unsigned int dspConfigValue
Definition ix.h:324
unsigned int fileChunkTableOffset
Definition ix.h:334
unsigned int triggerTableOffset
Definition ix.h:329
unsigned char channels
Definition ix.h:320
unsigned int branchTableOffset
Definition ix.h:327
unsigned int audioBufferSize
Definition ix.h:323
unsigned int reserved_60
Definition ix.h:344
unsigned int audioChunkTableOffset
Definition ix.h:325
unsigned int reserved_50
Definition ix.h:340
unsigned char bitsPerSample
Definition ix.h:321
unsigned short frequency
Definition ix.h:322
unsigned int version
Definition ix.h:319
unsigned char tag
Definition ix.h:371
unsigned int audioChunk
Definition ix.h:372
Definition ix.h:48
IxVoice & operator=(const IxVoice &)
unsigned char * start
Definition ix.h:51
short rate
Definition ix.h:54
short panPos
Definition ix.h:61
unsigned char * cursor
Definition ix.h:50
short leftGain
Definition ix.h:58
unsigned char * end
Definition ix.h:52
short field_10
Definition ix.h:53
unsigned char rightGainHi
Definition ix.h:57
short panAngle
Definition ix.h:60
short rightGain
Definition ix.h:59
unsigned int flags
Definition ix.h:49
unsigned char leftGainHi
Definition ix.h:56
unsigned short volume
Definition ix.h:55