Files
fegger 20c0f9744f Refactor metadata and internal data structures
Replace Metadata.h with Containers.h, introducing a HashTable
implementation with SIMD acceleration and specialized track tracking.
Cleanup PlayerEngine logic by merging it into the playback flow and
refactoring several internal API signatures.
2026-06-20 22:04:26 +02:00

45 lines
962 B
C++

#pragma once
#include "miniaudio.h"
#include <atomic>
#include <memory>
struct PlaybackState {
ma_decoder decoder {};
std::atomic<bool> finished { false };
};
class PlaybackEngine {
public:
PlaybackEngine ();
~PlaybackEngine ();
static void data_callback ( ma_device *pDevice, void *pOutput, const void *, ma_uint32 frameCount );
void configureDevice ();
void configureDecoder ();
void initDevice ();
void initDecoder ( const char *filePath );
void uninitDecoder();
void startPlayback ();
void stopPlayback ();
void pausePlayback () { stopPlayback(); };
void seek ( ma_uint64 frame );
int isFinished () const;
uint64_t getPosition ();
private:
ma_device device_;
ma_format format_;
unsigned int channels_;
unsigned int sampleRate_;
PlaybackState state;
ma_uint64 cursor_;
// config
ma_decoder_config decoderConfig;
ma_device_config deviceConfig;
};