4jcraft/Minecraft.Client/Platform/Linux/Iggy/include/iggy_audio_shim.h
niansa/tuxifan 5c5f533cdd Add Linux version of Iggy [Please Squash into feat branch] (#182)
* Added Linux version of Iggy

* Expose audio functionality

* Reimplemented IggyAudioOutParamExtendedInformation more carefully

* Link to .o files directly

* Allow required SWF files to be loaded on Linux

* Some other misc ifdef WINDOWS64 fixes

* Another ifdef windows64 fix
2026-03-13 12:34:27 -05:00

72 lines
1.6 KiB
C

#ifndef IGGY_AUDIO_SHIM_H
#define IGGY_AUDIO_SHIM_H
#ifdef __cplusplus
extern "C" {
#endif
#define IGGY_AUDIO_OK 0
enum IggyAudioOutPort {
Main = 0,
Bgm = 1,
Voice = 2,
Personal = 3,
PadSpk = 4,
Audio3d = 126,
Aux = 127,
};
enum IggyAudioOutParamAttr {
None = 0,
Restricted = 1,
MixToMain = 2,
};
enum IggyAudioOutParamFormat {
S16Mono = 0,
S16Stereo = 1,
S16_8CH = 2,
FloatMono = 3,
FloatStereo = 4,
Float_8CH = 5,
S16_8CH_Std = 6,
Float_8CH_Std = 7
};
typedef union IggyAudioOutParamExtendedInformation {
unsigned raw;
struct {
unsigned data_format : 8; // bits 0.. 7
unsigned reserve0 : 8; // bits 8..15
unsigned attributes : 4; // bits 16..19
unsigned reserve1 : 10; // bits 20..29
unsigned : 1; // bit 30 (padding)
unsigned unused : 1; // bit 31
} bits;
} IggyAudioOutParamExtendedInformation;
typedef struct IggyAudioShimCallbacks {
int (*iggyAudioOutOpen)(
int user_id,
enum IggyAudioOutPort port_type,
int index,
unsigned length,
unsigned sample_rate,
IggyAudioOutParamExtendedInformation param_type);
int (*iggyAudioOutSetVolume)(int handle, int flag, int* vol);
int (*iggyAudioOutClose)(int handle);
int (*iggyAudioOutOutput)(int handle, void* ptr);
} IggyAudioShimCallbacks;
// Registers callback table used by the shim
int iggyAudioShimRegisterCallbacks(const IggyAudioShimCallbacks* callbacks);
#ifdef __cplusplus
}
#endif
#endif // IGGY_AUDIO_SHIM_H