WAVDatei.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #pragma once
  2. #include <GSLDateiV.h>
  3. #include <Datei.h>
  4. using namespace Framework;
  5. struct WAVKopf
  6. {
  7. char riff[4];
  8. unsigned int datGr;
  9. char wav[4];
  10. };
  11. struct WAVFormat
  12. {
  13. char fmt[4];
  14. int fmtLän;
  15. short tag;
  16. unsigned short channels;
  17. unsigned int sampleRate;
  18. unsigned int bytesPerSec;
  19. unsigned short blockAlign;
  20. unsigned short bitsPerSample;
  21. };
  22. struct WAVDBeg
  23. {
  24. char data[4];
  25. int län;
  26. };
  27. class WAVDatei : public GSL::GSLSoundV
  28. {
  29. private:
  30. WAVKopf kpf;
  31. WAVFormat fmt;
  32. WAVDBeg dBeg;
  33. int pos;
  34. Datei d;
  35. public:
  36. // Konstruktor
  37. WAVDatei();
  38. // nicht constant
  39. bool lade(const char* pfad);
  40. // GSL
  41. void playSound() override
  42. {}
  43. void setPause(bool p) override
  44. {}
  45. void stopSound() override
  46. {}
  47. void warteAufSound(int zeit) override
  48. {}
  49. // Lautstärke: 0 - 0xFFFF
  50. void setVolume(unsigned int links, unsigned int rechts) override
  51. {}
  52. // zum Speichern
  53. void open() override;
  54. int getDaten(char* buffer, int län) override;
  55. void close() override;
  56. bool istMono() const override;
  57. int getSampleRate() const override;
  58. __int64 getDatLength() const override;
  59. };