Reads a 16-bit Little-Endian PCM audio file and sends its bytes up a Pipeline. More...
Public Member Functions | |
File (std::string path) | |
Constructs a default audio file reader. More... | |
File (std::string path, int sampleRate, int channelCount, std::size_t bufferSize) | |
void | setFilePath (std::string path) |
void | setSampleRate (int sampleRate) |
void | setChannelCount (int channelCount) |
void | setBufferSize (std::size_t bufferSize) |
void | setRealTimeStreamingEnabled (bool enabled) |
Enables real time streaming of the file at a rate of sample_rate × channel_count bytes per second. More... | |
void | setAccelerationRate (double rate) |
Sets acceleration rate. Cannot be less than 1.0 . More... | |
Public Member Functions inherited from Vsdk::Audio::ProducerModuleImpl< File > | |
ProducerModuleImpl ()=default | |
Public Member Functions inherited from Vsdk::Audio::ProducerModule | |
ProducerModule () | |
ProducerModule (ProducerModule &&) | |
ProducerModule & | operator= (ProducerModule &&) |
virtual | ~ProducerModule ()=0 |
ProducerModule (ProducerModule const &)=delete | |
ProducerModule & | operator= (ProducerModule const &)=delete |
auto | subscribeFirst (AudioCallback c) -> Iterator |
Subscribes as first in the list of audio buffer receivers for this producer. More... | |
auto | subscribeLast (AudioCallback c) -> Iterator |
Subscribes as last in the list of audio buffer receivers for this producer. More... | |
void | unsubscribe (Iterator it) noexcept |
Unsubscribes from this producer audio buffer dispatch list. More... | |
auto | lastError () const -> std::string |
auto | state () const -> State |
bool | isOpened () const |
bool | isRunning () const |
bool | isStarted () const |
bool | isPaused () const |
bool | isIdle () const |
bool | isClosed () const |
bool | open () noexcept |
Attempts to open the underlying resource(s) of the producer. More... | |
bool | run () noexcept |
bool | start () noexcept |
bool | pause () noexcept |
Attempts to pause a started producer. More... | |
bool | resume () noexcept |
Attempts to resume a paused producer. More... | |
bool | stop () noexcept |
Attempts to stop a started producer. More... | |
bool | close () noexcept |
Protected Member Functions | |
void | openImpl () override |
void | runImpl () override |
void | closeImpl () override |
Protected Member Functions inherited from Vsdk::Audio::ProducerModule | |
virtual void | startImpl () |
virtual void | pauseImpl () |
virtual void | resumeImpl () |
virtual void | stopImpl () |
void | dispatchBuffer (Buffer buffer, bool last) |
template<typename T > | |
void | dispatchAudio (T &&data, int sampleRate, int channelCount, bool isLast) |
Additional Inherited Members | |
Public Types inherited from Vsdk::Audio::ProducerModule | |
enum | State { State::Closed, State::Opened, State::Running, State::Started, State::Paused, State::Idle } |
using | Iterator = details::Iterator< decltype(_subscribers)> |
Iterator pointing to a subscriber of this producer. More... | |
Static Public Member Functions inherited from Vsdk::Audio::ProducerModuleImpl< File > | |
static auto | make (Args &&... args) -> std::shared_ptr< File > |
Protected Attributes inherited from Vsdk::Audio::ProducerModule | |
std::atomic< State > | _state |
Reads a 16-bit Little-Endian PCM audio file and sends its bytes up a Pipeline.
|
explicit |
Constructs a default audio file reader.
Sets:
|
explicit |
bufferSize | 0 means reading the whole file in one go |
void File::setFilePath | ( | std::string | path | ) |
Vsdk::Exception | if producer is opened or if path is not a valid file path |
void File::setSampleRate | ( | int | sampleRate | ) |
Vsdk::Exception | if producer is opened or if sampleRate value is invalid |
void File::setChannelCount | ( | int | channelCount | ) |
Vsdk::Exception | if producer is open ans has not been closed yet or if channelCount value is invalid |
void File::setBufferSize | ( | std::size_t | bufferSize | ) |
bufferSize | Zero means reading the whole file in one buffer (beware) |
Vsdk::Exception | if producer is opened or if channelCount value is invalid |
void File::setRealTimeStreamingEnabled | ( | bool | enabled | ) |
Enables real time streaming of the file at a rate of sample_rate × channel_count
bytes per second.
void File::setAccelerationRate | ( | double | rate | ) |
Sets acceleration rate. Cannot be less than 1.0
.
|
overrideprotectedvirtual |
Reimplemented from Vsdk::Audio::ProducerModule.
|
overrideprotectedvirtual |
Reimplemented from Vsdk::Audio::ProducerModule.
|
overrideprotectedvirtual |
Reimplemented from Vsdk::Audio::ProducerModule.