Page 1 of 1

Set Volume and Toggle Mute

Posted: 08 Jun 2010 12:17
by iyashi
Hi,

I'm having a problem with the audio properties in LibVLC.
I keep getting the exception: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Here is the code/s:

Code: Select all

[DllImport("libvlc")] internal static extern void libvlc_audio_toggle_mute(IntPtr p_instance, ref libvlc_exception_t p_exception); [DllImport("libvlc")] internal static extern bool libvlc_audio_get_mute(IntPtr p_instance, ref libvlc_exception_t p_exception); [DllImport("libvlc")] internal static extern void libvlc_audio_set_mute(IntPtr p_instance, bool status, ref libvlc_exception_t p_exception); [DllImport("libvlc")] internal static extern int libvlc_audio_get_volume(IntPtr p_instance, ref libvlc_exception_t p_exception); [DllImport("libvlc")] internal static extern void libvlc_audio_set_volume(IntPtr p_instance, int i_volume, ref libvlc_exception_t p_exception);
At first I used the ToggleMute but it has the said error. Then I tried the "longer" version which is assigning the value "0" to have it mute.

Code: Select all

public int Volume { get { VlcException ex = new VlcException(); //bool result = LibVlc.libvlc_audio_get_mute(Handle, ref ex.Ex); int result = LibVlc.libvlc_audio_get_volume(Handle, ref ex.Ex); return result; } set { VlcException ex = new VlcException(); LibVlc.libvlc_audio_set_volume(Handle, value, ref ex.Ex); } }
Thanks!