Fix issues related to sample-based time codes
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
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
This commit is contained in:
parent
0b2b6bc459
commit
80f29047bd
2 changed files with 8 additions and 1 deletions
|
@ -7,6 +7,7 @@ class SDLMixerXBackend : public PlaybackBackend {
|
||||||
Mix_CommonMixer_t mixer;
|
Mix_CommonMixer_t mixer;
|
||||||
File *file;
|
File *file;
|
||||||
bool initial = false;
|
bool initial = false;
|
||||||
|
double length;
|
||||||
public:
|
public:
|
||||||
inline std::string get_id() override {
|
inline std::string get_id() override {
|
||||||
return "sdl_mixer_x";
|
return "sdl_mixer_x";
|
||||||
|
@ -15,6 +16,12 @@ class SDLMixerXBackend : public PlaybackBackend {
|
||||||
return "SDL Mixer X";
|
return "SDL Mixer X";
|
||||||
}
|
}
|
||||||
std::optional<uint64_t> get_max_samples() override;
|
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;
|
void seek(double position) override;
|
||||||
inline void seek_samples(uint64_t position) override {
|
inline void seek_samples(uint64_t position) override {
|
||||||
seek(samples_to_time(position));
|
seek(samples_to_time(position));
|
||||||
|
|
|
@ -72,7 +72,7 @@ class PlaybackBackend {
|
||||||
inline virtual void seek(double position) { seek_samples(time_to_samples(position)); }
|
inline virtual void seek(double position) { seek_samples(time_to_samples(position)); }
|
||||||
inline virtual void seek_samples(uint64_t position) { }
|
inline virtual void seek_samples(uint64_t position) { }
|
||||||
inline virtual double get_position_time() {
|
inline virtual double get_position_time() {
|
||||||
return ((double)position) / ((double)spec.freq);
|
return ((double)get_position_samples()) / ((double)spec.freq);
|
||||||
}
|
}
|
||||||
inline virtual uint64_t get_position_samples() {
|
inline virtual uint64_t get_position_samples() {
|
||||||
return position;
|
return position;
|
||||||
|
|
Loading…
Reference in a new issue