Beispiel #1
0
        public void Edject()
        {
            int ret = Mci.SendCommand(_DeviceID, Mci.MCI_SET, Mci.MCI_SET_DOOR_OPEN, IntPtr.Zero);

            if (ret != 0)
            {
                Con.DPrint("MCI_SET_DOOR_OPEN failed ({0})\n", ret);
            }
        }
Beispiel #2
0
        public void CloseDoor()
        {
            int ret = Mci.SendCommand(_DeviceID, Mci.MCI_SET, Mci.MCI_SET_DOOR_CLOSED, IntPtr.Zero);

            if (ret != 0)
            {
                Con.DPrint("MCI_SET_DOOR_CLOSED failed ({0})\n", ret);
            }
        }
Beispiel #3
0
        public void Shutdown()
        {
            if (_Form != null)
            {
                _Form.Dispose();
                _Form = null;
            }

            if (!_IsInitialized)
            {
                return;
            }

            Stop();

            if (Mci.SendCommand(_DeviceID, Mci.MCI_CLOSE, Mci.MCI_WAIT, IntPtr.Zero) != 0)
            {
                Con.DPrint("CDAudio_Shutdown: MCI_CLOSE failed\n");
            }
        }
Beispiel #4
0
        public void Stop()
        {
            if (!_IsEnabled)
            {
                return;
            }

            if (!_IsPlaying)
            {
                return;
            }

            int ret = Mci.SendCommand(_DeviceID, Mci.MCI_STOP, 0, IntPtr.Zero);

            if (ret != 0)
            {
                Con.DPrint("MCI_STOP failed ({0})", ret);
            }

            _WasPlaying = false;
            _IsPlaying  = false;
        }
Beispiel #5
0
        public void Init()
        {
            Mci.OpenParams parms = default(Mci.OpenParams);
            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)
            {
                Con.Print("CDAudio_Init: MCI_OPEN failed ({0})\n", ret);
                return;
            }
            _DeviceID = parms.wDeviceID;

            // Set the time format to track/minute/second/frame (TMSF).
            Mci.SetParams sp = default(Mci.SetParams);
            sp.dwTimeFormat = Mci.MCI_FORMAT_TMSF;
            ret             = Mci.Set(_DeviceID, Mci.MCI_SET, Mci.MCI_SET_TIME_FORMAT, ref sp);
            if (ret != 0)
            {
                Con.Print("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;

            ReloadDiskInfo();
            if (!_IsValidDisc)
            {
                Con.Print("CDAudio_Init: No CD in player.\n");
            }
        }
Beispiel #6
0
        public void Pause()
        {
            if (!_IsEnabled)
            {
                return;
            }

            if (!_IsPlaying)
            {
                return;
            }

            Mci.GenericParams gp = default(Mci.GenericParams);
            int ret = Mci.SendCommand(_DeviceID, Mci.MCI_PAUSE, 0, ref gp);

            if (ret != 0)
            {
                Con.DPrint("MCI_PAUSE failed ({0})", ret);
            }

            _WasPlaying = _IsPlaying;
            _IsPlaying  = false;
        }