Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

435 lines
8.5 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: cdplayer.h
  3. *
  4. *
  5. *
  6. *
  7. * Created: dd-mm-93
  8. * Author: Stephen Estrop [StephenE]
  9. *
  10. * Copyright (c) 1993 Microsoft Corporation
  11. \**************************************************************************/
  12. //#ifdef CHICAGO
  13. #include <shellapi.h>
  14. //#endif
  15. #include "..\main\mmfw.h"
  16. #define IDC_ARTIST_NAME IDC_COMBO1
  17. #define IDC_TRACK_LIST IDC_COMBO2
  18. #define IDC_TITLE_NAME IDC_EDIT1
  19. #define IDB_TRACK 127
  20. /* -------------------------------------------------------------------------
  21. ** Replace the WM_MENUSELECT message craker because it contains a bug.
  22. ** -------------------------------------------------------------------------
  23. */
  24. #ifdef HANDLE_WM_MENUSELECT
  25. #undef HANDLE_WM_MENUSELECT
  26. #define HANDLE_WM_MENUSELECT(hwnd, wParam, lParam, fn) \
  27. ((fn)( (hwnd), (HMENU)(lParam), \
  28. (UINT)LOWORD(wParam), NULL, (UINT)HIWORD(wParam)), 0L)
  29. #endif
  30. #ifndef NUMELEMS
  31. #define NUMELEMS(a) (sizeof((a))/sizeof((a)[0]))
  32. #endif // NUMELEMS
  33. #define NUM_OF_CONTROLS (IDC_CDPLAYER_LAST - IDC_CDPLAYER_FIRST + 1)
  34. #define NUM_OF_BUTTONS (IDC_BUTTON8 - IDC_BUTTON1 + 1)
  35. #define INDEX( _x_ ) ((_x_) - IDC_CDPLAYER_FIRST)
  36. #if DBG
  37. void
  38. dprintf(
  39. TCHAR *lpszFormat,
  40. ...
  41. );
  42. void CDAssert( LPSTR x, LPSTR file, int line );
  43. #undef ASSERT
  44. #define ASSERT(_x_) if (!(_x_)) CDAssert( #_x_, __FILE__, __LINE__ )
  45. #else
  46. #undef ASSERT
  47. #define ASSERT(_x_)
  48. #endif
  49. #define WM_CDPLAYER_MSG_BASE (WM_USER + 0x1000)
  50. #define WM_NOTIFY_CDROM_COUNT (WM_CDPLAYER_MSG_BASE)
  51. #define WM_NOTIFY_TOC_READ (WM_CDPLAYER_MSG_BASE+1)
  52. #define WM_NOTIFY_FIRST_SCAN (WM_CDPLAYER_MSG_BASE+2)
  53. #define HEARTBEAT_TIMER_ID 0x3243
  54. #ifdef DAYTONA
  55. #define HEARTBEAT_TIMER_RATE 250 /* 4 times a second */
  56. #else
  57. #define HEARTBEAT_TIMER_RATE 500 /* 2 times a second */
  58. #endif
  59. #define SKIPBEAT_TIMER_ID 0x3245
  60. #define SKIPBEAT_TIMER_RATE 200 /* 5 times a second */
  61. #define SKIPBEAT_TIMER_RATE2 100 /* 10 times a second */
  62. #define SKIPBEAT_TIMER_RATE3 50 /* 20 times a second */
  63. #define SKIP_ACCELERATOR_LIMIT1 5 /* 5 seconds */
  64. #define SKIP_ACCELERATOR_LIMIT2 20 /* 20 seconds */
  65. #define FRAMES_PER_SECOND 75
  66. #define FRAMES_PER_MINUTE (60*FRAMES_PER_SECOND)
  67. #define DISPLAY_UPD_LED 0x00000001
  68. #define DISPLAY_UPD_TITLE_NAME 0x00000002
  69. #define DISPLAY_UPD_TRACK_NAME 0x00000004
  70. #define DISPLAY_UPD_TRACK_TIME 0x00000008
  71. #define DISPLAY_UPD_DISC_TIME 0x00000010
  72. #define DISPLAY_UPD_CDROM_STATE 0x00000020
  73. #define DISPLAY_UPD_LEADOUT_TIME 0x80000000
  74. #define INTRO_LOWER_LEN 5
  75. #define INTRO_DEFAULT_LEN 10
  76. #define INTRO_UPPER_LEN 15
  77. // Audio Play Files consist completely of this header block. These
  78. // files are readable in the root of any audio disc regardless of
  79. // the capabilities of the drive.
  80. //
  81. // The "Unique Disk ID Number" is a calculated value consisting of
  82. // a combination of parameters, including the number of tracks and
  83. // the starting locations of those tracks.
  84. //
  85. // Applications interpreting CDDA RIFF files should be advised that
  86. // additional RIFF file chunks may be added to this header in the
  87. // future in order to add information, such as the disk and song title.
  88. #define RIFF_RIFF 0x46464952
  89. #define RIFF_CDDA 0x41444443
  90. typedef struct {
  91. DWORD dwRIFF; // 'RIFF'
  92. DWORD dwSize; // Chunk size = (file size - 8)
  93. DWORD dwCDDA; // 'CDDA'
  94. DWORD dwFmt; // 'fmt '
  95. DWORD dwCDDASize; // Chunk size of 'fmt ' = 24
  96. WORD wFormat; // Format tag
  97. WORD wTrack; // Track number
  98. DWORD DiscID; // Unique disk id
  99. DWORD lbnTrackStart; // Track starting sector (LBN)
  100. DWORD lbnTrackLength; // Track length (LBN count)
  101. DWORD msfTrackStart; // Track starting sector (MSF)
  102. DWORD msfTrackLength; // Track length (MSF)
  103. } RIFFCDA;
  104. BOOL
  105. InitInstance(
  106. HANDLE hInstance
  107. );
  108. INT_PTR CALLBACK
  109. MainWndProc(
  110. HWND hwnd,
  111. UINT message,
  112. WPARAM wParam,
  113. LPARAM lParam
  114. );
  115. BOOL
  116. CDPlay_OnInitDialog(
  117. HWND hwnd,
  118. HWND hwndFocus,
  119. LPARAM lParam
  120. );
  121. void
  122. CDPlay_OnInitMenuPopup(
  123. HWND hwnd,
  124. HMENU hMenu,
  125. UINT item,
  126. BOOL fSystemMenu
  127. );
  128. void
  129. CDPlay_OnPaint(
  130. HWND hwnd
  131. );
  132. void
  133. CDPlay_OnSysColorChange(
  134. HWND hwnd
  135. );
  136. void
  137. CDPlay_OnWinIniChange(
  138. HWND hwnd,
  139. LPCTSTR lpszSectionName
  140. );
  141. LRESULT
  142. CDPlay_OnNotify(
  143. HWND hwnd,
  144. int idFrom,
  145. NMHDR *pnmhdr
  146. );
  147. UINT
  148. CDPlay_OnNCHitTest(
  149. HWND hwnd,
  150. int x,
  151. int y
  152. );
  153. BOOL
  154. CDPlay_OnCopyData(
  155. HWND hwnd,
  156. PCOPYDATASTRUCT lpcpds
  157. );
  158. BOOL
  159. CDPlay_OnTocRead(
  160. int iDriveRead
  161. );
  162. BOOL
  163. CDPlay_OnDeviceChange(
  164. HWND hwnd,
  165. WPARAM wParam,
  166. LPARAM lParam);
  167. void
  168. CDPlay_OnDropFiles(
  169. HWND hwnd,
  170. HDROP hdrop
  171. );
  172. BOOL
  173. CDPlay_OnDrawItem(
  174. HWND hwnd,
  175. const DRAWITEMSTRUCT *lpdis
  176. );
  177. void
  178. CDPlay_OnCommand(
  179. HWND hwnd,
  180. int id,
  181. HWND hwndCtl,
  182. UINT codeNotify
  183. );
  184. void
  185. CDPlay_OnDestroy(
  186. HWND hwnd
  187. );
  188. BOOL
  189. CDPlay_OnClose(
  190. HWND hwnd,
  191. BOOL fShuttingDown
  192. );
  193. void
  194. CDPlay_OnEndSession(
  195. HWND hwnd,
  196. BOOL fEnding
  197. );
  198. void
  199. CDPlay_OnSize(
  200. HWND hwnd,
  201. UINT state,
  202. int cx,
  203. int cy
  204. );
  205. BOOL CALLBACK
  206. ChildEnumProc(
  207. HWND hwndChild,
  208. LPARAM lp
  209. );
  210. void
  211. FatalApplicationError(
  212. INT uIdStringResource,
  213. ...
  214. );
  215. void
  216. LED_ToggleDisplayFont(
  217. HWND hwnd,
  218. BOOL fFont
  219. );
  220. LPTSTR
  221. IdStr(
  222. int idResource
  223. );
  224. void
  225. CheckMenuItemIfTrue(
  226. HMENU hMenu,
  227. UINT idItem,
  228. BOOL flag
  229. );
  230. void
  231. ReadSettings(
  232. void* pData
  233. );
  234. BOOL
  235. LockTableOfContents(
  236. int cdrom
  237. );
  238. BOOL
  239. LockALLTableOfContents(
  240. void
  241. );
  242. LPVOID
  243. AllocMemory(
  244. UINT uSize
  245. );
  246. void
  247. SetPlayButtonsEnableState(
  248. void
  249. );
  250. void CALLBACK
  251. HeartBeatTimerProc(
  252. HWND hwnd,
  253. UINT uMsg,
  254. UINT idEvent,
  255. DWORD dwTime
  256. );
  257. void CALLBACK
  258. SkipBeatTimerProc(
  259. HWND hwnd,
  260. UINT uMsg,
  261. UINT idEvent,
  262. DWORD dwTime
  263. );
  264. void
  265. UpdateDisplay(
  266. DWORD Flags
  267. );
  268. HBRUSH
  269. Common_OnCtlColor(
  270. HWND hwnd,
  271. HDC hdc,
  272. HWND hwndChild,
  273. int type
  274. );
  275. BOOL
  276. Common_OnMeasureItem(
  277. HWND hwnd,
  278. MEASUREITEMSTRUCT *lpMeasureItem
  279. );
  280. void
  281. DrawTrackItem(
  282. HDC hdc,
  283. const RECT *r,
  284. DWORD item,
  285. BOOL selected
  286. );
  287. void
  288. DrawDriveItem(
  289. HDC hdc,
  290. const RECT *r,
  291. DWORD item,
  292. BOOL selected
  293. );
  294. void
  295. CdPlayerAlreadyRunning(
  296. void
  297. );
  298. void
  299. CdPlayerStartUp(
  300. HWND hwndMain
  301. );
  302. void
  303. CompleteCdPlayerStartUp(
  304. void
  305. );
  306. BOOL
  307. IsPlayOptionGiven(
  308. LPTSTR lpCmdLine
  309. );
  310. BOOL
  311. IsUpdateOptionGiven(
  312. LPTSTR lpCmdLine
  313. );
  314. /* -------------------------------------------------------------------------
  315. ** Public Globals - Most of these should be treated as read only.
  316. ** -------------------------------------------------------------------------
  317. */
  318. #ifndef GLOBAL
  319. #define GLOBAL extern
  320. #endif
  321. GLOBAL HWND g_hwndApp;
  322. GLOBAL HWND g_hwndControls[NUM_OF_CONTROLS];
  323. GLOBAL BOOL g_fSelectedOrder;
  324. GLOBAL BOOL g_fSingleDisk;
  325. GLOBAL BOOL g_fIntroPlay;
  326. GLOBAL BOOL g_fContinuous;
  327. GLOBAL BOOL g_fRepeatSingle;
  328. GLOBAL BOOL g_fDisplayT;
  329. GLOBAL BOOL g_fDisplayTr;
  330. GLOBAL BOOL g_fDisplayDr;
  331. GLOBAL BOOL g_fDisplayD;
  332. GLOBAL BOOL g_fMultiDiskAvailable;
  333. GLOBAL BOOL g_fIsIconic;
  334. GLOBAL BOOL g_fSmallLedFont;
  335. GLOBAL BOOL g_fStopCDOnExit;
  336. GLOBAL BOOL g_fPlay;
  337. GLOBAL BOOL g_fStartedInTray;
  338. GLOBAL BOOL g_fBlockNetPrompt;
  339. GLOBAL int g_NumCdDevices;
  340. GLOBAL int g_LastCdrom;
  341. GLOBAL int g_CurrCdrom;
  342. GLOBAL int g_IntroPlayLength;
  343. GLOBAL TCHAR g_szArtistTxt[128];
  344. GLOBAL TCHAR g_szTitleTxt[128];
  345. GLOBAL TCHAR g_szUnknownTxt[128];
  346. GLOBAL TCHAR g_szTrackTxt[128];
  347. GLOBAL BOOL g_fFlashLed;
  348. GLOBAL HBITMAP g_hbmTrack;
  349. GLOBAL HBITMAP g_hbmInsertPoint;
  350. GLOBAL HBITMAP g_hbmEditBtns;
  351. GLOBAL HFONT hLEDFontS;
  352. GLOBAL HFONT hLEDFontL;
  353. GLOBAL HFONT hLEDFontB;
  354. GLOBAL LPSTR g_lpCmdLine;
  355. extern BOOL g_fTrackInfoVisible;
  356. extern IMMFWNotifySink* g_pSink;
  357. GLOBAL CRITICAL_SECTION g_csTOCSerialize;