private int SetupCallback(void **data, char *format, int *rate, int *channels) { IntPtr pFormat = new IntPtr(format); string formatStr = Marshal.PtrToStringAnsi(pFormat); SoundType sType; if (!Enum.TryParse <SoundType>(formatStr, out sType)) { throw new ArgumentException("Unsupported sound type " + formatStr); } m_format = new SoundFormat(sType, *rate, *channels); if (m_formatSetupCB != null) { m_format = m_formatSetupCB(m_format); } Marshal.Copy(m_format.Format.ToUtf8(), 0, pFormat, 4); *rate = m_format.Rate; *channels = m_format.Channels; return(m_format.UseCustomAudioRendering == true ? 0 : 1); }
public void SetFormat(SoundFormat format) { m_format = format; LibVlcMethods.libvlc_audio_set_format(m_hMediaPlayer, m_format.Format.ToUtf8(), m_format.Rate, m_format.Channels); }
private int SetupCallback(void** data, char* format, int* rate, int* channels) { IntPtr pFormat = new IntPtr(format); string formatStr = Marshal.PtrToStringAnsi(pFormat); SoundType sType; if (!Enum.TryParse<SoundType>(formatStr, out sType)) { throw new ArgumentException("Unsupported sound type " + formatStr); } m_format = new SoundFormat(sType, *rate, *channels); if (m_formatSetupCB != null) { m_format = m_formatSetupCB(m_format); } Marshal.Copy(m_format.Format.ToUtf8(), 0, pFormat, 4); *rate = m_format.Rate; *channels = m_format.Channels; return m_format.UseCustomAudioRendering == true ? 0 : 1; }