/// <summary> /// Loads native functions and attaches itself to the core /// </summary> /// <param name="core">Core with loaded core api</param> public mupen64plusAudioApi(mupen64plusApi core) { AudDll = core.AttachPlugin(mupen64plusApi.m64p_plugin_type.M64PLUGIN_AUDIO, "mupen64plus-audio-bkm.dll"); // Connect dll functions dllGetBufferSize = (GetBufferSize)Marshal.GetDelegateForFunctionPointer(GetProcAddress(AudDll, "GetBufferSize"), typeof(GetBufferSize)); dllReadAudioBuffer = (ReadAudioBuffer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(AudDll, "ReadAudioBuffer"), typeof(ReadAudioBuffer)); dllGetAudioRate = (GetAudioRate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(AudDll, "GetAudioRate"), typeof(GetAudioRate)); }
/// <summary> /// Loads native functions and attaches itself to the core /// </summary> /// <param name="core">Core with loaded core api</param> public mupen64plusAudioApi(mupen64plusApi core) { T GetAudioDelegate <T>(string proc) where T : Delegate => mupen64plusApi.GetTypedDelegate <T>(AudDll, proc); AudDll = core.AttachPlugin(mupen64plusApi.m64p_plugin_type.M64PLUGIN_AUDIO, "mupen64plus-audio-bkm.dll"); // Connect dll functions dllGetBufferSize = GetAudioDelegate <GetBufferSize>("GetBufferSize"); dllReadAudioBuffer = GetAudioDelegate <ReadAudioBuffer>("ReadAudioBuffer"); dllGetAudioRate = GetAudioDelegate <GetAudioRate>("GetAudioRate"); }