home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / CDX.ZIP / Src / Cds / Music.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-14  |  2.4 KB  |  82 lines

  1. //////////////////////////////////////////////////////////////////////////////////
  2. // Project Name: [ CDS Class Library - CDS.lib ]
  3. // Author:       [ Dan Farley - 97308096@brookes.ac.uk ]
  4. // Source File:  [ CDS_Music Implementation ]
  5. // Revision:     [ 1.6 ]
  6. //////////////////////////////////////////////////////////////////////////////////
  7. #include "CDS.h"
  8.  
  9. //////////////////////////////////////////////////////////////////////////////////
  10. // CDS_Music Constructor
  11. //////////////////////////////////////////////////////////////////////////////////
  12. CDS_Music::CDS_Music(void *hwnd)
  13. {
  14.     m_hWnd = hwnd;
  15. }
  16.  
  17. //////////////////////////////////////////////////////////////////////////////////
  18. // CDS_Music Play
  19. //////////////////////////////////////////////////////////////////////////////////
  20. BOOL CDS_Music::Play(const char *filename)
  21. {
  22.     if(filename == NULL) return FALSE;
  23.     char buffer[256];
  24.  
  25.     sprintf(buffer, "open %s type sequencer alias MUSIC", filename);
  26.  
  27.     if(mciSendString("close all", NULL, 0, NULL) != 0)
  28.         return(FALSE);
  29.  
  30.     if(mciSendString(buffer, NULL, 0, NULL) != 0)
  31.         return(FALSE);
  32.  
  33.     if(mciSendString("play MUSIC from 0 notify", NULL, 0, m_hWnd) != 0)
  34.         return(FALSE);
  35.  
  36.     return TRUE;
  37. }
  38.  
  39. //////////////////////////////////////////////////////////////////////////////////
  40. // CDS_Music Stop
  41. //////////////////////////////////////////////////////////////////////////////////
  42. CDS_Music::Stop()
  43. {
  44.     if(mciSendString("close all", NULL, 0, NULL) != 0)
  45.         return(FALSE);
  46.  
  47.     return TRUE;
  48. }
  49.  
  50. //////////////////////////////////////////////////////////////////////////////////
  51. // CDS_Music Pause
  52. //////////////////////////////////////////////////////////////////////////////////
  53. BOOL CDS_Music::Pause(void)
  54. {
  55.     if(mciSendString("stop MUSIC", NULL, 0, NULL) != 0)
  56.         return(FALSE);
  57.  
  58.     return TRUE;
  59. }
  60.  
  61. //////////////////////////////////////////////////////////////////////////////////
  62. // CDS_Music Stop
  63. //////////////////////////////////////////////////////////////////////////////////
  64. BOOL CDS_Music::Resume(void)
  65. {
  66.     if(mciSendString("play MUSIC notify", NULL, 0, m_hWnd) != 0)
  67.         return(FALSE);
  68.  
  69.     return TRUE;
  70. }
  71.  
  72. //////////////////////////////////////////////////////////////////////////////////
  73. // CDS_Music Stop
  74. //////////////////////////////////////////////////////////////////////////////////
  75. BOOL CDS_Music::Restart(void)
  76. {
  77.     if(mciSendString("play MUSIC from 0 notify", NULL, 0, m_hWnd) != 0)
  78.         return(FALSE);
  79.  
  80.     return TRUE;
  81. }
  82.