// BlockyFroggy
// Copyright © 2017 John Ryland.
// All rights reserved.
#pragma once
#ifndef MP3_MUSIC_H
#define MP3_MUSIC_H
#include <vector>
#include <cstdint>
#include "MP3/minimp3.h"
#include "ResourceLoader.h"
class Mp3Music
{
public:
void open(const char* filename);
void renderSamples(void* a_outputBuffer, size_t a_frameCount);
private:
mp3_context_t* mp3;
mp3_info_t info;
ByteArray data;
size_t bytesLeft = 0;
size_t frameSize = 0;
const uint8_t* streamPos = nullptr;
signed short sampleBuf[MP3_MAX_SAMPLES_PER_FRAME];
size_t bufOffset = 0;
size_t bufRemaining = 0;
};
#endif // MP3_MUSIC_H