Sound.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef Sound_H
  2. #define Sound_H
  3. #include "Include/GSLSoundV.h"
  4. #ifdef WIN32
  5. #include <mmsystem.h>
  6. #endif
  7. #include "GSLDatei.h"
  8. #include <Critical.h>
  9. using namespace Framework;
  10. namespace GSL
  11. {
  12. class GSLSound : public GSLSoundV
  13. {
  14. private:
  15. Datei *dat;
  16. SoundKopf kpf;
  17. #ifdef WIN32
  18. int status;
  19. HWAVEOUT hAudioId;
  20. unsigned int uAudioDelay;
  21. unsigned int uAudioCount;
  22. WAVEHDR *aAudioHdr[ 16 ];
  23. char *aAudioPtr[ 16 ];
  24. unsigned int uAudioPlay;
  25. Critical hAudioCs;
  26. HANDLE hAudioEvent;
  27. WAVEOUTCAPS sAudioCaps;
  28. unsigned int uAudioWrite;
  29. unsigned int uAudioStop;
  30. int lAudioDone;
  31. unsigned int uAudioWrOk;
  32. volatile int iAudioThEnd;
  33. unsigned int aAudioSize[ 8 ];
  34. float linksV;
  35. float rechtsV;
  36. #endif
  37. // privat
  38. int audioOpen();
  39. int audioClose();
  40. int audioStop();
  41. int audioSchreiben( unsigned int uCount );
  42. int audioLesen( char *buff, int len );
  43. public:
  44. // Konstruktor
  45. GSLSound( const SoundKopf &skpf );
  46. // Destruktor
  47. virtual ~GSLSound();
  48. // nicht constant
  49. void playSound() override;
  50. void setPause( bool p ) override;
  51. void stopSound() override;
  52. void warteAufSound( int zeit ) override;
  53. void setVolume( unsigned int links, unsigned int rechts ) override;
  54. #ifdef WIN32
  55. void msg( UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 );
  56. #endif
  57. void thread() override;
  58. // zum Speichern
  59. void open() override;
  60. int getDaten( char *buffer, int len ) override;
  61. void close() override;
  62. bool istMono() const override;
  63. int getSampleRate() const override;
  64. __int64 getDatLength() const override;
  65. // constant
  66. #ifdef WIN32
  67. HWAVEOUT getHandle() const;
  68. #endif
  69. };
  70. }
  71. #endif