3 #ifndef SPECTMORPH_WAVE_DATA_HH
4 #define SPECTMORPH_WAVE_DATA_HH
19 enum class OutFormat { WAV, FLAC };
22 std::vector<float> m_samples;
26 std::string m_error_blurb;
28 bool save (std::function<SNDFILE* (SF_INFO *)> open_func, OutFormat out_format);
29 bool load (std::function<SNDFILE* (SF_INFO *)> open_func);
33 WavData (
const std::vector<float>& samples,
int n_channels,
float mix_freq,
int bit_depth);
35 bool load (
const std::vector<unsigned char>& in);
36 bool load (
const std::string& filename);
37 bool load_mono (
const std::string& filename);
39 void load (
const std::vector<float>& samples,
int n_channels,
float mix_freq,
int bit_depth);
41 bool save (
const std::string& filename, OutFormat out_format = OutFormat::WAV);
42 bool save (std::vector<unsigned char>& out, OutFormat out_format = OutFormat::WAV);
45 void prepend (
const std::vector<float>& samples);
47 float mix_freq()
const;
48 int n_channels()
const;
49 size_t n_values()
const;
50 int bit_depth()
const;
51 const std::vector<float>& samples()
const;
52 const char *error_blurb()
const;
54 float operator[] (
size_t pos)
const;
Definition: smwavdata.hh:17