diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2016-03-13 09:49:33 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2016-09-02 21:21:28 +0300 |
commit | cfaa2cd39b7256a868a4f5cd83aac207df6bd1b3 (patch) | |
tree | 75efff26584e046566d17cd308d45b6b0fd5abfc /src/oma.cpp | |
parent | b4df8a7c2dd12eea27c8cc52bd52a1bb8c00943f (diff) | |
download | atracdenc-cfaa2cd39b7256a868a4f5cd83aac207df6bd1b3.tar.gz |
Dirty implementation of atrac3 encoder:
- no JS mode
- constant quantiser for tonal components
- gain controll implemented but produces some artifacts with real signals.
- etc...
Diffstat (limited to 'src/oma.cpp')
-rw-r--r-- | src/oma.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/oma.cpp b/src/oma.cpp new file mode 100644 index 0000000..5fd18b7 --- /dev/null +++ b/src/oma.cpp @@ -0,0 +1,42 @@ +#include "oma.h" +#include <stdlib.h> + +TOma::TOma(const std::string& filename, const std::string& title, int numChannel, uint32_t numFrames, int cid, uint32_t framesize) { + oma_info_t info; + info.codec = cid; + info.samplerate = 44100; + info.channel_format = OMA_STEREO; + info.framesize = framesize; + File = oma_open(filename.c_str(), OMAM_W, &info); + if (!File) + abort(); +} + +TOma::~TOma() { + oma_close(File); +} + +std::unique_ptr<ICompressedIO::TFrame> TOma::ReadFrame() { + abort(); + return nullptr; +} + +void TOma::WriteFrame(std::vector<char> data) { + if (oma_write(File, &data[0], 1) == -1) { + fprintf(stderr, "write error\n"); + abort(); + } +} + +std::string TOma::GetName() const { + abort(); + return {}; +} + +int TOma::GetChannelNum() const { + return 2; //for ATRAC3 +} +long long TOma::GetLengthInSamples() const { + abort(); + return 0; +} |