mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
examples: improve console output
Go back up right before we're going to draw so that we're always at the bottom when we quit because of ctrl-C.
This commit is contained in:
parent
945529f029
commit
80983b9fb6
1 changed files with 5 additions and 2 deletions
|
|
@ -42,6 +42,7 @@ struct data {
|
|||
struct pw_stream *stream;
|
||||
|
||||
struct spa_audio_info format;
|
||||
unsigned move:1;
|
||||
};
|
||||
|
||||
/* our data processing function is in general:
|
||||
|
|
@ -73,6 +74,9 @@ static void on_process(void *userdata)
|
|||
n_channels = data->format.info.raw.channels;
|
||||
n_samples = buf->datas[0].chunk->size / sizeof(float);
|
||||
|
||||
/* move cursor up */
|
||||
if (data->move)
|
||||
fprintf(stdout, "%c[%dA", 0x1b, n_channels + 1);
|
||||
fprintf(stdout, "captured %d samples\n", n_samples / n_channels);
|
||||
for (c = 0; c < data->format.info.raw.channels; c++) {
|
||||
max = 0.0f;
|
||||
|
|
@ -84,8 +88,7 @@ static void on_process(void *userdata)
|
|||
fprintf(stdout, "channel %d: |%*s%*s| peak:%f\n",
|
||||
c, peak+1, "*", 40 - peak, "", max);
|
||||
}
|
||||
/* move cursor up */
|
||||
fprintf(stdout, "%c[%dA", 0x1b, n_channels + 1);
|
||||
data->move = true;
|
||||
fflush(stdout);
|
||||
|
||||
pw_stream_queue_buffer(data->stream, b);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue