mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-03 09:49:31 +02:00
First round of refactoring
- DRY-ups - Remove incorrect optimization attempt in the libvorbis decoder, that skewed 0.0 samples non-linear - PortAudio and SDL backends do not support S24 output. The PortAudio bindings could, but not through this API.
This commit is contained in:
parent
b94879de62
commit
a1326ba9f4
6 changed files with 25 additions and 51 deletions
|
@ -18,10 +18,6 @@ pub enum PortAudioSink<'a> {
|
|||
Option<portaudio_rs::stream::Stream<'a, i32, i32>>,
|
||||
StreamParameters<i32>,
|
||||
),
|
||||
S24(
|
||||
Option<portaudio_rs::stream::Stream<'a, i32, i32>>,
|
||||
StreamParameters<i32>,
|
||||
),
|
||||
S16(
|
||||
Option<portaudio_rs::stream::Stream<'a, i16, i16>>,
|
||||
StreamParameters<i16>,
|
||||
|
@ -91,11 +87,10 @@ impl<'a> Open for PortAudioSink<'a> {
|
|||
match format {
|
||||
AudioFormat::F32 => open_sink!(Self::F32, f32),
|
||||
AudioFormat::S32 => open_sink!(Self::S32, i32),
|
||||
AudioFormat::S24 => open_sink!(Self::S24, i32),
|
||||
AudioFormat::S24_3 => {
|
||||
unimplemented!("PortAudio currently does not support S24_3 output")
|
||||
}
|
||||
AudioFormat::S16 => open_sink!(Self::S16, i16),
|
||||
_ => {
|
||||
unimplemented!("PortAudio currently does not support {:?} output", format)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +118,6 @@ impl<'a> Sink for PortAudioSink<'a> {
|
|||
match self {
|
||||
Self::F32(stream, parameters) => start_sink!(stream, parameters),
|
||||
Self::S32(stream, parameters) => start_sink!(stream, parameters),
|
||||
Self::S24(stream, parameters) => start_sink!(stream, parameters),
|
||||
Self::S16(stream, parameters) => start_sink!(stream, parameters),
|
||||
};
|
||||
|
||||
|
@ -140,7 +134,6 @@ impl<'a> Sink for PortAudioSink<'a> {
|
|||
match self {
|
||||
Self::F32(stream, _parameters) => stop_sink!(stream),
|
||||
Self::S32(stream, _parameters) => stop_sink!(stream),
|
||||
Self::S24(stream, _parameters) => stop_sink!(stream),
|
||||
Self::S16(stream, _parameters) => stop_sink!(stream),
|
||||
};
|
||||
|
||||
|
@ -162,10 +155,6 @@ impl<'a> Sink for PortAudioSink<'a> {
|
|||
let samples_s32: Vec<i32> = AudioPacket::f32_to_s32(packet.samples());
|
||||
write_sink!(stream, &samples_s32)
|
||||
}
|
||||
Self::S24(stream, _parameters) => {
|
||||
let samples_s24: Vec<i32> = AudioPacket::f32_to_s24(packet.samples());
|
||||
write_sink!(stream, &samples_s24)
|
||||
}
|
||||
Self::S16(stream, _parameters) => {
|
||||
let samples_s16: Vec<i16> = AudioPacket::f32_to_s16(packet.samples());
|
||||
write_sink!(stream, &samples_s16)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue