1 #ifndef RAPP_OBJECT_AUDIO
2 #define RAPP_OBJECT_AUDIO
17 audio(
const std::string filepath)
19 std::ifstream bytestream(filepath,
23 if (!bytestream.is_open()) {
24 throw std::runtime_error(
"could not open bytestream for "+filepath);
33 audio(std::ifstream & bytestream)
56 return typeid(*this) ==
typeid(rhs) &&
64 bool save(
const std::string filepath)
66 std::ofstream os(filepath, std::ios::out | std::ofstream::binary);
70 std::ostreambuf_iterator<rapp::types::byte>(os));
92 bytestream.seekg(0, std::ios_base::end);
93 std::streampos fileSize = bytestream.tellg();
95 bytestream.seekg(0, std::ios_base::beg);
107 ogg(
const std::string filepath)
110 ogg(std::ifstream & bytestream)
111 :
audio(bytestream){}
128 :
audio (bytestream){}
131 {
return "nao_wav_1_ch"; }
145 :
audio (bytestream){}
148 {
return "nao_wav_4_ch";}
162 :
audio (bytestream){}
OGG Class specialisation.
std::string extension() const
std::string extension() const
void read_bytes(std::ifstream &bytestream)
virtual std::string audio_source() const
std::string audio_source() const
bool operator==(const audio &rhs) const
Are audios same ?
ogg(std::ifstream &bytestream)
virtual std::string extension() const
WAV Single channel 16Khz > Headset audio source.
nao_quad_channel_wav(std::ifstream &bytestream)
ogg(const std::string filepath)
microphone_wav(std::ifstream &bytestream)
nao_single_channel_wav(std::ifstream &bytestream)
microphone_wav(std::vector< rapp::types::byte > bytearray)
microphone_wav(const std::string filepath)
class which wraps around raw bytes of an audiofile
audio(std::ifstream &bytestream)
Construct using an open file stream.
std::vector< rapp::types::byte > bytearray() const
Get audio as array of bytes.
std::string extension() const
std::string audio_source() const
std::string audio_source() const
WAV Class specialisation for quad channel.
audio(std::vector< rapp::types::byte > bytearray)
construct using an existing byte-array
bool save(const std::string filepath)
Save audio to filepath.
audio(const std::string filepath)
Construct from a file on disk.
audio & operator=(const audio &)=default
Assignment operator.
WAV Class specialisation for a single channel.
nao_single_channel_wav(const std::string filepath)
std::string extension() const
nao_quad_channel_wav(const std::string filepath)
std::vector< rapp::types::byte > bytearray_
std::string audio_source() const