|
|
|
|
@ -36,6 +36,7 @@ public:
|
|
|
|
|
stream_->setFinishCallback(std::forward<Aulib::Stream::Callback>(callback)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifndef STREAM_ALL_AUDIO |
|
|
|
|
/**
|
|
|
|
|
* @brief Sets the sample's WAV, FLAC, or Ogg/Vorbis data. |
|
|
|
|
* @param fileData Buffer containing the data |
|
|
|
|
@ -43,25 +44,34 @@ public:
|
|
|
|
|
* @return 0 on success, -1 otherwise |
|
|
|
|
*/ |
|
|
|
|
int SetChunk(ArraySharedPtr<std::uint8_t> file_data, std::size_t dwBytes); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifndef STREAM_ALL_AUDIO |
|
|
|
|
[[nodiscard]] bool IsStreaming() const |
|
|
|
|
{ |
|
|
|
|
return file_data_ == nullptr; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
int DuplicateFrom(const SoundSample &other) |
|
|
|
|
{ |
|
|
|
|
#ifdef STREAM_ALL_AUDIO |
|
|
|
|
return SetChunkStream(other.file_path_); |
|
|
|
|
#else |
|
|
|
|
if (other.IsStreaming()) |
|
|
|
|
return SetChunkStream(other.file_path_); |
|
|
|
|
return SetChunk(other.file_data_, other.file_data_size_); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int GetLength() const; |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
#ifndef STREAM_ALL_AUDIO |
|
|
|
|
// Non-streaming audio fields:
|
|
|
|
|
ArraySharedPtr<std::uint8_t> file_data_; |
|
|
|
|
std::size_t file_data_size_; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Set for streaming audio to allow for duplicating it:
|
|
|
|
|
std::string file_path_; |
|
|
|
|
|