Fix SDL deprecations

This commit is contained in:
Roderick van Domburg 2022-04-07 23:20:49 +02:00
parent 0c05aa2eff
commit a7a260be16
No known key found for this signature in database
GPG key ID: A9EF5222A26F0451

View file

@ -95,24 +95,24 @@ impl Sink for SdlSink {
let samples = packet
.samples()
.map_err(|e| SinkError::OnWrite(e.to_string()))?;
match self {
let result = match self {
Self::F32(queue) => {
let samples_f32: &[f32] = &converter.f64_to_f32(samples);
drain_sink!(queue, AudioFormat::F32.size());
queue.queue(samples_f32)
queue.queue_audio(samples_f32)
}
Self::S32(queue) => {
let samples_s32: &[i32] = &converter.f64_to_s32(samples);
drain_sink!(queue, AudioFormat::S32.size());
queue.queue(samples_s32)
queue.queue_audio(samples_s32)
}
Self::S16(queue) => {
let samples_s16: &[i16] = &converter.f64_to_s16(samples);
drain_sink!(queue, AudioFormat::S16.size());
queue.queue(samples_s16)
queue.queue_audio(samples_s16)
}
};
Ok(())
result.map_err(SinkError::OnWrite)
}
}