looper/backends/playback/sdl_mixer_x/sdl_mixer_x.hpp
Zachary Hall 80f29047bd
Some checks failed
Build / build-gentoo (push) Successful in 2m19s
Build / download-system-deps (push) Successful in 6m53s
Build / get-source-code (push) Successful in 14m32s
Build / build-deb (push) Failing after 5m36s
Build / build-appimage (push) Successful in 4m42s
Build / build-android (push) Failing after 3m5s
Build / build-windows (push) Failing after 7m18s
Fix issues related to sample-based time codes
2025-01-14 15:33:49 -08:00

40 lines
1.2 KiB
C++

#pragma once
#include "playback_backend.hpp"
#include <SDL_mixer.h>
#include "file_backend.hpp"
class SDLMixerXBackend : public PlaybackBackend {
Mix_Music *music;
Mix_CommonMixer_t mixer;
File *file;
bool initial = false;
double length;
public:
inline std::string get_id() override {
return "sdl_mixer_x";
}
inline std::string get_name() override {
return "SDL Mixer X";
}
std::optional<uint64_t> get_max_samples() override;
inline double get_length() override {
return length;
}
inline uint64_t get_length_samples() override {
return time_to_samples(get_length());
}
void seek(double position) override;
inline void seek_samples(uint64_t position) override {
seek(samples_to_time(position));
}
double get_position_time() override;
inline uint64_t get_position_samples() override {
return time_to_samples(get_position_time());
}
void load(const char *filename) override;
void switch_stream(int idx) override;
void cleanup() override;
size_t render(void *buf, size_t maxlen) override;
void add_licenses() override;
SDLMixerXBackend();
~SDLMixerXBackend() override;
};