OggVorbisSoundStream.h 943 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include "../Audio/SoundStream.h"
  5. #include "../Container/ArrayPtr.h"
  6. namespace Urho3D
  7. {
  8. class Sound;
  9. /// Ogg Vorbis sound stream.
  10. class URHO3D_API OggVorbisSoundStream : public SoundStream
  11. {
  12. public:
  13. /// Construct from an Ogg Vorbis compressed sound.
  14. explicit OggVorbisSoundStream(const Sound* sound);
  15. /// Destruct.
  16. ~OggVorbisSoundStream() override;
  17. /// Seek to sample number. Return true on success.
  18. bool Seek(unsigned sample_number) override;
  19. /// Produce sound data into destination. Return number of bytes produced. Called by SoundSource from the mixing thread.
  20. unsigned GetData(signed char* dest, unsigned numBytes) override;
  21. protected:
  22. /// Decoder state.
  23. void* decoder_;
  24. /// Compressed sound data.
  25. SharedArrayPtr<signed char> data_;
  26. /// Compressed sound data size in bytes.
  27. unsigned dataSize_;
  28. };
  29. }