MilesLib: run the 40250 sound sources verbatim over an AIL software mixer
Copy SoundBase/SoundData/SoundInstance*/SoundManager*/Type from 40250 and implement the AIL_* calls they make in MilesAil.cpp (2D pan, 3D distance and listener pan, threaded stream decode, loop counts). The SDL host drains the mixer. CSoundManager is created/updated/destroyed where 40250 does it and the old AudioCommands bridge is removed. Port-map MilesLib 142/142 PORTED. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d509f0a8b4
commit
11991d4d1f
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
// Shim for Miles Sound System <mss.h>: the scalar types and opaque handles 40250's MilesLib
|
||||
// headers name. Playback goes through platform/, never through these declarations.
|
||||
// Shim for Miles Sound System <mss.h>: the scalar types, opaque handles, constants and the AIL_* calls
|
||||
// 40250's MilesLib makes. The calls are implemented by platform/MilesLib/MilesAil.cpp, a small software
|
||||
// mixer the host drains into its SDL audio stream (platform/MilesLib/MilesMixer.h).
|
||||
#include "../../Win32Types.h"
|
||||
|
||||
typedef int32_t S32;
|
||||
@@ -24,3 +25,123 @@ typedef _DIG_DRIVER* HDIGDRIVER;
|
||||
typedef void* H3DPOBJECT;
|
||||
typedef H3DPOBJECT H3DSAMPLE;
|
||||
typedef U32 HPROVIDER;
|
||||
typedef U32 HPROENUM;
|
||||
typedef S32 M3DRESULT;
|
||||
|
||||
#define HPROENUM_FIRST 0
|
||||
#define M3D_NOERR 0
|
||||
|
||||
// Sample/stream status (AIL_sample_status, AIL_3D_sample_status, AIL_stream_status).
|
||||
#define SMP_FREE 0x0001
|
||||
#define SMP_DONE 0x0002
|
||||
#define SMP_PLAYING 0x0004
|
||||
#define SMP_STOPPED 0x0008
|
||||
#define SMP_PLAYINGBUTRELEASED 0x0010
|
||||
|
||||
// AIL_file_type results.
|
||||
#define AILFILETYPE_UNKNOWN 0
|
||||
#define AILFILETYPE_PCM_WAV 1
|
||||
#define AILFILETYPE_ADPCM_WAV 2
|
||||
#define AILFILETYPE_OTHER_WAV 3
|
||||
#define AILFILETYPE_VOC 4
|
||||
#define AILFILETYPE_MIDI 5
|
||||
#define AILFILETYPE_XMIDI 6
|
||||
#define AILFILETYPE_XMIDI_DLS 7
|
||||
#define AILFILETYPE_XMIDI_MLS 8
|
||||
#define AILFILETYPE_DLS 9
|
||||
#define AILFILETYPE_MLS 10
|
||||
#define AILFILETYPE_MPEG_L1_AUDIO 11
|
||||
#define AILFILETYPE_MPEG_L2_AUDIO 12
|
||||
#define AILFILETYPE_MPEG_L3_AUDIO 13
|
||||
|
||||
// AIL_file_read(filename, FILE_READ_WITH_SIZE): the returned block starts with the file size as a U32.
|
||||
#define FILE_READ_WITH_SIZE ((void*)(intptr_t)-1)
|
||||
|
||||
#define AIL_FILE_SEEK_BEGIN 0
|
||||
#define AIL_FILE_SEEK_CURRENT 1
|
||||
#define AIL_FILE_SEEK_END 2
|
||||
|
||||
typedef struct _AILSOUNDINFO
|
||||
{
|
||||
S32 format;
|
||||
void const* data_ptr;
|
||||
U32 data_len;
|
||||
U32 rate;
|
||||
S32 bits;
|
||||
S32 channels;
|
||||
U32 samples;
|
||||
U32 block_size;
|
||||
void const* initial_ptr;
|
||||
} AILSOUNDINFO;
|
||||
|
||||
typedef U32 (AILCALLBACK* AIL_file_open_callback)(char const* filename, U32* file_handle);
|
||||
typedef void (AILCALLBACK* AIL_file_close_callback)(U32 file_handle);
|
||||
typedef S32 (AILCALLBACK* AIL_file_seek_callback)(U32 file_handle, S32 offset, U32 type);
|
||||
typedef U32 (AILCALLBACK* AIL_file_read_callback)(U32 file_handle, void* buffer, U32 bytes);
|
||||
typedef S32 (AILCALLBACK* AILLENGTHYCB)(U32 state, uintptr_t user);
|
||||
|
||||
// System
|
||||
S32 AIL_startup();
|
||||
void AIL_shutdown();
|
||||
char* AIL_set_redist_directory(char const* dir);
|
||||
char* AIL_last_error();
|
||||
HDIGDRIVER AIL_open_digital_driver(U32 frequency, S32 bits, S32 channel, U32 flags);
|
||||
void AIL_close_digital_driver(HDIGDRIVER dig);
|
||||
|
||||
// Files and memory
|
||||
void AIL_set_file_callbacks(AIL_file_open_callback opencb, AIL_file_close_callback closecb,
|
||||
AIL_file_seek_callback seekcb, AIL_file_read_callback readcb);
|
||||
void* AIL_file_read(char const* filename, void* dest);
|
||||
S32 AIL_file_type(void const* data, U32 size);
|
||||
S32 AIL_WAV_info(void const* data, AILSOUNDINFO* info);
|
||||
S32 AIL_decompress_ADPCM(AILSOUNDINFO const* info, void** outdata, U32* outsize);
|
||||
S32 AIL_decompress_ASI(void const* indata, U32 insize, char const* filename_ext, void** outdata, U32* outsize,
|
||||
AILLENGTHYCB callback);
|
||||
void AIL_mem_free_lock(void* ptr);
|
||||
|
||||
// 2D samples
|
||||
HSAMPLE AIL_allocate_sample_handle(HDIGDRIVER dig);
|
||||
void AIL_release_sample_handle(HSAMPLE s);
|
||||
void AIL_init_sample(HSAMPLE s);
|
||||
S32 AIL_set_sample_file(HSAMPLE s, void const* file_image, S32 block);
|
||||
U32 AIL_sample_status(HSAMPLE s);
|
||||
void AIL_set_sample_loop_count(HSAMPLE s, S32 loop_count);
|
||||
void AIL_start_sample(HSAMPLE s);
|
||||
void AIL_stop_sample(HSAMPLE s);
|
||||
void AIL_resume_sample(HSAMPLE s);
|
||||
void AIL_end_sample(HSAMPLE s);
|
||||
void AIL_sample_volume_pan(HSAMPLE s, F32* volume, F32* pan);
|
||||
void AIL_set_sample_volume_pan(HSAMPLE s, F32 volume, F32 pan);
|
||||
|
||||
// 3D providers, listener and samples
|
||||
S32 AIL_enumerate_3D_providers(HPROENUM* next, HPROVIDER* dest, char** name);
|
||||
M3DRESULT AIL_open_3D_provider(HPROVIDER lib);
|
||||
void AIL_close_3D_provider(HPROVIDER lib);
|
||||
H3DPOBJECT AIL_open_3D_listener(HPROVIDER lib);
|
||||
void AIL_close_3D_listener(H3DPOBJECT listener);
|
||||
H3DSAMPLE AIL_allocate_3D_sample_handle(HPROVIDER lib);
|
||||
void AIL_release_3D_sample_handle(H3DSAMPLE s);
|
||||
S32 AIL_set_3D_sample_file(H3DSAMPLE s, void const* file_image);
|
||||
U32 AIL_3D_sample_status(H3DSAMPLE s);
|
||||
void AIL_set_3D_sample_loop_count(H3DSAMPLE s, U32 loops);
|
||||
void AIL_start_3D_sample(H3DSAMPLE s);
|
||||
void AIL_stop_3D_sample(H3DSAMPLE s);
|
||||
void AIL_resume_3D_sample(H3DSAMPLE s);
|
||||
void AIL_end_3D_sample(H3DSAMPLE s);
|
||||
F32 AIL_3D_sample_volume(H3DSAMPLE s);
|
||||
void AIL_set_3D_sample_volume(H3DSAMPLE s, F32 volume);
|
||||
void AIL_set_3D_position(H3DPOBJECT obj, F32 X, F32 Y, F32 Z);
|
||||
void AIL_set_3D_orientation(H3DPOBJECT obj, F32 X_face, F32 Y_face, F32 Z_face, F32 X_up, F32 Y_up, F32 Z_up);
|
||||
void AIL_set_3D_velocity(H3DPOBJECT obj, F32 dx_per_ms, F32 dy_per_ms, F32 dz_per_ms, F32 magnitude);
|
||||
void AIL_auto_update_3D_position(H3DPOBJECT obj, S32 enable);
|
||||
void AIL_update_3D_position(H3DPOBJECT obj, F32 dt_milliseconds);
|
||||
|
||||
// Streams
|
||||
HSTREAM AIL_open_stream(HDIGDRIVER dig, char const* filename, S32 stream_mem);
|
||||
void AIL_close_stream(HSTREAM stream);
|
||||
S32 AIL_stream_status(HSTREAM stream);
|
||||
void AIL_set_stream_loop_count(HSTREAM stream, S32 count);
|
||||
void AIL_start_stream(HSTREAM stream);
|
||||
void AIL_pause_stream(HSTREAM stream, S32 onoff);
|
||||
void AIL_stream_volume_levels(HSTREAM stream, F32* left_level, F32* right_level);
|
||||
void AIL_set_stream_volume_levels(HSTREAM stream, F32 left_level, F32 right_level);
|
||||
|
||||
Reference in New Issue
Block a user