aboutsummaryrefslogtreecommitdiffstats
path: root/src/oma.cpp
blob: 5fd18b70576a32a603bfc47bc679b061116236c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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;
}