2023-06-19 01:36:07 -04:00
|
|
|
#ifndef MXSOUNDMANAGER_H
|
|
|
|
#define MXSOUNDMANAGER_H
|
|
|
|
|
2023-10-05 03:47:37 -04:00
|
|
|
#include "decomp.h"
|
2024-03-09 15:07:52 -05:00
|
|
|
#include "mxatom.h"
|
2023-09-19 10:42:39 -04:00
|
|
|
#include "mxaudiomanager.h"
|
2023-06-29 04:10:08 -04:00
|
|
|
|
2024-06-16 09:26:04 -04:00
|
|
|
#include <SDL3/SDL_audio.h>
|
|
|
|
#include <miniaudio.h>
|
2023-10-05 03:47:37 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// VTABLE: LEGO1 0x100dc128
|
2023-06-29 04:10:08 -04:00
|
|
|
// SIZE 0x3c
|
2023-10-24 19:38:27 -04:00
|
|
|
class MxSoundManager : public MxAudioManager {
|
2023-06-29 04:10:08 -04:00
|
|
|
public:
|
2023-10-24 19:38:27 -04:00
|
|
|
MxSoundManager();
|
2024-02-01 15:42:10 -05:00
|
|
|
~MxSoundManager() override; // vtable+0x00
|
2023-06-29 04:10:08 -04:00
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
void Destroy() override; // vtable+0x18
|
|
|
|
void SetVolume(MxS32 p_volume) override; // vtable+0x2c
|
2023-10-24 19:38:27 -04:00
|
|
|
virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread); // vtable+0x30
|
2023-11-24 12:09:53 -05:00
|
|
|
virtual void Pause(); // vtable+0x34
|
|
|
|
virtual void Resume(); // vtable+0x38
|
2023-10-07 13:12:59 -04:00
|
|
|
|
2024-07-04 19:09:48 -04:00
|
|
|
ma_engine* GetEngine() { return &m_engine; }
|
2023-11-19 12:10:49 -05:00
|
|
|
|
2024-06-16 09:26:04 -04:00
|
|
|
float GetAttenuation(MxU32 p_volume);
|
2023-11-24 12:09:53 -05:00
|
|
|
|
2024-02-02 20:16:57 -05:00
|
|
|
protected:
|
2023-10-24 19:38:27 -04:00
|
|
|
void Init();
|
|
|
|
void Destroy(MxBool p_fromDestructor);
|
2023-10-31 10:22:01 -04:00
|
|
|
MxPresenter* FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_objectId);
|
2023-10-05 03:47:37 -04:00
|
|
|
|
2024-06-16 09:26:04 -04:00
|
|
|
// [library:audio]
|
|
|
|
// Upscaling everything to 44.1KHz, since we have various sample rates throughout the game.
|
|
|
|
// Not sure how DirectSound handles this when different buffers have different rates.
|
|
|
|
static const MxU32 g_sampleRate = 44100;
|
|
|
|
|
|
|
|
static void AudioStreamCallback(
|
|
|
|
void* p_userdata,
|
|
|
|
SDL_AudioStream* p_stream,
|
|
|
|
int p_additionalAmount,
|
|
|
|
int p_totalAmount
|
|
|
|
);
|
|
|
|
|
|
|
|
ma_engine m_engine;
|
|
|
|
SDL_AudioStream* m_stream;
|
2023-12-13 05:48:14 -05:00
|
|
|
undefined m_unk0x38[4];
|
2023-06-19 01:36:07 -04:00
|
|
|
};
|
|
|
|
|
2023-12-12 14:27:17 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x100ae7b0
|
|
|
|
// MxSoundManager::`scalar deleting destructor'
|
|
|
|
|
2023-06-19 01:36:07 -04:00
|
|
|
#endif // MXSOUNDMANAGER_H
|