home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / graphics / audio / mixapp / mixapp.h < prev    next >
C/C++ Source or Header  |  1997-10-05  |  12KB  |  532 lines

  1. //==========================================================================;
  2. //
  3. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. //  PURPOSE.
  7. //
  8. //  Copyright (C) 1993 - 1997  Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. //  mixapp.h
  13. //
  14. //==========================================================================;
  15.  
  16. #ifndef _INC_MIXAPP
  17. #define _INC_MIXAPP                 // #defined if file has been included
  18.  
  19. #ifndef RC_INVOKED
  20. #pragma pack(1)                     // assume byte packing throughout
  21. #endif
  22.  
  23. #ifndef EXTERN_C
  24. #ifdef __cplusplus
  25.     #define EXTERN_C extern "C"
  26. #else
  27.     #define EXTERN_C extern
  28. #endif
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C"                          // assume C declarations for C++
  33. {
  34. #endif
  35.  
  36. //
  37. //Some useful stuff to clarify the code a bit
  38. //
  39. #ifndef FNLOCAL
  40.     #ifdef DEBUG
  41.         #define FNLOCAL     _stdcall
  42.     #else
  43.         #define FNLOCAL     static _stdcall
  44.     #endif
  45.     #define FNGLOBAL    _stdcall
  46.     #define FNCGLOBAL   _cdecl
  47. #endif
  48.  
  49.  
  50. //
  51. //  for compiling Unicode
  52. //
  53. #ifdef UNICODE
  54.     #define SIZEOF(x)   (sizeof(x)/sizeof(WCHAR))
  55. #else
  56.     #define SIZEOF(x)   sizeof(x)
  57. #endif
  58.  
  59.  
  60. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  61. //
  62. //  Application Version Information:
  63. //
  64. //
  65. //
  66. //
  67. //  NOTE! all string resources that will be used in app.rcv for the
  68. //  version resource information *MUST* have an explicit \0 terminator!
  69. //
  70. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  71.  
  72. #define APP_VERSION_MAJOR           4
  73. #define APP_VERSION_MINOR           0
  74. #define APP_VERSION_BUILD           0
  75. #ifdef UNICODE
  76. #define APP_VERSION_STRING_RC       "Version 4.00 (Unicode Enabled)\0"
  77. #else
  78. #define APP_VERSION_STRING_RC       "Version 4.00\0"
  79. #endif
  80.  
  81. #define APP_VERSION_NAME_RC         "mixapp32.exe\0"
  82. #define APP_VERSION_BYLINE_RC       "\0"
  83. #define APP_VERSION_COMPANYNAME_RC  "Microsoft Corporation\0"
  84. #define APP_VERSION_COPYRIGHT_RC    "Copyright (C) 1985 - 1996 Microsoft Corp.\0"
  85.  
  86. #if (defined(_X86_)) || (defined(i386))
  87. #define APP_VERSION_PRODUCTNAME_RC  "Microsoft Windows Sample Application (i386)\0"
  88. #endif
  89. #if (defined(_MIPS_)) || (defined(MIPS))
  90. #define APP_VERSION_PRODUCTNAME_RC  "Microsoft Windows Sample Application (MIPS)\0"
  91. #endif
  92. #if (defined(_ALPHA_)) || (defined(ALPHA))
  93. #define APP_VERSION_PRODUCTNAME_RC  "Microsoft Windows Sample Application (Alpha)\0"
  94. #endif
  95. #ifndef APP_VERSION_PRODUCTNAME_RC
  96. #define APP_VERSION_PRODUCTNAME_RC  "Microsoft Windows Sample Application\0"
  97. #endif
  98.  
  99. #ifdef DEBUG
  100. #define APP_VERSION_DESCRIPTION_RC  "Microsoft Audio Mixer Manager Sample Application (debug)\0"
  101. #else
  102. #define APP_VERSION_DESCRIPTION_RC  "Microsoft Audio Mixer Manager Sample Application\0"
  103. #endif
  104.  
  105.  
  106. //
  107. //  Unicode versions (if UNICODE is defined)... the resource compiler
  108. //  cannot deal with the TEXT() macro.
  109. //
  110. #define APP_VERSION_STRING          TEXT(APP_VERSION_STRING_RC)
  111. #define APP_VERSION_NAME            TEXT(APP_VERSION_NAME_RC)
  112. #define APP_VERSION_BYLINE          TEXT(APP_VERSION_BYLINE_RC)
  113. #define APP_VERSION_COMPANYNAME     TEXT(APP_VERSION_COMPANYNAME_RC)
  114. #define APP_VERSION_COPYRIGHT       TEXT(APP_VERSION_COPYRIGHT_RC)
  115. #define APP_VERSION_PRODUCTNAME     TEXT(APP_VERSION_PRODUCTNAME_RC)
  116. #define APP_VERSION_DESCRIPTION     TEXT(APP_VERSION_DESCRIPTION_RC)
  117.  
  118.  
  119.  
  120.  
  121. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  122. //
  123. //  misc defines for misc sizes and things...
  124. //
  125. //
  126. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  127.  
  128. //
  129. //  bilingual. this allows the same identifier to be used in resource files
  130. //  and code without having to decorate the id in your code.
  131. //
  132. #ifdef RC_INVOKED
  133.     #define RCID(id)    id
  134. #else
  135.     #define RCID(id)    MAKEINTRESOURCE(id)
  136. #endif
  137.  
  138.  
  139. //
  140. //  misc. defines
  141. //
  142. #define APP_MAX_APP_NAME_CHARS          30
  143. #define APP_MAX_APP_NAME_BYTES          (APP_MAX_APP_NAME_CHARS * sizeof(TCHAR))
  144. #define APP_MAX_STRING_RC_CHARS         512
  145. #define APP_MAX_STRING_RC_BYTES         (APP_MAX_STRING_RC_CHARS * sizeof(TCHAR))
  146. #define APP_MAX_STRING_ERROR_CHARS      512
  147. #define APP_MAX_STRING_ERROR_BYTES      (APP_MAX_STRING_ERROR_CHARS * sizeof(TCHAR))
  148.  
  149. #define APP_WINDOW_XOFFSET              CW_USEDEFAULT
  150. #define APP_WINDOW_YOFFSET              CW_USEDEFAULT
  151. #define APP_WINDOW_WIDTH                500 //CW_USEDEFAULT
  152. #define APP_WINDOW_HEIGHT               300 //CW_USEDEFAULT
  153.  
  154.  
  155. //
  156. //  resource defines...
  157. //
  158. #define ICON_APP                        RCID(10)
  159. #define ACCEL_APP                       RCID(15)
  160.  
  161.  
  162. //
  163. //  the application menu...
  164. //
  165. //
  166. #define MENU_APP                        RCID(20)
  167. #define APP_MENU_ITEM_FILE              0
  168. #define IDM_FILE_MIXER_DEVICE           1000
  169. #define IDM_FILE_FONT                   1001
  170. #define IDM_FILE_DEBUG_LOG              1005
  171. #define IDM_FILE_ABOUT                  1009
  172. #define IDM_FILE_EXIT                   1010
  173.  
  174. #define APP_MENU_ITEM_VIEW              1
  175. #define IDM_VIEW_LINE_INFO              1050
  176. #define IDM_VIEW_LINE_CONTROLS          1051
  177.  
  178. #define IDM_UPDATE                      1100
  179.  
  180.  
  181.  
  182. //
  183. //  the main window control id's...
  184. //
  185. #define IDD_APP_LIST_LINES                  100
  186.  
  187.  
  188. //
  189. //  misc dlg boxes...
  190. //
  191. #define DLG_ABOUT                           RCID(50)
  192. #define IDD_ABOUT_VERSION_OS                100
  193. #define IDD_ABOUT_VERSION_PLATFORM          101
  194.  
  195. #define IDD_ABOUT_VERSION_MMSYSTEM          150
  196.  
  197.  
  198.  
  199. #define DLG_MIXAPP_DEVICE                   RCID(51)
  200. #define IDD_MADEVICE_COMBO_DEVICE           100
  201. #define IDD_MADEVICE_EDIT_CAPABILITIES      101
  202.  
  203.  
  204.  
  205. #define DLG_LINEINFO                        RCID(55)
  206. #define IDD_LINEINFO_EDIT_INFO              100
  207.  
  208.  
  209. #define DLG_LINECONTROLS                    RCID(60)
  210. #define IDD_LINECONTROLS_STATIC_POSITION    100
  211. #define IDD_LINECONTROLS_LIST_CONTROLS      101
  212. #define IDD_LINECONTROLS_BTN_INFO           102
  213. #define IDD_LINECONTROLS_BTN_SETTINGS       103
  214.  
  215. #define DLG_CONTROLINFO                     RCID(61)
  216. #define IDD_CONTROLINFO_EDIT_INFO           100
  217.  
  218.  
  219.  
  220. //
  221. //  mainit.c
  222. //
  223. //
  224. //
  225. BOOL CALLBACK AboutDlgProc
  226. (
  227.     HWND            hwnd,
  228.     UINT            uMsg,
  229.     WPARAM          wParam,
  230.     LPARAM          lParam
  231. );
  232.  
  233. BOOL FNGLOBAL MixAppChooseFont
  234. (
  235.     HWND            hwnd
  236. );
  237.  
  238. LRESULT FNGLOBAL AppCreate
  239. (
  240.     HWND            hwnd,
  241.     LPCREATESTRUCT  pcs
  242. );
  243.  
  244. LRESULT FNGLOBAL AppQueryEndSession
  245. (
  246.     HWND            hwnd
  247. );
  248.  
  249. LRESULT FNGLOBAL AppEndSession
  250. (
  251.     HWND            hwnd,
  252.     BOOL            fEndSession
  253. );
  254.  
  255. LRESULT FNGLOBAL AppClose
  256. (
  257.     HWND            hwnd
  258. );
  259.  
  260. HWND FNGLOBAL AppInit
  261. (
  262.     HINSTANCE       hinst,
  263.     HINSTANCE       hinstPrev,
  264.     LPTSTR          pszCmdLine,
  265.     int             nCmdShow
  266. );
  267.  
  268. int FNGLOBAL AppExit
  269. (
  270.     HINSTANCE               hinst,
  271.     int                     nResult
  272. );
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279. //
  280. //  macntrls.c
  281. //
  282. //
  283. //
  284. BOOL CALLBACK MixAppDlgProcLineControls
  285. (
  286.     HWND                    hwnd,
  287.     UINT                    uMsg,
  288.     WPARAM                  wParam,
  289.     LPARAM                  lParam
  290. );
  291.  
  292. LRESULT FNGLOBAL MixAppControlChange
  293. (
  294.     HWND                    hwnd,
  295.     HMIXER                  hmx,
  296.     DWORD                   dwControlID
  297. );
  298.  
  299.  
  300.  
  301. //
  302. //  mixapp.c
  303. //
  304. //
  305. //
  306. LRESULT CALLBACK AppWndProc
  307. (
  308.     HWND                    hwnd,
  309.     UINT                    uMsg,
  310.     WPARAM                  wParam,
  311.     LPARAM                  lParam
  312. );
  313.  
  314.  
  315. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  316. //
  317. //  string resources
  318. //
  319. //
  320. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  321.  
  322. #define IDS_APP_NAME                100
  323.  
  324.  
  325.  
  326. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  327. //
  328. //  Public function prototypes
  329. //
  330. //
  331. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  332.  
  333. void FNGLOBAL AppHourGlass
  334. (
  335.     BOOL                    fHourGlass
  336. );
  337. int FNCGLOBAL AppMsgBox
  338. (
  339.     HWND                    hwnd,
  340.     UINT                    fuStyle,
  341.     PTSTR                   pszFormat,
  342.     ...
  343. );
  344. int FNCGLOBAL AppSetWindowText
  345. (
  346.     HWND                    hwnd,
  347.     PTSTR                   pszFormat,
  348.     ...
  349. );
  350. void FNCGLOBAL MixAppDebugLog
  351. (
  352.     PTSTR                   pszFormat,
  353.     ...
  354. );
  355. //
  356. //
  357. //
  358. //
  359. int FNCGLOBAL MEditPrintF
  360. (
  361.     HWND            hedit,
  362.     PTSTR           pszFormat,
  363.     ...
  364. );
  365.  
  366.  
  367. HMIXER FNGLOBAL MixAppNewDevice
  368. (
  369.     HWND                    hwnd,
  370.     HMIXER                  hmxCur,
  371.     UINT                    uMxId
  372. );
  373.  
  374. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  375. //
  376. //  global variables, etc.
  377. //
  378. //
  379. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  380.  
  381. #define APP_OPTF_DEBUGLOG       0x0004
  382.  
  383.  
  384. extern HINSTANCE    ghinst;
  385. extern UINT         gfuAppOptions;
  386.  
  387. extern TCHAR        gszNull[];
  388. extern TCHAR        gszCRLF[];
  389.  
  390. extern TCHAR        gszAppName[APP_MAX_APP_NAME_CHARS];
  391.  
  392.  
  393. //
  394. //
  395. //
  396. #include "tlb.h"
  397.  
  398. extern PTABBEDLISTBOX   gptlbLines;
  399.  
  400. extern HMIXER           ghmx;
  401.  
  402. extern BOOL             gfDisplayingControl;
  403. extern DWORD            gdwControlID;
  404. extern HWND             ghdlgControl;
  405. extern MIXERLINE        gmxl;
  406. extern MIXERCONTROL     gmxctrl;
  407.  
  408.  
  409.  
  410.  
  411. BOOL CALLBACK MixAppDlgProcControlList
  412. (
  413.     HWND            hwnd,
  414.     UINT            uMsg,
  415.     WPARAM          wParam,
  416.     LPARAM          lParam
  417. );
  418.  
  419.  
  420. //
  421. //  malines.c
  422. //
  423. //
  424. //
  425. BOOL CALLBACK MixAppDlgProcLineInfo
  426. (
  427.     HWND                    hwnd,
  428.     UINT                    uMsg,
  429.     WPARAM                  wParam,
  430.     LPARAM                  lParam
  431. );
  432.  
  433. BOOL FNGLOBAL MixAppRefreshLineList
  434. (
  435.     HWND                    hwnd,
  436.     PTABBEDLISTBOX          ptlb
  437. );
  438.  
  439. LRESULT FNGLOBAL MixAppLineChange
  440. (
  441.     HWND                    hwnd,
  442.     HMIXER                  hmx,
  443.     DWORD                   dwLineID
  444. );
  445.  
  446.  
  447. BOOL CALLBACK MixAppDlgProcControlMeter
  448. (
  449.     HWND            hwnd,
  450.     UINT            uMsg,
  451.     WPARAM          wParam,
  452.     LPARAM          lParam
  453. );
  454.  
  455. BOOL CALLBACK MixAppDlgProcControlSwitch
  456. (
  457.     HWND            hwnd,
  458.     UINT            uMsg,
  459.     WPARAM          wParam,
  460.     LPARAM          lParam
  461. );
  462.  
  463. BOOL CALLBACK MixAppDlgProcControlFader
  464. (
  465.     HWND            hwnd,
  466.     UINT            uMsg,
  467.     WPARAM          wParam,
  468.     LPARAM          lParam
  469. );
  470.  
  471.  
  472. BOOL CALLBACK MixAppDlgProcDevice
  473. (
  474.     HWND            hwnd,
  475.     UINT            uMsg,
  476.     WPARAM          wParam,
  477.     LPARAM          lParam
  478. );
  479.  
  480. BOOL FNGLOBAL MixAppGetControlTypeName
  481. (
  482.     LPMIXERCONTROL          pmxctrl,
  483.     LPTSTR                  szControlType
  484. );
  485.  
  486.  
  487. //
  488. //
  489. //
  490. //
  491. #define DLG_MIXAPP_CONTROL              RCID(42)
  492. #define IDD_MACONTROL_GRP_MULTICHANNEL  100
  493. #define IDD_MACONTROL_GRP_UNIFORM       101
  494. #define IDD_MACONTROL_TXT_SHORT_NAME    102
  495. #define IDD_MACONTROL_TXT_LONG_NAME     103
  496. #define IDD_MACONTROL_TXT_VALUE         104
  497. #define IDD_MACONTROL_TXT_BOUNDS        105
  498. #define IDD_MACONTROL_TXT_METRICS       106
  499. #define IDD_MACONTROL_TXT_LINEINFO      107
  500.  
  501. #define IDD_MACONTROL_MULTICHANNEL_BASE 200
  502. #define IDD_MACONTROL_UNIFORM_BASE      300
  503.  
  504.  
  505. //
  506. //
  507. //
  508. typedef struct tMACONTROLINSTANCE
  509. {
  510.     HMIXER                      hmx;
  511.     LPMIXERLINE                 pmxl;
  512.     LPMIXERCONTROL              pmxctrl;
  513.  
  514. } MACONTROLINSTANCE, FAR *LPMACONTROLINSTANCE;
  515.  
  516.  
  517. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  518. //
  519. //
  520. //
  521. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  522.  
  523. #ifndef RC_INVOKED
  524. #pragma pack()                      // revert to default packing
  525. #endif
  526.  
  527. #ifdef __cplusplus
  528. }                                   // end of extern "C" {
  529. #endif
  530.  
  531. #endif // _INC_APPPORT
  532.