Skip to content

Phase2a of audio engine rewrite - #905

Open
yara-blue wants to merge 11 commits into
masterfrom
phase2a
Open

Phase2a of audio engine rewrite#905
yara-blue wants to merge 11 commits into
masterfrom
phase2a

Conversation

@yara-blue

Copy link
Copy Markdown
Member

review after #904 (this includes it's changes)

Tracking issue: #901

  • Deduplicates all into_inner etc logic
  • Adds channel conversion to both FixedSource and ConstSource

@yara-blue yara-blue changed the title Phase2a Phase2a of audio engine rewrite Jul 23, 2026

/// Converts between two channel counts, created using
/// [with_channel_count](ConstSource::with_channel_count)
pub struct ChannelConvertor<const SR: u32, const CH_IN: u16, const CH_OUT: u16, S> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As I understand this is intended as 1-to-1 rewrite, just keeping old functionality?
We had discussion a while ago regarding this source, in some cases just dropping channels is not enough, it may require some mixing to work properly. (see e.g. #671 - which I fancy to necromance).

pos: usize,
}

impl<const SR: u32, const CH: u16> SamplesBuffer<SR, CH> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe it was discussed already,, but why not SampleRate?


/// Converts between two channel counts, created using
/// [with_channel_count](ConstSource::with_channel_count)
pub struct ChannelConvertor<const SR: u32, const CH_IN: u16, const CH_OUT: u16, S> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Was this intended as just refactoring (keeping old behavior)?
I just wanted to note that we had discussion a while ago regarding this, and in some cases properly converting number of channels requires some mixing (se e.g. #656 which I fancy to necromance).

Comment thread src/fixed_source.rs
impl<const SR: u32, const CH: u16> std::fmt::Display for ParameterMismatch<SR, CH> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if self.sample_rate.get() == SR && self.channel_count.get() == CH {
unreachable!("ParameterMismatch error can only occur when params mismatch");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

// Well, it is reachable, just not expected, assert, maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants