Program Listing for File Decoder.hpp

Return to documentation for file (include/audioRender/MixMachine/MiniaudioObjects/Decoder.hpp)

#pragma once

#include <string>
#include <optional>
#include <vector>

#include <miniaudio.h>
#include <filesystem>
#include "FrameCalc.hpp"
#include "fileNameSanitizer.hpp"
#include "dbRoot.hpp"

namespace fs = std::filesystem;
// using MAYBE_FRAME = std::optional<std::vector<float>>;

using FRAME_POS = unsigned long long;
struct PDJE_API Decoder{
    ma_decoder dec;
    std::vector<uint8_t> musicBinary;
    Decoder();
    ~Decoder();
    bool init(litedb& db, const SANITIZED_ORNOT& KeyOrPath);
    bool changePos(FRAME_POS Pos);

    bool getPos(FRAME_POS& pos);

    bool getRange(FRAME_POS numFrames, std::vector<float>& buffer);

};