1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-09-30 17:52:23 +02:00
doorlockd-mirror/doorlockd/client/wave.h
Ralf Ramsauer 365bdb755c Added new Class for playing WAVE files from memory
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2015-10-11 19:06:05 +02:00

36 lines
532 B
C++

#ifndef WAVE_H
#define WAVE_H
#include <string>
#include <vector>
#include <memory>
#include <ao/ao.h>
class Wave {
public:
using Raw = std::vector<char>;
static Wave fromFile(const std::string &filename);
Wave(int bits,
int channels,
int rate,
Raw data);
Wave(const Wave &rhs);
~Wave();
Wave &operator=(const Wave &rhs);
void play() const;
private:
std::unique_ptr<ao_sample_format> _format;
ao_device* _device = { nullptr };
const Raw _data;
};
#endif