Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
        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;
        }