audio.hpp
1 #ifndef NOOS_OBJECT_AUDIO
2 #define NOOS_OBJECT_AUDIO
3 #include "includes.ihh"
4 #include <noos/objects/globals.hpp>
5 /*
6  * LICENSE HERE
7  */
8 namespace noos {
10 namespace object {
18 class audio
19 {
20 public:
22  audio(const std::string filepath);
23 
26  audio(std::ifstream & bytestream);
27 
30  audio(std::vector<noos::types::byte> bytearray);
31 
33  audio(const audio &) = default;
34 
36  std::vector<noos::types::byte> bytearray() const;
37 
39  bool operator==(const audio & rhs) const;
40 
42  bool operator!=(const audio & rhs) const;
43 
45  audio & operator=(const audio &) = default;
46 
48  bool save(const std::string filepath);
49 
50 private:
51  // Delete empty constructor
52  audio() = delete;
53  // Copy the bytestream into the bytearray
54  void read_bytes(std::ifstream & bytestream);
55  // Actual bytes of audio file
56  std::vector<noos::types::byte> bytearray_;
57 };
58 
59 }
60 }
61 #endif
std::vector< noos::types::byte > bytearray() const
Get audio as array of bytes.
bool operator==(const audio &rhs) const
Equality operator.
Definition: asio_handler.hpp:14
class which wraps around raw bytes of an audiofile
Definition: audio.hpp:18
bool operator!=(const audio &rhs) const
Inequality operator.
audio & operator=(const audio &)=default
Assignment operator.
bool save(const std::string filepath)
Save audio to filepath.