private void Form1_Load(object sender, EventArgs e) { timer1.Start(); //Set and enable a preview,bunları her projede yaz myPlaylist.PreviewWindowSet("", panel1.Handle.ToInt32()); myPlaylist.PreviewEnable("", 1, 1); myPlaylist.PropsSet("loop", "false"); //Start mFile object myPlaylist.ObjectStart(new object()); //Fill video formats int nCount; int nIndex; string strFormat; M_VID_PROPS vidProps; comboBox1.Items.Clear(); //Get video format count myPlaylist.FormatVideoGetCount(eMFormatType.eMFT_Convert, out nCount); comboBox1.Enabled = nCount > 0; if (nCount <= 0) { return; } for (int i = 0; i < nCount; i++) { //Get format by index myPlaylist.FormatVideoGetByIndex(eMFormatType.eMFT_Convert, i, out vidProps, out strFormat); comboBox1.Items.Add(strFormat); } //Check if there is selected format myPlaylist.FormatVideoGet(eMFormatType.eMFT_Convert, out vidProps, out nIndex, out strFormat); comboBox1.SelectedIndex = nIndex > 0 ? nIndex : 0; //Fill audio formats M_AUD_PROPS audProps; comboBox2.Items.Clear(); //Get video format count myPlaylist.FormatAudioGetCount(eMFormatType.eMFT_Convert, out nCount); comboBox2.Enabled = nCount > 0; if (nCount <= 0) { return; } for (int i = 0; i < nCount; i++) { //Get format by index myPlaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, i, out audProps, out strFormat); comboBox2.Items.Add(strFormat); } //Check if there is selected format myPlaylist.FormatAudioGet(eMFormatType.eMFT_Convert, out audProps, out nIndex, out strFormat); comboBox2.SelectedIndex = nIndex > 0 ? nIndex : 0; //set audio volume trackBar1.Value = 50; double dblPos = (double)trackBar1.Value / trackBar1.Maximum; myPlaylist.PreviewAudioVolumeSet("", -1, -30 * (1 - dblPos)); }
/// <summary> /// Sets audio volume /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void trackBar1_Scroll(object sender, EventArgs e) { // Volume in dB // 0 - full volume, -100 silence double dblPos = (double)trackBarVolume.Value / trackBarVolume.Maximum; m_objPlaylist.PreviewAudioVolumeSet("", -1, -30 * (1 - dblPos)); }