Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.6KB

  1. /*************************************************************************************
  2. * Original code copyright (C) 2012 Steve Folta
  3. * Converted to Juce module (C) 2016 Leo Olivers
  4. * Forked from https://github.com/stevefolta/SFZero
  5. * For license info please see the LICENSE file distributed with this source code
  6. *************************************************************************************/
  7. #ifndef SFZSAMPLE_H_INCLUDED
  8. #define SFZSAMPLE_H_INCLUDED
  9. #include "SFZCommon.h"
  10. #include "water/buffers/AudioSampleBuffer.h"
  11. #include "water/files/File.h"
  12. #include "CarlaScopeUtils.hpp"
  13. namespace sfzero
  14. {
  15. class Sample
  16. {
  17. public:
  18. explicit Sample(const water::File &fileIn) : file_(fileIn), buffer_(nullptr), sampleRate_(0), sampleLength_(0), loopStart_(0), loopEnd_(0) {}
  19. virtual ~Sample();
  20. bool load();
  21. water::File getFile() { return (file_); }
  22. water::AudioSampleBuffer *getBuffer() { return (buffer_); }
  23. double getSampleRate() { return (sampleRate_); }
  24. water::String getShortName();
  25. void setBuffer(water::AudioSampleBuffer *newBuffer);
  26. water::AudioSampleBuffer *detachBuffer();
  27. water::String dump();
  28. water::uint64 getSampleLength() const { return sampleLength_; }
  29. water::uint64 getLoopStart() const { return loopStart_; }
  30. water::uint64 getLoopEnd() const { return loopEnd_; }
  31. #ifdef DEBUG
  32. void checkIfZeroed(const char *where);
  33. #endif
  34. private:
  35. water::File file_;
  36. CarlaScopedPointer<water::AudioSampleBuffer> buffer_;
  37. double sampleRate_;
  38. water::uint64 sampleLength_, loopStart_, loopEnd_;
  39. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Sample)
  40. };
  41. }
  42. #endif // SFZSAMPLE_H_INCLUDED