mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
srb2::audio::Gme::seek: use gme_seek instead of gme_seek_samples
Fixes seeking only halfway. gme_seek_samples counts samples for BOTH channels.
This commit is contained in:
parent
f93e925a4a
commit
68293dfeb3
3 changed files with 4 additions and 4 deletions
|
|
@ -65,11 +65,11 @@ std::size_t Gme::get_samples(tcb::span<short> buffer)
|
||||||
return buffer.size();
|
return buffer.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gme::seek(int sample)
|
void Gme::seek(int position_ms)
|
||||||
{
|
{
|
||||||
SRB2_ASSERT(instance_ != nullptr);
|
SRB2_ASSERT(instance_ != nullptr);
|
||||||
|
|
||||||
gme_seek_samples(instance_, sample);
|
gme_seek(instance_, position_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
float Gme::duration_seconds() const
|
float Gme::duration_seconds() const
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public:
|
||||||
explicit Gme(tcb::span<std::byte> data);
|
explicit Gme(tcb::span<std::byte> data);
|
||||||
|
|
||||||
std::size_t get_samples(tcb::span<short> buffer);
|
std::size_t get_samples(tcb::span<short> buffer);
|
||||||
void seek(int sample);
|
void seek(int position_ms);
|
||||||
|
|
||||||
float duration_seconds() const;
|
float duration_seconds() const;
|
||||||
std::optional<float> loop_point_seconds() const;
|
std::optional<float> loop_point_seconds() const;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ std::size_t GmePlayer<C>::generate(tcb::span<Sample<C>> buffer)
|
||||||
template <size_t C>
|
template <size_t C>
|
||||||
void GmePlayer<C>::seek(float position_seconds)
|
void GmePlayer<C>::seek(float position_seconds)
|
||||||
{
|
{
|
||||||
gme_.seek(static_cast<std::size_t>(position_seconds * 44100.f));
|
gme_.seek(static_cast<std::size_t>(position_seconds * 1000.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t C>
|
template <size_t C>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue