home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / SOUND.ZIP / SoundOut.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-11-21  |  2.4 KB  |  89 lines

  1. // SoundOut.h: interface for the CSound class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. /*
  5.    
  6.         This program is Copyright  Developped by Yannick Sustrac
  7.                    yannstrc@mail.dotcom.fr
  8.                 http://www.mygale.org/~yannstrc/
  9.  
  10.  
  11. This program is free software; you can redistribute it and/or modify it under the terms
  12. of the GNU General Public License as published by the Free Software Foundation; either
  13. version 2 of the License, or (at your option) any later version.
  14.  
  15. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  16. without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. See the GNU General Public License for more details.
  18.  
  19. You should have received a copy of the GNU General Public License along with this program;
  20. if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22. */
  23. //////////////////////////////////////////////////////////////////////////////////////////    
  24.  
  25. #if !defined(AFX_SOUNDOUT_H__69C928C4_1F19_11D2_8045_30460BC10000__INCLUDED_)
  26. #define AFX_SOUNDOUT_H__69C928C4_1F19_11D2_8045_30460BC10000__INCLUDED_
  27.  
  28. #if _MSC_VER >= 1000
  29. #pragma once
  30. #endif // _MSC_VER >= 1000
  31.  
  32. #include <mmsystem.h>
  33.  
  34. #define MAX_OUTPUT_SAMPLES 100000   
  35. #define MAX_VOIE 2
  36. #define MAX_SIZE_SAMPLES  1  // WORD
  37. #define MAX_SIZE_OUTPUT_BUFFER   MAX_OUTPUT_SAMPLES*MAX_VOIE*MAX_SIZE_SAMPLES 
  38.  
  39.  
  40. class CSoundOut  
  41. {
  42. public:
  43.  
  44.     SHORT  OutputBuffer[MAX_SIZE_OUTPUT_BUFFER];
  45.  
  46.     WAVEOUTCAPS        m_WaveOutDevCaps;
  47.     HWAVEOUT        m_WaveOut;
  48.     WAVEHDR            m_WaveHeader;
  49.     WAVEFORMATEX    m_WaveFormat;
  50.     
  51.  
  52.  
  53.     HANDLE m_WaveOutEvent;
  54.     CWinThread * m_WaveOutThread;
  55.     BOOL m_TerminateThread;
  56.  
  57.     UINT m_WaveOutSampleRate;
  58.     int  m_NbMaxSamples;
  59.     UINT m_SizeRecord;
  60.  
  61.  
  62. //////////////////////////////////////////////////////
  63. // functions members
  64.  
  65. public :    
  66.     void StartOutput();
  67.     void StopOutput();
  68.     void CloseOutput();
  69.     void AddBuffer();
  70.  
  71. public :
  72.     virtual void RazBuffers();
  73.     virtual void ComputeSamples(SHORT *);  
  74.     
  75.  
  76.     MMRESULT OpenOutput();
  77.     void WaveInitFormat(    WORD    nCh,         // number of channels (mono, stereo)
  78.                             DWORD   nSampleRate, // sample rate
  79.                             WORD    BitsPerSample);
  80.     
  81.     CSoundOut();
  82.     virtual ~CSoundOut();
  83.  
  84. };
  85.  
  86. // Unique global Thread procedure  for the sound Output
  87.     UINT WaveOutThreadProc( LPVOID pParam);
  88.  
  89. #endif