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 |
philburk
left a comment
There was a problem hiding this comment.
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.