use consistent enum to string function names

closes #115
This commit is contained in:
Andrew Kelley 2016-10-23 19:19:47 -04:00
parent 4a8376a704
commit bef0df2f0b
11 changed files with 64 additions and 64 deletions

View file

@ -44,7 +44,7 @@ static void print_device(struct SoundIoDevice *device, bool is_default) {
fprintf(stderr, " id: %s\n", device->id); fprintf(stderr, " id: %s\n", device->id);
if (device->probe_error) { if (device->probe_error) {
fprintf(stderr, " probe error: %s\n", soundio_strerror(device->probe_error)); fprintf(stderr, " probe error: %s\n", soundio_error_name(device->probe_error));
} else { } else {
fprintf(stderr, " channel layouts:\n"); fprintf(stderr, " channel layouts:\n");
for (int i = 0; i < device->layout_count; i += 1) { for (int i = 0; i < device->layout_count; i += 1) {
@ -69,11 +69,11 @@ static void print_device(struct SoundIoDevice *device, bool is_default) {
fprintf(stderr, " formats: "); fprintf(stderr, " formats: ");
for (int i = 0; i < device->format_count; i += 1) { for (int i = 0; i < device->format_count; i += 1) {
const char *comma = (i == device->format_count - 1) ? "" : ", "; const char *comma = (i == device->format_count - 1) ? "" : ", ";
fprintf(stderr, "%s%s", soundio_format_string(device->formats[i]), comma); fprintf(stderr, "%s%s", soundio_format_name(device->formats[i]), comma);
} }
fprintf(stderr, "\n"); fprintf(stderr, "\n");
if (device->current_format != SoundIoFormatInvalid) if (device->current_format != SoundIoFormatInvalid)
fprintf(stderr, " current format: %s\n", soundio_format_string(device->current_format)); fprintf(stderr, " current format: %s\n", soundio_format_name(device->current_format));
fprintf(stderr, " min software latency: %0.8f sec\n", device->software_latency_min); fprintf(stderr, " min software latency: %0.8f sec\n", device->software_latency_min);
fprintf(stderr, " max software latency: %0.8f sec\n", device->software_latency_max); fprintf(stderr, " max software latency: %0.8f sec\n", device->software_latency_max);
@ -163,7 +163,7 @@ int main(int argc, char **argv) {
soundio_connect(soundio) : soundio_connect_backend(soundio, backend); soundio_connect(soundio) : soundio_connect_backend(soundio, backend);
if (err) { if (err) {
fprintf(stderr, "%s\n", soundio_strerror(err)); fprintf(stderr, "%s\n", soundio_error_name(err));
return err; return err;
} }

View file

@ -83,7 +83,7 @@ static void read_callback(struct SoundIoInStream *instream, int frame_count_min,
int frame_count = frames_left; int frame_count = frames_left;
if ((err = soundio_instream_begin_read(instream, &areas, &frame_count))) if ((err = soundio_instream_begin_read(instream, &areas, &frame_count)))
panic("begin read error: %s", soundio_strerror(err)); panic("begin read error: %s", soundio_error_name(err));
if (!frame_count) if (!frame_count)
break; break;
@ -104,7 +104,7 @@ static void read_callback(struct SoundIoInStream *instream, int frame_count_min,
} }
if ((err = soundio_instream_end_read(instream))) if ((err = soundio_instream_end_read(instream)))
panic("end read error: %s", soundio_strerror(err)); panic("end read error: %s", soundio_error_name(err));
frames_left -= frame_count; frames_left -= frame_count;
if (frames_left <= 0) if (frames_left <= 0)
@ -128,7 +128,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m
// Ring buffer does not have enough data, fill with zeroes. // Ring buffer does not have enough data, fill with zeroes.
for (;;) { for (;;) {
if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count))) if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count)))
panic("begin write error: %s", soundio_strerror(err)); panic("begin write error: %s", soundio_error_name(err));
if (frame_count <= 0) if (frame_count <= 0)
return; return;
for (int frame = 0; frame < frame_count; frame += 1) { for (int frame = 0; frame < frame_count; frame += 1) {
@ -138,7 +138,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m
} }
} }
if ((err = soundio_outstream_end_write(outstream))) if ((err = soundio_outstream_end_write(outstream)))
panic("end write error: %s", soundio_strerror(err)); panic("end write error: %s", soundio_error_name(err));
} }
} }
@ -149,7 +149,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m
int frame_count = frames_left; int frame_count = frames_left;
if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count))) if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count)))
panic("begin write error: %s", soundio_strerror(err)); panic("begin write error: %s", soundio_error_name(err));
if (frame_count <= 0) if (frame_count <= 0)
break; break;
@ -163,7 +163,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m
} }
if ((err = soundio_outstream_end_write(outstream))) if ((err = soundio_outstream_end_write(outstream)))
panic("end write error: %s", soundio_strerror(err)); panic("end write error: %s", soundio_error_name(err));
frames_left -= frame_count; frames_left -= frame_count;
} }
@ -245,7 +245,7 @@ int main(int argc, char **argv) {
int err = (backend == SoundIoBackendNone) ? int err = (backend == SoundIoBackendNone) ?
soundio_connect(soundio) : soundio_connect_backend(soundio, backend); soundio_connect(soundio) : soundio_connect_backend(soundio, backend);
if (err) if (err)
panic("error connecting: %s", soundio_strerror(err)); panic("error connecting: %s", soundio_error_name(err));
soundio_flush_events(soundio); soundio_flush_events(soundio);
@ -342,7 +342,7 @@ int main(int argc, char **argv) {
instream->read_callback = read_callback; instream->read_callback = read_callback;
if ((err = soundio_instream_open(instream))) { if ((err = soundio_instream_open(instream))) {
fprintf(stderr, "unable to open input stream: %s", soundio_strerror(err)); fprintf(stderr, "unable to open input stream: %s", soundio_error_name(err));
return 1; return 1;
} }
@ -357,7 +357,7 @@ int main(int argc, char **argv) {
outstream->underflow_callback = underflow_callback; outstream->underflow_callback = underflow_callback;
if ((err = soundio_outstream_open(outstream))) { if ((err = soundio_outstream_open(outstream))) {
fprintf(stderr, "unable to open output stream: %s", soundio_strerror(err)); fprintf(stderr, "unable to open output stream: %s", soundio_error_name(err));
return 1; return 1;
} }
@ -371,10 +371,10 @@ int main(int argc, char **argv) {
soundio_ring_buffer_advance_write_ptr(ring_buffer, fill_count); soundio_ring_buffer_advance_write_ptr(ring_buffer, fill_count);
if ((err = soundio_instream_start(instream))) if ((err = soundio_instream_start(instream)))
panic("unable to start input device: %s", soundio_strerror(err)); panic("unable to start input device: %s", soundio_error_name(err));
if ((err = soundio_outstream_start(outstream))) if ((err = soundio_outstream_start(outstream)))
panic("unable to start output device: %s", soundio_strerror(err)); panic("unable to start output device: %s", soundio_error_name(err));
for (;;) for (;;)
soundio_wait_events(soundio); soundio_wait_events(soundio);

View file

@ -77,7 +77,7 @@ static void read_callback(struct SoundIoInStream *instream, int frame_count_min,
int frame_count = frames_left; int frame_count = frames_left;
if ((err = soundio_instream_begin_read(instream, &areas, &frame_count))) { if ((err = soundio_instream_begin_read(instream, &areas, &frame_count))) {
fprintf(stderr, "begin read error: %s", soundio_strerror(err)); fprintf(stderr, "begin read error: %s", soundio_error_name(err));
exit(1); exit(1);
} }
@ -99,7 +99,7 @@ static void read_callback(struct SoundIoInStream *instream, int frame_count_min,
} }
if ((err = soundio_instream_end_read(instream))) { if ((err = soundio_instream_end_read(instream))) {
fprintf(stderr, "end read error: %s", soundio_strerror(err)); fprintf(stderr, "end read error: %s", soundio_error_name(err));
exit(1); exit(1);
} }
@ -183,7 +183,7 @@ int main(int argc, char **argv) {
int err = (backend == SoundIoBackendNone) ? int err = (backend == SoundIoBackendNone) ?
soundio_connect(soundio) : soundio_connect_backend(soundio, backend); soundio_connect(soundio) : soundio_connect_backend(soundio, backend);
if (err) { if (err) {
fprintf(stderr, "error connecting: %s", soundio_strerror(err)); fprintf(stderr, "error connecting: %s", soundio_error_name(err));
return 1; return 1;
} }
@ -216,7 +216,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Device: %s\n", selected_device->name); fprintf(stderr, "Device: %s\n", selected_device->name);
if (selected_device->probe_error) { if (selected_device->probe_error) {
fprintf(stderr, "Unable to probe device: %s\n", soundio_strerror(selected_device->probe_error)); fprintf(stderr, "Unable to probe device: %s\n", soundio_error_name(selected_device->probe_error));
return 1; return 1;
} }
@ -261,12 +261,12 @@ int main(int argc, char **argv) {
instream->userdata = &rc; instream->userdata = &rc;
if ((err = soundio_instream_open(instream))) { if ((err = soundio_instream_open(instream))) {
fprintf(stderr, "unable to open input stream: %s", soundio_strerror(err)); fprintf(stderr, "unable to open input stream: %s", soundio_error_name(err));
return 1; return 1;
} }
fprintf(stderr, "%s %dHz %s interleaved\n", fprintf(stderr, "%s %dHz %s interleaved\n",
instream->layout.name, sample_rate, soundio_format_string(fmt)); instream->layout.name, sample_rate, soundio_format_name(fmt));
const int ring_buffer_duration_seconds = 30; const int ring_buffer_duration_seconds = 30;
int capacity = ring_buffer_duration_seconds * instream->sample_rate * instream->bytes_per_frame; int capacity = ring_buffer_duration_seconds * instream->sample_rate * instream->bytes_per_frame;
@ -277,7 +277,7 @@ int main(int argc, char **argv) {
} }
if ((err = soundio_instream_start(instream))) { if ((err = soundio_instream_start(instream))) {
fprintf(stderr, "unable to start input device: %s", soundio_strerror(err)); fprintf(stderr, "unable to start input device: %s", soundio_error_name(err));
return 1; return 1;
} }

View file

@ -65,7 +65,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m
for (;;) { for (;;) {
int frame_count = frames_left; int frame_count = frames_left;
if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count))) { if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count))) {
fprintf(stderr, "unrecoverable stream error: %s\n", soundio_strerror(err)); fprintf(stderr, "unrecoverable stream error: %s\n", soundio_error_name(err));
exit(1); exit(1);
} }
@ -88,7 +88,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m
if ((err = soundio_outstream_end_write(outstream))) { if ((err = soundio_outstream_end_write(outstream))) {
if (err == SoundIoErrorUnderflow) if (err == SoundIoErrorUnderflow)
return; return;
fprintf(stderr, "unrecoverable stream error: %s\n", soundio_strerror(err)); fprintf(stderr, "unrecoverable stream error: %s\n", soundio_error_name(err));
exit(1); exit(1);
} }
@ -166,7 +166,7 @@ int main(int argc, char **argv) {
soundio_connect(soundio) : soundio_connect_backend(soundio, backend); soundio_connect(soundio) : soundio_connect_backend(soundio, backend);
if (err) { if (err) {
fprintf(stderr, "Unable to connect to backend: %s\n", soundio_strerror(err)); fprintf(stderr, "Unable to connect to backend: %s\n", soundio_error_name(err));
return 1; return 1;
} }
@ -204,7 +204,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Output device: %s\n", device->name); fprintf(stderr, "Output device: %s\n", device->name);
if (device->probe_error) { if (device->probe_error) {
fprintf(stderr, "Cannot probe device: %s\n", soundio_strerror(device->probe_error)); fprintf(stderr, "Cannot probe device: %s\n", soundio_error_name(device->probe_error));
return 1; return 1;
} }
@ -238,7 +238,7 @@ int main(int argc, char **argv) {
} }
if ((err = soundio_outstream_open(outstream))) { if ((err = soundio_outstream_open(outstream))) {
fprintf(stderr, "unable to open device: %s", soundio_strerror(err)); fprintf(stderr, "unable to open device: %s", soundio_error_name(err));
return 1; return 1;
} }
@ -251,10 +251,10 @@ int main(int argc, char **argv) {
"'q\\n' - quit\n"); "'q\\n' - quit\n");
if (outstream->layout_error) if (outstream->layout_error)
fprintf(stderr, "unable to set channel layout: %s\n", soundio_strerror(outstream->layout_error)); fprintf(stderr, "unable to set channel layout: %s\n", soundio_error_name(outstream->layout_error));
if ((err = soundio_outstream_start(outstream))) { if ((err = soundio_outstream_start(outstream))) {
fprintf(stderr, "unable to start device: %s\n", soundio_strerror(err)); fprintf(stderr, "unable to start device: %s\n", soundio_error_name(err));
return 1; return 1;
} }
@ -263,16 +263,16 @@ int main(int argc, char **argv) {
int c = getc(stdin); int c = getc(stdin);
if (c == 'p') { if (c == 'p') {
fprintf(stderr, "pausing result: %s\n", fprintf(stderr, "pausing result: %s\n",
soundio_strerror(soundio_outstream_pause(outstream, true))); soundio_error_name(soundio_outstream_pause(outstream, true)));
} else if (c == 'P') { } else if (c == 'P') {
want_pause = true; want_pause = true;
} else if (c == 'u') { } else if (c == 'u') {
want_pause = false; want_pause = false;
fprintf(stderr, "unpausing result: %s\n", fprintf(stderr, "unpausing result: %s\n",
soundio_strerror(soundio_outstream_pause(outstream, false))); soundio_error_name(soundio_outstream_pause(outstream, false)));
} else if (c == 'c') { } else if (c == 'c') {
fprintf(stderr, "clear buffer result: %s\n", fprintf(stderr, "clear buffer result: %s\n",
soundio_strerror(soundio_outstream_clear_buffer(outstream))); soundio_error_name(soundio_outstream_clear_buffer(outstream)));
} else if (c == 'q') { } else if (c == 'q') {
break; break;
} else if (c == '\r' || c == '\n') { } else if (c == '\r' || c == '\n') {

View file

@ -68,7 +68,7 @@
* Demonstrates recovering from a backend disconnecting. * Demonstrates recovering from a backend disconnecting.
*/ */
/// See also ::soundio_strerror /// See also ::soundio_error_name
enum SoundIoError { enum SoundIoError {
SoundIoErrorNone, SoundIoErrorNone,
/// Out of memory. /// Out of memory.
@ -729,7 +729,7 @@ SOUNDIO_EXPORT enum SoundIoError soundio_connect_backend(struct SoundIo *soundio
SOUNDIO_EXPORT void soundio_disconnect(struct SoundIo *soundio); SOUNDIO_EXPORT void soundio_disconnect(struct SoundIo *soundio);
/// Get a string representation of a #SoundIoError /// Get a string representation of a #SoundIoError
SOUNDIO_EXPORT const char *soundio_strerror(enum SoundIoError error); SOUNDIO_EXPORT const char *soundio_error_name(enum SoundIoError error);
/// Get a string representation of a #SoundIoBackend /// Get a string representation of a #SoundIoBackend
SOUNDIO_EXPORT const char *soundio_backend_name(enum SoundIoBackend backend); SOUNDIO_EXPORT const char *soundio_backend_name(enum SoundIoBackend backend);
@ -853,7 +853,7 @@ static inline int soundio_get_bytes_per_second(enum SoundIoFormat format,
} }
/// Returns string representation of `format`. /// Returns string representation of `format`.
SOUNDIO_EXPORT const char * soundio_format_string(enum SoundIoFormat format); SOUNDIO_EXPORT const char * soundio_format_name(enum SoundIoFormat format);

View file

@ -73,7 +73,7 @@ static backend_init_t backend_init_fns[] = {
SOUNDIO_MAKE_LIST_DEF(struct SoundIoDevice*, SoundIoListDevicePtr, SOUNDIO_LIST_NOT_STATIC) SOUNDIO_MAKE_LIST_DEF(struct SoundIoDevice*, SoundIoListDevicePtr, SOUNDIO_LIST_NOT_STATIC)
SOUNDIO_MAKE_LIST_DEF(struct SoundIoSampleRateRange, SoundIoListSampleRateRange, SOUNDIO_LIST_NOT_STATIC) SOUNDIO_MAKE_LIST_DEF(struct SoundIoSampleRateRange, SoundIoListSampleRateRange, SOUNDIO_LIST_NOT_STATIC)
const char *soundio_strerror(enum SoundIoError error) { const char *soundio_error_name(enum SoundIoError error) {
switch (error) { switch (error) {
case SoundIoErrorNone: return "(no error)"; case SoundIoErrorNone: return "(no error)";
case SoundIoErrorNoMem: return "out of memory"; case SoundIoErrorNoMem: return "out of memory";
@ -125,7 +125,7 @@ int soundio_get_bytes_per_sample(enum SoundIoFormat format) {
return -1; return -1;
} }
const char * soundio_format_string(enum SoundIoFormat format) { const char * soundio_format_name(enum SoundIoFormat format) {
switch (format) { switch (format) {
case SoundIoFormatS8: return "signed 8-bit"; case SoundIoFormatS8: return "signed 8-bit";
case SoundIoFormatU8: return "unsigned 8-bit"; case SoundIoFormatU8: return "unsigned 8-bit";
@ -182,7 +182,7 @@ static void do_nothing_cb(struct SoundIo *soundio) { }
static void default_msg_callback(const char *msg) { } static void default_msg_callback(const char *msg) { }
static void default_backend_disconnect_cb(struct SoundIo *soundio, enum SoundIoError err) { static void default_backend_disconnect_cb(struct SoundIo *soundio, enum SoundIoError err) {
soundio_panic("libsoundio: backend disconnected: %s", soundio_strerror(err)); soundio_panic("libsoundio: backend disconnected: %s", soundio_error_name(err));
} }
static struct SoundIoAtomicFlag rtprio_seen = SOUNDIO_ATOMIC_FLAG_INIT; static struct SoundIoAtomicFlag rtprio_seen = SOUNDIO_ATOMIC_FLAG_INIT;
@ -465,7 +465,7 @@ enum SoundIoError soundio_outstream_end_write(struct SoundIoOutStream *outstream
} }
static void default_outstream_error_callback(struct SoundIoOutStream *os, enum SoundIoError err) { static void default_outstream_error_callback(struct SoundIoOutStream *os, enum SoundIoError err) {
soundio_panic("libsoundio: %s", soundio_strerror(err)); soundio_panic("libsoundio: %s", soundio_error_name(err));
} }
static void default_underflow_callback(struct SoundIoOutStream *outstream) { } static void default_underflow_callback(struct SoundIoOutStream *outstream) { }
@ -569,7 +569,7 @@ enum SoundIoError soundio_outstream_get_latency(struct SoundIoOutStream *outstre
} }
static void default_instream_error_callback(struct SoundIoInStream *is, enum SoundIoError err) { static void default_instream_error_callback(struct SoundIoInStream *is, enum SoundIoError err) {
soundio_panic("libsoundio: %s", soundio_strerror(err)); soundio_panic("libsoundio: %s", soundio_error_name(err));
} }
static void default_overflow_callback(struct SoundIoInStream *instream) { } static void default_overflow_callback(struct SoundIoInStream *instream) { }

View file

@ -39,7 +39,7 @@ static enum SoundIoBackend backend = SoundIoBackendNone;
static bool severed = false; static bool severed = false;
static void on_backend_disconnect(struct SoundIo *soundio, enum SoundIoError err) { static void on_backend_disconnect(struct SoundIo *soundio, enum SoundIoError err) {
fprintf(stderr, "OK backend disconnected with '%s'.\n", soundio_strerror(err)); fprintf(stderr, "OK backend disconnected with '%s'.\n", soundio_error_name(err));
severed = true; severed = true;
} }
@ -87,7 +87,7 @@ int main(int argc, char **argv) {
soundio_connect(soundio) : soundio_connect_backend(soundio, backend); soundio_connect(soundio) : soundio_connect_backend(soundio, backend);
if (err) if (err)
panic("error connecting: %s", soundio_strerror(err)); panic("error connecting: %s", soundio_error_name(err));
soundio->on_backend_disconnect = on_backend_disconnect; soundio->on_backend_disconnect = on_backend_disconnect;
@ -110,7 +110,7 @@ int main(int argc, char **argv) {
soundio_connect(soundio) : soundio_connect_backend(soundio, backend); soundio_connect(soundio) : soundio_connect_backend(soundio, backend);
if (err) if (err)
panic("error reconnecting: %s", soundio_strerror(err)); panic("error reconnecting: %s", soundio_error_name(err));
fprintf(stderr, "OK reconnected successfully to %s\n", soundio_backend_name(soundio->current_backend)); fprintf(stderr, "OK reconnected successfully to %s\n", soundio_backend_name(soundio->current_backend));

View file

@ -57,7 +57,7 @@ static void write_time(struct SoundIoOutStream *outstream, double extra) {
double latency; double latency;
int err; int err;
if ((err = soundio_outstream_get_latency(outstream, &latency))) { if ((err = soundio_outstream_get_latency(outstream, &latency))) {
soundio_panic("getting latency: %s", soundio_strerror(err)); soundio_panic("getting latency: %s", soundio_error_name(err));
} }
double now = soundio_os_get_time(); double now = soundio_os_get_time();
double audible_time = now + latency + extra; double audible_time = now + latency + extra;
@ -78,7 +78,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m
int frame_count = frames_left; int frame_count = frames_left;
if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count))) if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count)))
soundio_panic("begin write: %s", soundio_strerror(err)); soundio_panic("begin write: %s", soundio_error_name(err));
if (!frame_count) if (!frame_count)
break; break;
@ -116,7 +116,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m
seconds_offset += seconds_per_frame * frame_count; seconds_offset += seconds_per_frame * frame_count;
if ((err = soundio_outstream_end_write(outstream))) if ((err = soundio_outstream_end_write(outstream)))
soundio_panic("end write: %s", soundio_strerror(err)); soundio_panic("end write: %s", soundio_error_name(err));
frames_left -= frame_count; frames_left -= frame_count;
} }
@ -171,7 +171,7 @@ int main(int argc, char **argv) {
soundio_connect(soundio) : soundio_connect_backend(soundio, backend); soundio_connect(soundio) : soundio_connect_backend(soundio, backend);
if (err) if (err)
soundio_panic("error connecting: %s", soundio_strerror(err)); soundio_panic("error connecting: %s", soundio_error_name(err));
soundio_flush_events(soundio); soundio_flush_events(soundio);
@ -208,16 +208,16 @@ int main(int argc, char **argv) {
} }
if ((err = soundio_ring_buffer_init(&pulse_rb, 1024))) if ((err = soundio_ring_buffer_init(&pulse_rb, 1024)))
soundio_panic("ring buffer init: %s", soundio_strerror(err)); soundio_panic("ring buffer init: %s", soundio_error_name(err));
if ((err = soundio_outstream_open(outstream))) if ((err = soundio_outstream_open(outstream)))
soundio_panic("unable to open device: %s", soundio_strerror(err)); soundio_panic("unable to open device: %s", soundio_error_name(err));
if (outstream->layout_error) if (outstream->layout_error)
fprintf(stderr, "unable to set channel layout: %s\n", soundio_strerror(outstream->layout_error)); fprintf(stderr, "unable to set channel layout: %s\n", soundio_error_name(outstream->layout_error));
if ((err = soundio_outstream_start(outstream))) if ((err = soundio_outstream_start(outstream)))
soundio_panic("unable to start device: %s", soundio_strerror(err)); soundio_panic("unable to start device: %s", soundio_error_name(err));
bool beep_on = true; bool beep_on = true;
int count = 0; int count = 0;

View file

@ -90,7 +90,7 @@ static void read_callback(struct SoundIoInStream *instream, int frame_count_min,
int frame_count = frames_left; int frame_count = frames_left;
if ((err = soundio_instream_begin_read(instream, &areas, &frame_count))) if ((err = soundio_instream_begin_read(instream, &areas, &frame_count)))
panic("begin read error: %s", soundio_strerror(err)); panic("begin read error: %s", soundio_error_name(err));
if (!frame_count) if (!frame_count)
break; break;
@ -98,7 +98,7 @@ static void read_callback(struct SoundIoInStream *instream, int frame_count_min,
seconds_offset += seconds_per_frame * frame_count; seconds_offset += seconds_per_frame * frame_count;
if ((err = soundio_instream_end_read(instream))) if ((err = soundio_instream_end_read(instream)))
panic("end read error: %s", soundio_strerror(err)); panic("end read error: %s", soundio_error_name(err));
frames_left -= frame_count; frames_left -= frame_count;
if (frames_left <= 0) if (frames_left <= 0)
@ -165,7 +165,7 @@ int main(int argc, char **argv) {
soundio_connect(soundio) : soundio_connect_backend(soundio, backend); soundio_connect(soundio) : soundio_connect_backend(soundio, backend);
if (err) if (err)
panic("error connecting: %s", soundio_strerror(err)); panic("error connecting: %s", soundio_error_name(err));
soundio_flush_events(soundio); soundio_flush_events(soundio);
@ -210,12 +210,12 @@ int main(int argc, char **argv) {
instream->overflow_callback = overflow_callback; instream->overflow_callback = overflow_callback;
if ((err = soundio_instream_open(instream))) if ((err = soundio_instream_open(instream)))
panic("unable to open device: %s", soundio_strerror(err)); panic("unable to open device: %s", soundio_error_name(err));
fprintf(stderr, "OK format: %s\n", soundio_format_string(instream->format)); fprintf(stderr, "OK format: %s\n", soundio_format_name(instream->format));
if ((err = soundio_instream_start(instream))) if ((err = soundio_instream_start(instream)))
panic("unable to start device: %s", soundio_strerror(err)); panic("unable to start device: %s", soundio_error_name(err));
while (seconds_offset < seconds_end) while (seconds_offset < seconds_end)
soundio_wait_events(soundio); soundio_wait_events(soundio);

View file

@ -90,7 +90,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m
for (;;) { for (;;) {
int frame_count = frames_left; int frame_count = frames_left;
if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count))) if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count)))
panic("%s", soundio_strerror(err)); panic("%s", soundio_error_name(err));
if (!frame_count) if (!frame_count)
break; break;
@ -111,7 +111,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m
if ((err = soundio_outstream_end_write(outstream))) { if ((err = soundio_outstream_end_write(outstream))) {
if (err == SoundIoErrorUnderflow) if (err == SoundIoErrorUnderflow)
return; return;
panic("%s", soundio_strerror(err)); panic("%s", soundio_error_name(err));
} }
frames_left -= frame_count; frames_left -= frame_count;
@ -182,7 +182,7 @@ int main(int argc, char **argv) {
soundio_connect(soundio) : soundio_connect_backend(soundio, backend); soundio_connect(soundio) : soundio_connect_backend(soundio, backend);
if (err) if (err)
panic("error connecting: %s", soundio_strerror(err)); panic("error connecting: %s", soundio_error_name(err));
soundio_flush_events(soundio); soundio_flush_events(soundio);
@ -233,13 +233,13 @@ int main(int argc, char **argv) {
} }
if ((err = soundio_outstream_open(outstream))) if ((err = soundio_outstream_open(outstream)))
panic("unable to open device: %s", soundio_strerror(err)); panic("unable to open device: %s", soundio_error_name(err));
if (outstream->layout_error) if (outstream->layout_error)
fprintf(stderr, "unable to set channel layout: %s\n", soundio_strerror(outstream->layout_error)); fprintf(stderr, "unable to set channel layout: %s\n", soundio_error_name(outstream->layout_error));
if ((err = soundio_outstream_start(outstream))) if ((err = soundio_outstream_start(outstream)))
panic("unable to start device: %s", soundio_strerror(err)); panic("unable to start device: %s", soundio_error_name(err));
while (seconds_offset < seconds_end) while (seconds_offset < seconds_end)
soundio_wait_events(soundio); soundio_wait_events(soundio);

View file

@ -12,7 +12,7 @@
static inline void ok_or_panic(int err) { static inline void ok_or_panic(int err) {
if (err) if (err)
soundio_panic("%s", soundio_strerror(err)); soundio_panic("%s", soundio_error_name(err));
} }
static void test_os_get_time(void) { static void test_os_get_time(void) {