-
Notifications
You must be signed in to change notification settings - Fork 323
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
ASIO: Handle buffer size changes #473
Conversation
I'm not sure whether it is the best approach but it is not bad. I wonder whether a single generic callback would be better than individual callbacks for each event type. |
Ah, it's been a while since I've had to think about threads. Do you mean
Hmm, probably yes. I started out thinking that just |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing.
According to https://github.com/PortAudio/portaudio/wiki/ImplementationStyleGuidelines, C++ code should be C++98 so I'm also unsure about the thread safety of |
I'm thinking perhaps it would be simpler to just drop all the attempts at updating the buffer size, leaving just the callbacks. The library user would be responsible for calling This would push all the threading trouble onto the caller. And there can be changes other than buffer size anyway. |
When kAsioBufferSizeChange or kAsioResetRequest is received, remember it and update the buffer sizes the next time PaAsio_GetAvailableBufferSizes() is called. Add callbacks for those messages so that the library user can be aware of them.
It raises threading synchronization issues, and not all kAsioResetRequest events will be about that anyway. For example, ASIO4ALL can have changes in input channels; Portaudio's current API can't have chanel names change without reinitializing the library.
5715fca
to
f8da4ee
Compare
As I mentioned there, #519 doesn't seem to cover the case of messages sent before a stream is opened. |
@npostavs I don't think it is possible to receive callbacks before the stream is opened. Your code does not handle that either: the callbacks |
Oh, you're right. I managed to confuse myself into thinking it could work (possibly I got a bit mixed up between opening vs starting the stream). I believe #519 supersedes this one then. |
Closing as superseded by #519. |
This fixes #472. I don't know if it's the best approach.