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

        if (ret != 0)
        {
            game_engine.Con_DPrintf("MCI_SET_DOOR_OPEN failed ({0})\n", ret);
        }
    }
Ejemplo n.º 2
0
    public void CloseDoor()
    {
        int ret = Mci.SendCommand(_DeviceID, Mci.MCI_SET, Mci.MCI_SET_DOOR_CLOSED, IntPtr.Zero);

        if (ret != 0)
        {
            game_engine.Con_DPrintf("MCI_SET_DOOR_CLOSED failed ({0})\n", ret);
        }
    }
Ejemplo n.º 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)
        {
            game_engine.Con_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n");
        }
    }
Ejemplo n.º 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)
        {
            game_engine.Con_DPrintf("MCI_STOP failed ({0})", ret);
        }

        _WasPlaying = false;
        _IsPlaying  = false;
    }
Ejemplo n.º 5
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");
        }
    }
Ejemplo n.º 6
0
    public void Pause()
    {
        if (!_IsEnabled)
        {
            return;
        }

        if (!_IsPlaying)
        {
            return;
        }

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

        if (ret != 0)
        {
            game_engine.Con_DPrintf("MCI_PAUSE failed ({0})", ret);
        }

        _WasPlaying = _IsPlaying;
        _IsPlaying  = false;
    }