mirror of
https://gitlab.com/square-game-liberation-front/F.E.I.S.git
synced 2024-11-13 18:50:54 +01:00
fix some weirdness in the Open Music code
This commit is contained in:
parent
6242202519
commit
84c22a8795
@ -153,7 +153,7 @@ bool OpenMusic::onGetData(SoundStream::Chunk& data) {
|
||||
data.samples = m_samples.data();
|
||||
if (lead_in < 0) {
|
||||
std::fill(m_samples.data(), m_samples.data() + to_fill, 0);
|
||||
const auto to_read = std::max<std::int64_t>(to_fill - lead_in, 0);
|
||||
const auto to_read = to_fill + lead_in;
|
||||
if (to_read <= 0) {
|
||||
data.sampleCount = to_fill;
|
||||
} else {
|
||||
@ -176,7 +176,7 @@ void OpenMusic::onSeek(sf::Time timeOffset) {
|
||||
std::scoped_lock lock(m_mutex);
|
||||
if (timeOffset < sf::Time::Zero) {
|
||||
lead_in = timeToSamples(timeOffset);
|
||||
m_file.seek(sf::Time::Zero);
|
||||
m_file.seek(0);
|
||||
} else {
|
||||
m_file.seek(timeOffset);
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ struct Buffers {
|
||||
// Format of the internal sound buffers
|
||||
sf::Int32 m_format = 0;
|
||||
// Number of samples processed since beginning of the stream
|
||||
// May be negative to account for chart offsets
|
||||
std::int64_t m_samplesProcessed = 0;
|
||||
// If buffer is an "end buffer", holds next seek position, else NoLoop. For play offset calculation.
|
||||
std::array<sf::Int64, BufferCount> m_bufferSeeks = {0, 0, 0};
|
||||
|
Loading…
Reference in New Issue
Block a user