#define MIXER_FLAG_NONE 0x0 #define MIXER_FLAG_SPATIALIZE 0x1 #define MIXER_DESC(...) ((M_TrackDesc) { \ .flags = 0, \ \ .volume = 1.0, \ .speed = 1.0, \ .looping = 0, \ \ .pos = VEC2(0, 0), \ \ __VA_ARGS__ \ }) Struct(M_TrackDesc) { u32 flags; f32 volume; /* 0 -> 1.0+ */ f32 speed; /* 0 -> 1.0+ */ b32 looping; /* MIXER_FLAG_SPATIALIZE */ Vec2 pos; }; Struct(M_Handle) { u64 gen; void *data; }; /* Stereo mix of 32 bit float samples */ Struct(M_PcmF32) { u64 count; f32 *samples; }; Struct(M_StartupReceipt) { i32 _; }; M_StartupReceipt mixer_startup(void); /* Interface */ M_Handle mixer_play(SND_Sound *sound); M_Handle mixer_play_ex(SND_Sound *sound, M_TrackDesc desc); M_TrackDesc mixer_track_get(M_Handle handle); void mixer_track_set(M_Handle handle, M_TrackDesc desc); void mixer_set_listener(Vec2 pos, Vec2 dir); /* Mixing */ M_PcmF32 mixer_update(Arena *arena, u64 frame_request_count);