Sound.h 1.8 KB

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