Sound.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. int ref;
  38. // privat
  39. int audioOpen();
  40. int audioClose();
  41. int audioStop();
  42. int audioSchreiben( unsigned int uCount );
  43. int audioLesen( char *buff, int len );
  44. public:
  45. // Konstruktor
  46. GSLSound( const SoundKopf &skpf );
  47. // Destruktor
  48. ~GSLSound();
  49. // nicht constant
  50. void playSound() override;
  51. void setPause( bool p ) override;
  52. void stopSound() override;
  53. void warteAufSound( int zeit ) override;
  54. void setVolume( unsigned int links, unsigned int rechts ) override;
  55. #ifdef WIN32
  56. void msg( UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 );
  57. #endif
  58. void thread() override;
  59. // zum Speichern
  60. void open() override;
  61. int getDaten( char *buffer, int len ) override;
  62. void close() override;
  63. bool istMono() const override;
  64. int getSampleRate() const override;
  65. __int64 getDatLength() const override;
  66. // constant
  67. #ifdef WIN32
  68. HWAVEOUT getHandle() const;
  69. #endif
  70. // Reference Counting
  71. GSLSoundV *getThis() override;
  72. GSLSoundV *release() override;
  73. };
  74. }
  75. #endif