public System.IO.Stream DoResampler(DriverModels.EngineInput Args) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); if (!_isLegalPlugin) { return(ms); } try { IntPtr hModule = LoadLibrary(DllPath); if (hModule == IntPtr.Zero) { _isLegalPlugin = false; } else { IntPtr m = GetProcAddress(hModule, "DoResampler"); if (m != IntPtr.Zero) { DoResamplerDelegate g = (DoResamplerDelegate)Marshal.GetDelegateForFunctionPointer(m, typeof(DoResamplerDelegate)); DriverModels.EngineOutput Output = Intptr2EngineOutput(g(Args)); ms = new System.IO.MemoryStream(Output.wavData); } FreeLibrary(hModule); } } catch {; } return(ms); }
public byte[] DoResampler(EngineInput Args) { byte[] data = new byte[0]; if (!_isLegalPlugin) { return(data); } try { IntPtr hModule = LoadLibrary(DllPath); if (hModule == IntPtr.Zero) { _isLegalPlugin = false; } else { IntPtr m = GetProcAddress(hModule, "DoResampler"); if (m != IntPtr.Zero) { DoResamplerDelegate g = (DoResamplerDelegate)Marshal.GetDelegateForFunctionPointer(m, typeof(DoResamplerDelegate)); EngineOutput Output = Intptr2EngineOutput(g(Args)); data = Output.wavData; } FreeLibrary(hModule); } } catch {; } return(data); }