Reads a 16-bit Little-Endian PCM audio file and sends its bytes up a Pipeline.
More...
#include <File.hpp>
|
| File (std::string path) |
| Constructs a default audio file reader.
|
|
| File (std::string path, int sampleRate, int channelCount, std::size_t bufferSize) |
|
bool | open () override |
|
bool | run () override |
|
bool | close () override |
|
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.
|
|
void | setAccelerationRate (double rate) |
| Sets acceleration rate. Cannot be less than 1.0 .
|
|
virtual | ~ProducerModule ()=0 |
|
auto | subscribeFirst (AudioCallback c) -> Iterator |
| Subscribes as first in the list of audio buffer receivers for this producer.
|
|
auto | subscribeLast (AudioCallback c) -> Iterator |
| Subscribes as last in the list of audio buffer receivers for this producer.
|
|
void | unsubscribe (Iterator it) |
| Unsubscribes from this producer audio buffer dispatch list.
|
|
virtual bool | open () |
|
virtual bool | run () |
|
virtual bool | start () |
|
virtual bool | stop () |
|
virtual bool | resume () |
| Non-blocking call.
|
|
virtual bool | close () |
|
auto | lastError () const -> std::string const & |
|
Reads a 16-bit Little-Endian PCM audio file and sends its bytes up a Pipeline.
◆ File() [1/2]
File::File |
( |
std::string |
path | ) |
|
|
explicit |
Constructs a default audio file reader.
Sets:
-
sample rate to 16kHz,
-
channel count to 1
-
buffer size to 2048
-
real time streaming is disabled
◆ File() [2/2]
File::File |
( |
std::string |
path, |
|
|
int |
sampleRate, |
|
|
int |
channelCount, |
|
|
std::size_t |
bufferSize |
|
) |
| |
|
explicit |
- Parameters
-
bufferSize | 0 means reading the whole file in one go |
◆ open()
◆ run()
◆ close()
◆ setFilePath()
void File::setFilePath |
( |
std::string |
path | ) |
|
- Exceptions
-
Vsdk::Exception | if producer is open and has not been closed yet or if path is not a valid file path |
◆ setSampleRate()
void File::setSampleRate |
( |
int |
sampleRate | ) |
|
- Exceptions
-
Vsdk::Exception | if producer is open and has not been closed yet or if sampleRate value is invalid |
◆ setChannelCount()
void File::setChannelCount |
( |
int |
channelCount | ) |
|
- Exceptions
-
Vsdk::Exception | if producer is open ans has not been closed yet or if channelCount value is invalid |
◆ setBufferSize()
void File::setBufferSize |
( |
std::size_t |
bufferSize | ) |
|
- Parameters
-
bufferSize | Zero means reading the whole file in one buffer (beware) |
- Exceptions
-
Vsdk::Exception | if producer is open ans has not been closed yet or if channelCount value is invalid |
◆ setRealTimeStreamingEnabled()
void File::setRealTimeStreamingEnabled |
( |
bool |
enabled | ) |
|
Enables real time streaming of the file at a rate of sample rate × channel count
bytes per second.
- Warning
- Streaming is made synchronously during the call to run()!
◆ setAccelerationRate()
void File::setAccelerationRate |
( |
double |
rate | ) |
|
Sets acceleration rate. Cannot be less than 1.0
.