Change parameters of capture/playback.
- Parameters:
-
| attr | Struct with new settings |
- Returns:
- A boolean indicating success or not
This function will set the card to different hardware parameters for capture or playback (or both). It returns true when it was succesful in doing so.
If the new sound attributes are the same as the current ones, the function immediately returns true and does not emit a signal.
In case no stream is being captured or played back, nothing really happens; it just sets the initial parameters, emits the SoundAttributesChanged signal and returns true.
Otherwise, the following happens:
- capture and playback are stopped
- we wait until all buffers of all readers are drained
- the new attributes are set
- capture or playback is restarted
- if that fails, we reset the old attributes and try again
- if that fails too, the driver is left in an idle state
Changes to the sound attributes are emit()ted between stopping and starting the audio stream(s). It is possible multiple emits are generated with no audio data in between, for example when the (hardware) driver rejects the new attributes. Because of this, the receiver always knows the exact format of the audio stream when reading from its CAudioRingBufferReader. |