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

replace current_span_length in favor of parameters_changed #706

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

dvdsk
Copy link
Collaborator

@dvdsk dvdsk commented Feb 24, 2025

implements #694

currently draft, due to high number of non trivial changes this PR also aims to dramatically extend the test suite of rodio. Hopefully that will catch most bugs.

@roderickvd I could use some help fixing the decoders, they now just have todo!() as parameters_changed implementation. Let me know if you want to work on that. The branch is under the rodio repo so you can just pull it down and push your work to it.

status (ill edit this along the way)

  • trivial sources implemented (empty, sine etc)
  • normal sources implemented (skip etc)
  • extra tests for normal sources
  • complex sources implemented (queue and friends)
  • extra tests for complex sources
  • decoder sources implemented
  • extra tests for decoder sources (unsure if needed?)

@dvdsk dvdsk changed the title Parameters changed replace current_span_length in favor of parameters_changed Feb 24, 2025
@dvdsk dvdsk force-pushed the parameters_changed branch 3 times, most recently from 4678bb1 to 8204220 Compare February 25, 2025 10:47
@roderickvd
Copy link
Collaborator

Sure thing. Don't have much time this week, will look into it after.

@dvdsk dvdsk force-pushed the parameters_changed branch 2 times, most recently from af46244 to 481eed9 Compare February 26, 2025 18:02
dvdsk added a commit that referenced this pull request Feb 27, 2025
dvdsk added 15 commits February 27, 2025 14:38
All other sources have been marked as TODO using `todo!()`. This is such
that the test suite can run. New tests need to be made for all non
trivial implementations (those that do not simply forward the call to
`parameters_changed`)

- trivial implementations: TestSource, SamplesBuffer, chirp, delay,
  empty, empty_callback, mix, sawtooth, signal_generator, sine, square,
  triangle, zero, static_buffer
- implemented: blt, buffered, position, repeat, skip, take_duration,
  uniform
- marked as todo: all decoders, Mixer, Queue, source/from_iter

Added some sources to make the implementation easier:
- TakeSpan, takes up to a span of samples
- TakeSamples, takes n samples or slightly less. Always ends frame
  aligned
- Peekable, similar to Iterator::peekable.
also adds a new mod test support with a special test source that
can be used to test span boundary/parameters_changed handling.

adds two extra tests for `skip_duration` testing
 - parameters_changing during skip
 - ending on frame boundary
The removal of factories (like `source::amplify(unamplified, 1.2)` ->
`unamplified.amplify(1.2)`) was already planned and is tracked in issue
622. Its not done now. I am working through it as I add tests for all
the non-trivial source's.
This also improves the `TestSpan` in tests/test_support to prevent
expected total duration not matching `sample_rate` * `channels` *
`sample_count`
fix peekable & peekable tests + improve TestSource

performance: remove `if` from PeekableSource::next
add tests for buffered, fix buffered `parameters_changed`
@dvdsk dvdsk force-pushed the parameters_changed branch from f1cf00e to 8c8df80 Compare February 27, 2025 13:38
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