File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -1800,9 +1800,19 @@ void MixerChannel::FillUp()
1800
1800
if (!is_enabled || frames_done < mixer.frames_done )
1801
1801
return ;
1802
1802
const auto index = PIC_TickIndex ();
1803
- MIXER_LockAudioDevice ();
1804
- Mix (check_cast<uint16_t >(static_cast <int64_t >(index * mixer.frames_needed )));
1805
- MIXER_UnlockAudioDevice ();
1803
+
1804
+ auto frames_remaining = static_cast <int >(index * mixer.frames_needed );
1805
+ while (frames_remaining > 0 ) {
1806
+ const auto frames_to_mix = std::clamp (
1807
+ frames_remaining, 0 , static_cast <int >(MixerBufferLength));
1808
+
1809
+ MIXER_LockAudioDevice ();
1810
+ Mix (check_cast<work_index_t >(frames_to_mix));
1811
+ MIXER_UnlockAudioDevice ();
1812
+ // Let SDL fetch frames after each chunk
1813
+
1814
+ frames_remaining = -frames_to_mix;
1815
+ }
1806
1816
}
1807
1817
1808
1818
std::string MixerChannel::DescribeLineout () const
You can’t perform that action at this time.
0 commit comments