On 18 Jun 2019, at 12:13, Peter Sommerlad (CPP) <peter.cpp@sommerlad.ch> wrote:1. why is the inconsistency in represening counts/sizes between audio_buffer and audio_device? size_t vs. int, naming of member functions.
2. in 6.5:
is the iterator return type of audio_device_list define somewhere else? if not, it should at least be a typedef in the list type and specify, that its operator* returns an audio_device (or an optional<audio_device> to make code safer.)
Note that the API description below is intentionally incomplete so that the signal does not get overwhelmed by the noise. For example, we have left out constructors, destructors, and thorough application of const and noexcept to name but a few items. These functions, as well as more formal wording to specify them, will come in future revisions of this document. Furthermore, all names in this proposal are placeholder names subject to future bikeshedding.
3. why are the setter functions not noexcept? They return a bool to denote success. I consider the many bool returning functions a kind of design smell. Has anybody considered to employ enums for that? (I understand that often requires to negate logic).
Also a type with getters and setters is always suspect for me, since it leaks abstractions. Would sample rate and bufffer size frames somehow be related and just a missing single abstraction, or other combinations?
4. There seem to be deeper portability issues with the implementation defined types leaking and providing setters for them. What kind of operations would be possible on such a type, how could it be set to a different value than one previously received in a portable way. Why not provide a strong type wrapper (e.g., for sample_rate_t and buffer_size_t) with defined operations instead, so that it is clear, what are supported. Are set/get really the right API, or is a "Change/AdjustBy" a better API. I do not know the domain, so that makes me unsure, but obtaining a value, doing arbitrary arithmetic, then setting a value seems not a good abstraction.
5. bool queries: is_running(), is_input(), supports_sample_type<T>(), ... -> it seems to me there is a state machine lurking may be, or at least a state space that the device can represent. I think this should be modeled more explicitly, it might provide insights to a better abstraction than a boolean sea.
6. 6.8: Why is audio_device_io not a struct. closing angle brackets are missing.
7. 7.1/7.3 the while(true); is ihmo UB. Could we make it while(device.has_unprocessed_io()); or similarly check the state of it.