26 Apr
2013
26 Apr
'13
5:38 p.m.
On Fri, Apr 26, 2013 at 02:56:27PM +0100, Richard Fitzgerald wrote:
if ((data->stream.runtime->state == SNDRV_PCM_STATE_RUNNING) ||
(data->stream.runtime->state == SNDRV_PCM_STATE_PAUSED))
data->stream.ops->trigger(&data->stream, SNDRV_PCM_TRIGGER_STOP);
A switch statement would be more idiomatic for this sort of thing.
This follows the general style used in other functions in the source file. I'm happy to upload a version that uses a switch instead if that's preferred.
Well, it doesn't quite follow the same style as the code generally does:
if (stream->runtime->state == SNDRV_PCM_STATE_PAUSED || stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
with fewer () and different indentation to what you have above... being consistent with the rest of the file is best, though it would be nice to update the file to do this sort of thing with switches.