Sound.h 1.8 KB

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