Skip to content

Conversation

@ljufa
Copy link

@ljufa ljufa commented Dec 17, 2025

No description provided.

Copy link
Member

@roderickvd roderickvd left a 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 😄

// Conflict with blanket impl in dasp_sample
// impl FromSample<DsdU8> for DsdU8 { ... }

impl FromSample<f32> for DsdU8 {
Copy link
Member

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?

Copy link
Author

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 :)

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!(
Copy link
Member

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.

Copy link
Author

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...

// 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
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

SampleFormat::U64 => u64::BITS,
SampleFormat::F32 => 32,
SampleFormat::F64 => 64,
SampleFormat::DsdU8 => 8,
Copy link
Member

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)?

Copy link
Author

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),
Copy link
Member

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)

Copy link
Author

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?

@ljufa
Copy link
Author

ljufa commented Dec 20, 2025

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 😄

Thank you for you review! I am not alsa expert but I've tested it in my rsplayer repo.
I hope that change is not too specific for my use case and it will be generaly useful.

@ljufa ljufa marked this pull request as ready for review December 20, 2025 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants