private static void SetAudioFormat(MPlaylistClass mplaylist, string formatName) { int count = 0; mplaylist.FormatAudioGetCount(eMFormatType.eMFT_Convert, out count); int index = -1; MPLATFORMLib.M_AUD_PROPS audProps = new MPLATFORMLib.M_AUD_PROPS(); string name; for (int i = 0; i < count; i++) { mplaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, i, out audProps, out name); if (string.Equals(name, formatName, StringComparison.OrdinalIgnoreCase)) { index = i; break; } } if (index >= 0) { mplaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref audProps); } }
/// <summary> /// Set new audio format /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBoxAF_SelectedIndexChanged(object sender, EventArgs e) { M_AUD_PROPS audProps = new M_AUD_PROPS(); string strFormat; m_objMixer.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, comboBoxAF.SelectedIndex, out audProps, out strFormat); //Set new audio format m_objMixer.FormatAudioSet(eMFormatType.eMFT_Convert, ref audProps); }
private static void SetAudioFormat(MPlaylistClass mplaylist, string formatName) { int count = 0; mplaylist.FormatAudioGetCount(eMFormatType.eMFT_Convert, out count); int index = -1; MPLATFORMLib.M_AUD_PROPS audProps = new MPLATFORMLib.M_AUD_PROPS(); string name; for (int i = 0; i < count; i++) { mplaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, i, out audProps, out name); if (string.Equals(name, formatName, StringComparison.OrdinalIgnoreCase)) { index = i; break; } } if (index >= 0) { mplaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref audProps); } //MPLATFORMLib.M_AUD_PROPS m_AUD_PROPS = default(MPLATFORMLib.M_AUD_PROPS); //if (info.AudioFormat > 0) //{ // string text; // mplaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, info.AudioFormat, out m_AUD_PROPS, out text); //} //else //{ // m_AUD_PROPS.nSamplesPerSec = 48000; // m_AUD_PROPS.nChannels = 2; // m_AUD_PROPS.nBitsPerSample = 16; //} //mplaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref m_AUD_PROPS); }