#include <Windows.H>Go to the source code of this file.
Functions | |
| UINT | OpenCDPlayer (void) |
| void | StopCDPlayer (UINT id) |
| void | CloseCDPlayer (UINT id) |
| BOOL | GetCDPosition (UINT Id, INT *Track, INT *Minute, INT *Second) |
| DWORD | PlayCDTrack (UINT wDeviceID, HWND hWndNotify, BYTE bTrack, int startMin, int startSec, int stopMin, int stopSec) |
| void | TestCd (void) |
|
|
Definition at line 67 of file CD.C. Referenced by TestCd().
00068 {
00069 mciSendCommand(id, MCI_CLOSE, 0, 0);
00070 }
|
|
||||||||||||||||||||
|
Definition at line 38 of file CD.C. References DWORD, FALSE, Track, and TRUE.
00039 {
00040 MCI_STATUS_PARMS Parms;
00041 DWORD dwReturn;
00042
00043 Parms.dwItem = MCI_STATUS_POSITION;
00044 Parms.dwCallback = 0;
00045 dwReturn = mciSendCommand(Id, MCI_STATUS, MCI_STATUS_ITEM, (DWORD)&Parms);
00046
00047 if (dwReturn)
00048 return FALSE;
00049
00050 if (Track)
00051 *Track = (INT)MCI_TMSF_TRACK(Parms.dwReturn);
00052
00053 if (Minute)
00054 *Minute = (INT)MCI_TMSF_MINUTE(Parms.dwReturn);
00055
00056 if (Second)
00057 *Second = (INT)MCI_TMSF_SECOND(Parms.dwReturn);
00058
00059 return(TRUE);
00060 }
|
|
|
Definition at line 11 of file CD.C. References DWORD. Referenced by TestCd().
00012 {
00013 MCI_SET_PARMS mciSetParms;
00014 MCI_OPEN_PARMS mciOpenParms;
00015 DWORD dwReturn;
00016
00017 // Open the CD audio device by specifying the device name.
00018 mciOpenParms.lpstrDeviceType = "cdaudio";
00019 dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE, (DWORD)&mciOpenParms);
00020 if (dwReturn)
00021 {
00022 // Failed to open device. Don't close it; just return error.
00023 return 0;
00024 }
00025
00026 // Set the time format to track/minute/second/frame (TMSF).
00027 mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF;
00028 dwReturn = mciSendCommand(mciOpenParms.wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD)(LPVOID) &mciSetParms);
00029 if (dwReturn)
00030 {
00031 mciSendCommand(mciOpenParms.wDeviceID, MCI_CLOSE, 0, 0);
00032 return 0;
00033 }
00034
00035 return mciOpenParms.wDeviceID;
00036 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 72 of file CD.C. References DWORD. Referenced by TestCd().
00079 {
00080 DWORD dwReturn;
00081 MCI_PLAY_PARMS mciPlayParms;
00082
00083 // Begin playback from the given track and play until the beginning
00084 // of the next track. The window procedure function for the parent
00085 // window will be notified with an MM_MCINOTIFY message when
00086 // playback is complete. Unless the play command fails, the window
00087 // procedure closes the device.
00088 mciPlayParms.dwFrom = 0L;
00089 mciPlayParms.dwTo = 0L;
00090 mciPlayParms.dwFrom = MCI_MAKE_TMSF(bTrack, startMin, startSec, 0);
00091 mciPlayParms.dwTo = MCI_MAKE_TMSF(bTrack, stopMin, stopSec, 0);
00092 mciPlayParms.dwCallback = (DWORD) hWndNotify;
00093 dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_FROM | MCI_TO | MCI_NOTIFY, (DWORD)(LPVOID) &mciPlayParms);
00094 if (dwReturn)
00095 {
00096 mciSendCommand(wDeviceID, MCI_CLOSE, 0, 0);
00097 return 0;
00098 }
00099
00100 return 0;
00101 }
|
|
|
Definition at line 62 of file CD.C. Referenced by TestCd().
00063 {
00064 mciSendCommand(id, MCI_STOP, 0, 0);
00065 }
|
|
|
Definition at line 106 of file CD.C. References CloseCDPlayer(), OpenCDPlayer(), PlayCDTrack(), and StopCDPlayer().
00108 {
00109 UINT id;
00110
00111 id = OpenCDPlayer();
00112 PlayCDTrack(id, 0, 1, 1, 0, 5, 0);
00113 Sleep(2000);
00114 PlayCDTrack(id, 0, 1, 1, 0, 5, 30);
00115 Sleep(2000);
00116 PlayCDTrack(id, 0, 1, 1, 0, 5, 30);
00117 Sleep(2000);
00118 StopCDPlayer(id);
00119 CloseCDPlayer(id);
00120 }
|
1.3.2