-
Notifications
You must be signed in to change notification settings - Fork 465
add native dsd support #1078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
add native dsd support #1078
Conversation
roderickvd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice add. I know it's still a draft, but I took the opportunity to a quick review anyway. Also don't forget to add a changelog entry - worth it 😄
src/samples_formats.rs
Outdated
| // Conflict with blanket impl in dasp_sample | ||
| // impl FromSample<DsdU8> for DsdU8 { ... } | ||
|
|
||
| impl FromSample<f32> for DsdU8 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah these are a bit of a pickle. Fully understood that cpal doesn't do PCM-to-DSD conversion, but should we then always return silence or an unimplemented()? What would it take to skip the implementations at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed structs and from impl, and it seems to work without it :)
src/host/alsa/mod.rs
Outdated
| 2 * period | ||
| // For playback, we want to start only when the buffer is full for DSD content | ||
| // to avoid underruns. For PCM, we keep the default low-latency behavior. | ||
| let is_dsd = matches!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may warrant a separate fn is_dsd() helper function along the lines of is_int. That latter function may have to be updated to handle DSD types too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this change as unnecessary. I was playing with pop and noise on dsd stream start/stop...
src/host/alsa/mod.rs
Outdated
| // period queued in the software buffer. This ensures consistent low latency | ||
| // regardless of the total buffer size. | ||
| 2 * period | ||
| // For playback, we want to start only when the buffer is full for DSD content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that? Is that always the case for DSD playback, or should DSD playback have its default buffer size overridden? For DSD we should also aim for low latency - without under-runs, of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
src/samples_formats.rs
Outdated
| SampleFormat::U64 => u64::BITS, | ||
| SampleFormat::F32 => 32, | ||
| SampleFormat::F64 => 64, | ||
| SampleFormat::DsdU8 => 8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or "1" (for 1-bit modulation)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, changed to 1
| SampleFormat::U64 => fill_typed!(u64), | ||
| SampleFormat::F32 => fill_typed!(f32), | ||
| SampleFormat::F64 => fill_typed!(f64), | ||
| SampleFormat::DsdU8 => fill_typed!(u8), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be fill_typed!(DsdU8)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now when I removed structs I am not sure what to use here. any suggestion?
Thank you for you review! I am not alsa expert but I've tested it in my rsplayer repo. |
No description provided.