home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / directx2 / sdk / samples / mstream / mstream.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-28  |  5.0 KB  |  146 lines

  1. /*==========================================================================
  2.  *
  3.  *  Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved.
  4.  *
  5.  *  File:   MStream.h
  6.  *  Content:    Main header file for the MSTREAM sample application
  7.  *
  8.  ***************************************************************************/
  9. #ifndef __MSTREAM_INCLUDED__
  10. #define __MSTREAM_INCLUDED__
  11.  
  12. /*****************************************************************************/
  13. /* Controls for buffer size, etc. */
  14.  
  15. #define TRACK_BUFFER_SIZE       1024
  16. #define OUT_BUFFER_SIZE                 1024 // Max stream buffer size in bytes
  17. #define BUFFER_TIME_LENGTH      60   // Amount to fill in milliseconds
  18. #define NUM_STREAM_BUFFERS              2
  19.  
  20. #define DEBUG_CALLBACK_TIMEOUT      2000    // Wait 2 seconds for callback
  21.  
  22. /*****************************************************************************/
  23. /* A bunch of constants used for calculating position */
  24. /* and size of child controls for the main window.    */
  25.  
  26. #define BORDER_SPACE_CX     10
  27. #define BORDER_SPACE_CY     10
  28. #define CONTROL_SPACE_CX    4
  29. #define CONTROL_SPACE_CY    4
  30. #define TEXT_SPACE_CY       3
  31. #define TEXT_SPACE_CX       2
  32.  
  33. #define BUTTON_CX       68
  34. #define BUTTON_CY       26
  35. #define CHECK_CX        68
  36. #define CHECK_CY        26
  37. #define BUTTON_SPACE_CX     4
  38. #define BUTTON_SPACE_CY     4
  39. #define CHECK_SPACE_CY      4
  40.  
  41. #define TEMPO_TB_CX     150
  42. #define TEMPO_TB_CY             32
  43. #define VOL_TB_CX       150
  44. #define VOL_TB_CY               32
  45.  
  46. #define TEMPO_TEXT_CX       TEMPO_TB_CX
  47. #define VOL_TEXT_CX     VOL_TB_CX
  48.  
  49. #define VOL_TB_MIN      0
  50. #define VOL_TB_MAX      1000
  51. #define VOL_PAGESIZE        10
  52. #define VOL_MIN         0
  53. #define VOL_MAX         127
  54. #define VOL_CACHE_INIT      100
  55. #define TEMPO_MIN       1
  56. #define TEMPO_MAX       500
  57. #define TEMPO_PAGESIZE      10
  58.  
  59.  
  60. #define WM_MSTREAM_PROGRESS (WM_USER + 100)
  61. #define WM_MSTREAM_UPDATEVOLUME (WM_USER + 101)
  62.  
  63. /*****************************************************************************/
  64. /* All sorts of bit flags and error codes for */
  65. /* communicating between various subsystems.  */
  66.  
  67. #define MSTREAM_STOPF_NOREOPEN      0x0001
  68.  
  69. #define STREAMF_BUFFER_WARNING      0x00000002
  70.  
  71. #define CONVERTF_RESET          0x00000001
  72.  
  73. #define CONVERTF_STATUS_DONE        0x00000001
  74. #define CONVERTF_STATUS_STUCK       0x00000002
  75. #define CONVERTF_STATUS_GOTEVENT    0x00000004
  76.  
  77. #define CONVERTERR_NOERROR  0   // No error occured
  78. #define CONVERTERR_CORRUPT  -101    // The input file is corrupt
  79. // The converter has already encountered a corrupt file and cannot convert any
  80. // more of this file -- you must reset the converter
  81. #define CONVERTERR_STUCK    -102
  82. #define CONVERTERR_DONE     -103    // Converter is done
  83. #define CONVERTERR_BUFFERFULL   -104    // The buffer is full
  84. #define CONVERTERR_METASKIP -105    // Skipping unknown meta event
  85.  
  86. #define STATUS_KILLCALLBACK 100 // Signals that the callback should die
  87. #define STATUS_CALLBACKDEAD 200 // Signals callback is done processing
  88. #define STATUS_WAITINGFOREND    300    // Callback's waiting for buffers to play
  89.  
  90. #define VOLUME_BUFFER       3567    // Random value which acts as a buffer id
  91.  
  92.  
  93. #ifdef DEBUG
  94. #define DebugPrint( sz )        DPF( 3, sz )
  95. #else
  96. #define DebugPrint( sz )
  97. #endif
  98.  
  99.  
  100.  
  101. /*
  102.  *   This structure is used to pass information to the ConvertToBuffer()
  103.  * system and then internally by that function to send information about the
  104.  * target stream buffer and current state of the conversion process to lower
  105.  * level conversion routines internal to the MSTRCONV module.  See that source
  106.  * file for specific details.
  107.  */
  108. typedef struct _ConvertInfo
  109. {
  110.     MIDIHDR mhBuffer;       // Standard Windows stream buffer header
  111.     DWORD   dwStartOffset;      // Start offset from mhStreamBuffer.lpStart
  112.     DWORD   dwMaxLength;        // Max length to convert on this pass
  113.  
  114.     DWORD   dwBytesRecorded;    // Used internally by the MSTRCONV module
  115.     DWORD   tkStart;        // Used internally by the MSTRCONV module
  116.     BOOL    bTimesUp;       // Used internally by the MSTRCONV module
  117. } CONVERTINFO, *LPCONVERTINFO;
  118.  
  119.  
  120. /*****************************************************************************/
  121. /* Function declarations */
  122.  
  123. LRESULT CALLBACK MainWindowProc( HWND, unsigned, WPARAM, LPARAM );
  124. BOOL CALLBACK DLG_About( HWND, UINT, WPARAM, LPARAM );
  125. void CALLBACK MidiProc( HMIDIIN, UINT, DWORD, DWORD, DWORD );
  126.  
  127. void BuildTitleBarText( void );
  128. void ErrorMessageBox( UINT, DWORD );
  129. void HandleTempoScroll( int, int );
  130. void HandleVolScroll( int, int );
  131. void MidiErrorMessageBox( MMRESULT );
  132. void SetAllChannelVolumes( DWORD dwVolumePercent );
  133. void SetChannelVolume( DWORD dwChannel, DWORD dwVolumePercent );
  134. void UpdateFromControls( void );
  135.  
  136. int CreateChildren( RECT );
  137. int HandleCommDlgError( DWORD );
  138. BOOL StreamBufferSetup( void );
  139.  
  140. BOOL    ConverterInit( LPSTR szInFile );
  141. void    ConverterCleanup( void );
  142. int ConvertToBuffer( DWORD, LPCONVERTINFO );
  143.  
  144. #endif /* __MSTREAM_INCLUDED__ */
  145.  
  146.