Skip to content
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

Feature channelrouter (sparse matrix, other version of #656) #671

Open
wants to merge 43 commits into
base: master
Choose a base branch
from

Conversation

PetrGlad
Copy link
Collaborator

@PetrGlad PetrGlad commented Jan 7, 2025

The branch is based on #656.

Not necessarily for merge but I could not help implementing it, wanted to see how this would look actually. I admit that 'next` looks more verbose, but to me it seems it should be the fastest (especially when most of the coefficients are zero). This can be made even tighter by supporting only smaller number of channels (max of 256 could save 2 bytes on each matrix entry). When channel count changes, this should still keep working, but I'd expect users may want to handle that (or maybe even have several presets for each expected channel count). Also maybe duplicate entries should be rejected - this works just fine but maybe surprising.

There is another idea to consider: the whole matrix is set every time, letting users to modify it any way they see fit. This avoid the problem of keeping track which coefficients are non null or not.

@PetrGlad PetrGlad marked this pull request as draft January 10, 2025 20:50
@PetrGlad PetrGlad changed the title [not for merge] Feature channelrouter (sparse matrix) Feature channelrouter (sparse matrix) Jan 10, 2025
@PetrGlad PetrGlad changed the title Feature channelrouter (sparse matrix) [prototype] Feature channelrouter (sparse matrix) Jan 10, 2025
@PetrGlad PetrGlad changed the title [prototype] Feature channelrouter (sparse matrix) Feature channelrouter (sparse matrix) Jan 15, 2025
@PetrGlad PetrGlad changed the title Feature channelrouter (sparse matrix) [discussion] Feature channelrouter (sparse matrix) Jan 15, 2025
@PetrGlad PetrGlad changed the title [discussion] Feature channelrouter (sparse matrix) Feature channelrouter (sparse matrix, other version of #656) Jan 15, 2025
@PetrGlad
Copy link
Collaborator Author

PetrGlad commented Feb 2, 2025

@iluvcapra @dvdsk Can you have a look at this PR? What would you not like in this version?

I think the code is ready. Both versions (this and #656) are functional but one may be better than another depending on context. So I would even consider to have both of them. I stated my preference, though :)

@dvdsk
Copy link
Collaborator

dvdsk commented Feb 2, 2025

I'll have a look 👍 Would you mind postponing the merge of this till #694 lands? Since that is already going to be a monster PR, keeping this off for a while makes #694 easier to write.

Copy link
Collaborator

@dvdsk dvdsk left a comment

Choose a reason for hiding this comment

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

refactorings + readability stuff

I love that the tests are there they seem to only use the public API so they should work as integration tests.

I wonder about the controller/source split however I think that should be hammered out in #658. Until then we should use rodio's default mechanism (the periodic callback) like in the AGC example

let controlled = agc_source.periodic_access(Duration::from_millis(5), move |agc_source| {

We can keep the controller and put that under an experimental flag like with AGC?

src/source/channel_router.rs Outdated Show resolved Hide resolved
src/source/channel_router.rs Outdated Show resolved Hide resolved
src/source/channel_router.rs Outdated Show resolved Hide resolved
src/source/channel_router.rs Outdated Show resolved Hide resolved
src/source/channel_router.rs Outdated Show resolved Hide resolved
src/source/channel_router.rs Outdated Show resolved Hide resolved
@PetrGlad
Copy link
Collaborator Author

PetrGlad commented Feb 2, 2025

@dvdsk This PR is based on #656 to show alternative implementation. So tests are kept from that PR. Generally I tried to keep the API (except for the mixer itself) and tests from that PR intact.

This is not urgent, I just wanted to get some feedback, primarily whether there are any objections against this version compared to one in #656.

@PetrGlad PetrGlad marked this pull request as ready for review February 2, 2025 14:25
@dvdsk
Copy link
Collaborator

dvdsk commented Feb 3, 2025

I have no objections to this version. I think we can keep improving on it but we need benchmarks for that. API-wise there is still a lot to be done. But that would require first hammering out #658.

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.

3 participants