Skip to content

Commit e8ae7eb

Browse files
committed
jack: query the devices after help
Evantual error messages from audio_jack_probe will be better aligned after the available devices line.
1 parent b278ece commit e8ae7eb

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/audio/capture/jack.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ static void audio_cap_jack_probe(struct device_info **available_devices, int *co
116116

117117
static void audio_cap_jack_help(const char *client_name)
118118
{
119-
int count = 0;
120-
int i = 0;
121-
struct device_info *available_devices = audio_jack_probe(client_name, JackPortIsOutput, &count);
122-
123119
printf("Usage:\n");
124120
printf("\t-s jack[:first_channel=<f>][:name=<n>][:<device>]\n");
125121
printf("\twhere\n");
@@ -128,7 +124,10 @@ static void audio_cap_jack_help(const char *client_name)
128124
printf("\n");
129125

130126
printf("Available devices:\n");
131-
for(i = 0; i < count; i++){
127+
int count = 0;
128+
struct device_info *available_devices =
129+
audio_jack_probe(client_name, JackPortIsOutput, &count);
130+
for (int i = 0; i < count; i++) {
132131
printf("\t%s\n", available_devices[i].name);
133132
}
134133
free(available_devices);

src/audio/playback/jack.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,6 @@ static void audio_play_jack_probe(struct device_info **available_devices, int *c
133133

134134
static void audio_play_jack_help(const char *client_name)
135135
{
136-
int count = 0;
137-
int i = 0;
138-
struct device_info *available_devices = audio_jack_probe(client_name, JackPortIsInput, &count);
139-
140136
printf("Usage:\n");
141137
printf("\t-r jack[:first_channel=<f>][:name=<n>][:<device>]\n");
142138
printf("\twhere\n");
@@ -145,7 +141,10 @@ static void audio_play_jack_help(const char *client_name)
145141
printf("\n");
146142

147143
printf("Available devices:\n");
148-
for(i = 0; i < count; i++){
144+
int count = 0;
145+
struct device_info *available_devices =
146+
audio_jack_probe(client_name, JackPortIsInput, &count);
147+
for (int i = 0; i < count; i++) {
149148
printf("\t%s\n", available_devices[i].name);
150149
}
151150
free(available_devices);

0 commit comments

Comments
 (0)