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

Allow specifying the number of input channels #1

Merged
merged 4 commits into from
Jun 28, 2020
Merged

Allow specifying the number of input channels #1

merged 4 commits into from
Jun 28, 2020

Conversation

makivlach
Copy link
Contributor

I would find it convenient for my use-case to have an option to specify the number of input channels. Perhaps others would appreciate it too.

@MarkKremer
Copy link
Owner

Hi 👋,

I completely agree. The reason I didn't include this parameter when I wrote this is because Beep uses a [][2]float64 regardless of the channel count specified in the format.

Three improvements before I merge:

  • The size of the buffer used by Streamer needs to match the channel count.
  • In the Stream function the variable-channel buffer needs to be mapped to the 2-channel samples that beep expects.
  • OpenDefaultStream should return an error if more than 2 channels are used. Because that doesn't work with the Beep format.

* Make buffer size variable according to the channels amount
* Provide conversions between channeled buffer and beep samples
@makivlach
Copy link
Contributor Author

makivlach commented Jun 28, 2020

Hi @MarkKremer!

Thank you for your feedback! I've finished the changes as you've requested. I hope I didn't forget anything. If you feel like changing anything further, let me know!

Cheers!

Edit: sorry, my brain is being wholly drained today. I've additionally changed the function for converting buffer into samples to work immutably.

@MarkKremer
Copy link
Owner

LGTM, thanks for the PR!

@MarkKremer MarkKremer merged commit 17e9c0d into MarkKremer:master Jun 28, 2020
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