aboutsummaryrefslogtreecommitdiffstats
path: root/src/oma.cpp
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2016-03-13 09:49:33 +0300
committerDaniil Cherednik <dan.cherednik@gmail.com>2016-09-02 21:21:28 +0300
commitcfaa2cd39b7256a868a4f5cd83aac207df6bd1b3 (patch)
tree75efff26584e046566d17cd308d45b6b0fd5abfc /src/oma.cpp
parentb4df8a7c2dd12eea27c8cc52bd52a1bb8c00943f (diff)
downloadatracdenc-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.cpp42
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;
+}