예제 #1
0
        private void openButton_Click(object sender, System.EventArgs e)
        {
            try
            {
                // MCI-Gerät öffnen
                if (this.openVideoInFormCheckBox.Checked)
                {
                    mci.Open(fileNameTextBox.Text, this.pictureBox);
                }
                else
                {
                    mci.Open(fileNameTextBox.Text);
                }

                // Länge, aktuelle Lautstärke und aktuelle Abspielgeschwindigkeit auslesen
                infoLabel.Text                 = "Länge: " + mci.Length + " ms";
                this.volumeTextBox.Text        = mci.Volume.ToString();
                this.playbackSpeedTextBox.Text = mci.PlaybackSpeed.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
    public void Init()
    {
        Mci.MCI_OPEN_PARMS parms = default(Mci.MCI_OPEN_PARMS);
        parms.lpstrDeviceType = "cdaudio";
        int ret = Mci.Open(IntPtr.Zero, Mci.MCI_OPEN, Mci.MCI_OPEN_TYPE | Mci.MCI_OPEN_SHAREABLE, ref parms);

        if (ret != 0)
        {
            game_engine.Con_Printf("CDAudio_Init: MCI_OPEN failed ({0})\n", ret);
            return;
        }
        _DeviceID = parms.wDeviceID;

        // Set the time format to track/minute/second/frame (TMSF).
        Mci.MCI_SET_PARMS sp = default(Mci.MCI_SET_PARMS);
        sp.dwTimeFormat = Mci.MCI_FORMAT_TMSF;
        ret             = Mci.Set(_DeviceID, Mci.MCI_SET, Mci.MCI_SET_TIME_FORMAT, ref sp);
        if (ret != 0)
        {
            game_engine.Con_Printf("MCI_SET_TIME_FORMAT failed ({0})\n", ret);
            Mci.SendCommand(_DeviceID, Mci.MCI_CLOSE, 0, IntPtr.Zero);
            return;
        }

        for (byte n = 0; n < 100; n++)
        {
            _Remap[n] = n;
        }

        _IsInitialized = true;
        _IsEnabled     = true;

        CDAudio_GetAudioDiskInfo();
        if (!_IsValidDisc)
        {
            game_engine.Con_Printf("CDAudio_Init: No CD in player.\n");
        }
    }
예제 #3
0
        static void Main(string[] args)
        {
            string fileName = Path.Combine(Application.StartupPath, "Club Generation - Patience.mp3");

            try
            {
                // Leider funktioniert MCI (auf jeden Fall auf meinem XP-System)
                // nicht in einer Konsolenanwendung
                Mci mci = new Mci();
                mci.Open(fileName);
                mci.Play(true);
                Console.WriteLine("Abspielen beenden mit Return");
                mci.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }



            Console.WriteLine("Beenden mit Return");
            Console.ReadLine();
        }