Fix seeking
This commit is contained in:
parent
299a85bfad
commit
28314c4372
1 changed files with 2 additions and 2 deletions
|
@ -95,6 +95,7 @@ void ZsmBackend::switch_stream(int idx) {
|
|||
for (uint8_t i = 0; i < 16; i++) {
|
||||
psg_writereg(i * 4 + 2, 0);
|
||||
}
|
||||
file->seek(music_data_start, SeekType::SET);
|
||||
this->cpuClocks = 0.0;
|
||||
this->delayTicks = 0.0;
|
||||
this->ticks = 0.0;
|
||||
|
@ -330,6 +331,7 @@ void ZsmBackend::seek_internal(double position, bool loop) {
|
|||
this->position = std::floor(this->position * PSG_FREQ) / PSG_FREQ;
|
||||
position = std::floor(position * PSG_FREQ) / PSG_FREQ;
|
||||
if (this->position > position) {
|
||||
switch_stream(0);
|
||||
file->seek(music_data_start, SeekType::SET);
|
||||
this->cpuClocks = 0.0;
|
||||
this->delayTicks = 0;
|
||||
|
@ -338,8 +340,6 @@ void ZsmBackend::seek_internal(double position, bool loop) {
|
|||
} else if (this->position == position) {
|
||||
audio_buf.clear();
|
||||
return;
|
||||
} else {
|
||||
switch_stream(0);
|
||||
}
|
||||
while (this->position < position) {
|
||||
audio_buf.clear();
|
||||
|
|
Loading…
Reference in a new issue