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 / midiplyr / seq.h < prev    next >
C/C++ Source or Header  |  1997-10-05  |  5KB  |  130 lines

  1. /*****************************************************************************
  2. *
  3. *  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  4. *  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
  5. *  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR
  6. *  A PARTICULAR PURPOSE.
  7. *
  8. *  Copyright (C) 1993 - 1997 Microsoft Corporation. All Rights Reserved.
  9. *
  10. ******************************************************************************
  11. *
  12. * Seq.H
  13. *
  14. * Public include file for sequencer interface.
  15. *
  16. *****************************************************************************/
  17.  
  18. #ifndef _SEQ_
  19. #define _SEQ_
  20.  
  21. #include "global.h"
  22. #include "smf.h"   
  23.  
  24. #define  VERSION_MINOR              0x00
  25. #define  VERSION_MAJOR              0x04
  26. #define  SEQ_VERSION                ((DWORD)(WORD)((BYTE)VERSION_MINOR | (((WORD)(BYTE)VERSION_MAJOR) << 8)))
  27.  
  28. #define SEQ_F_EOF           0x00000001L
  29. #define SEQ_F_COLONIZED     0x00000002L
  30. #define SEQ_F_WAITING       0x00000004L   
  31.                                           
  32. #define SEQ_S_NOFILE        0
  33. #define SEQ_S_OPENED        1
  34. #define SEQ_S_PREROLLING    2
  35. #define SEQ_S_PREROLLED     3
  36. #define SEQ_S_PLAYING       4
  37. #define SEQ_S_PAUSED        5
  38. #define SEQ_S_STOPPING      6
  39. #define SEQ_S_RESET         7
  40.  
  41. #define MMSG_DONE                   (WM_USER+20)
  42.  
  43. typedef struct tag_preroll
  44. {
  45.     TICKS       tkBase;
  46.     TICKS       tkEnd;
  47. }   PREROLL,
  48.     FAR *LPPREROLL;
  49.  
  50. typedef struct tag_seq NEAR* PSEQ;
  51. typedef struct tag_seq
  52. {
  53.     DWORD       cBuffer;            /* Number of streaming buffers to alloc         */
  54.     DWORD       cbBuffer;           /* Size of each streaming buffer                */
  55.     LPSTR       pstrFile;           /* Pointer to filename to open                  */
  56.     UINT        uDeviceID;          /* Requested MIDI device ID for MMSYSTEM        */
  57.     UINT        uMCIDeviceID;       /* Our MCI device ID given to us                */
  58.     UINT        uMCITimeFormat;     /* Current time format                          */
  59.     UINT        uMCITimeDiv;        /* MCI_SEQ_DIV_xxx for current file             */
  60.     HWND        hWnd;                /* Where to post MMSG_DONE when done playing    */
  61.  
  62.     UINT        uState;             /* Sequencer state (SEQ_S_xxx)                  */
  63.     TICKS       tkLength;           /* Length of longest track                      */
  64.     DWORD       cTrk;               /* Number of tracks                             */
  65.     MMRESULT    mmrcLastErr;        /* Error return from last sequencer operation   */
  66.  
  67.     PSEQ        pNext;              /* Link to next PSEQ                            */
  68.     HSMF        hSmf;               /* Handle to open file                          */
  69.     HMIDIOUT    hmidi;              /* Handle to open MIDI device                   */
  70.     DWORD       dwTimeDivision;     /* File time division                           */
  71.  
  72.     LPBYTE      lpbAlloc;           /* Streaming buffers -- initial allocation      */ 
  73.     LPMIDIHDR   lpmhFree;           /* Streaming buffers -- free list               */
  74.     LPMIDIHDR   lpmhPreroll;        /* Streaming buffers -- preroll buffer          */
  75.     DWORD       cbPreroll;          /* Streaming buffers -- size of lpmhPreroll     */
  76.     UINT        uBuffersInMMSYSTEM; /* Streaming buffers -- in use                  */
  77.     
  78.     TICKS       tkBase;             /* Where playback started from in stream        */
  79.     TICKS       tkEnd;              /* Where playback should end                    */
  80.     
  81.     DWORD       fdwSeq;             /* Various sequencer flags                      */
  82.  
  83. }   SEQ,
  84.     NEAR *PSEQ;
  85.  
  86. /* sequence.c
  87. */
  88.  
  89. MMRESULT FNLOCAL seqAllocBuffers(    
  90.     PSEQ                pseq);
  91.  
  92. VOID FNLOCAL seqFreeBuffers(         
  93.     PSEQ                pseq);
  94.  
  95. MMRESULT FNLOCAL seqOpenFile(        
  96.     PSEQ                pseq);
  97.  
  98. MMRESULT FNLOCAL seqCloseFile(       
  99.     PSEQ                pseq);
  100.  
  101. MMRESULT FNLOCAL seqPreroll(         
  102.     PSEQ                pseq,
  103.     LPPREROLL           lppreroll);
  104.  
  105. MMRESULT FNLOCAL seqStart(           
  106.     PSEQ                pseq);
  107.  
  108. MMRESULT FNLOCAL seqPause(           
  109.     PSEQ                pseq);
  110.  
  111. MMRESULT FNLOCAL seqRestart(         
  112.     PSEQ                pseq);
  113.  
  114. MMRESULT FNLOCAL seqStop(            
  115.     PSEQ                pseq);
  116.  
  117. MMRESULT FNLOCAL seqTime(            
  118.     PSEQ                pseq,
  119.     PTICKS              pTicks);
  120.  
  121. TICKS FNLOCAL seqMillisecsToTicks(   
  122.     PSEQ                pseq,
  123.     DWORD               msOffset);
  124.  
  125. DWORD FNLOCAL seqTicksToMillisecs(   
  126.     PSEQ                pseq,
  127.     TICKS               tkOffset);
  128.  
  129. #endif
  130.