2015-07-06 08:05:22 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Andrew Kelley
|
|
|
|
*
|
|
|
|
* This file is part of libsoundio, which is MIT licensed.
|
|
|
|
* See http://opensource.org/licenses/MIT
|
|
|
|
*/
|
|
|
|
|
2015-07-30 19:18:56 +00:00
|
|
|
#include <soundio/soundio.h>
|
2015-07-06 08:05:22 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
2015-07-30 04:50:12 +00:00
|
|
|
static const double microphone_latency = 0.2; // seconds
|
|
|
|
|
2015-08-05 04:57:46 +00:00
|
|
|
struct SoundIoRingBuffer *ring_buffer = NULL;
|
|
|
|
|
2015-07-13 16:59:42 +00:00
|
|
|
static enum SoundIoFormat prioritized_formats[] = {
|
|
|
|
SoundIoFormatFloat32NE,
|
|
|
|
SoundIoFormatFloat32FE,
|
|
|
|
SoundIoFormatS32NE,
|
|
|
|
SoundIoFormatS32FE,
|
|
|
|
SoundIoFormatS24NE,
|
|
|
|
SoundIoFormatS24FE,
|
|
|
|
SoundIoFormatS16NE,
|
|
|
|
SoundIoFormatS16FE,
|
|
|
|
SoundIoFormatFloat64NE,
|
|
|
|
SoundIoFormatFloat64FE,
|
|
|
|
SoundIoFormatU32NE,
|
|
|
|
SoundIoFormatU32FE,
|
|
|
|
SoundIoFormatU24NE,
|
|
|
|
SoundIoFormatU24FE,
|
|
|
|
SoundIoFormatU16NE,
|
|
|
|
SoundIoFormatU16FE,
|
|
|
|
SoundIoFormatS8,
|
|
|
|
SoundIoFormatU8,
|
|
|
|
SoundIoFormatInvalid,
|
|
|
|
};
|
|
|
|
|
2015-08-08 21:44:31 +00:00
|
|
|
static int prioritized_sample_rates[] = {
|
|
|
|
48000,
|
|
|
|
44100,
|
|
|
|
96000,
|
|
|
|
24000,
|
|
|
|
0,
|
|
|
|
};
|
|
|
|
|
2015-08-05 04:57:46 +00:00
|
|
|
|
2015-07-06 08:05:22 +00:00
|
|
|
__attribute__ ((cold))
|
|
|
|
__attribute__ ((noreturn))
|
|
|
|
__attribute__ ((format (printf, 1, 2)))
|
|
|
|
static void panic(const char *format, ...) {
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, format);
|
|
|
|
vfprintf(stderr, format, ap);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
va_end(ap);
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
2015-08-05 04:57:46 +00:00
|
|
|
static int min_int(int a, int b) {
|
|
|
|
return (a < b) ? a : b;
|
|
|
|
}
|
2015-07-22 22:43:45 +00:00
|
|
|
|
2015-08-05 04:57:46 +00:00
|
|
|
static void read_callback(struct SoundIoInStream *instream, int frame_count_min, int frame_count_max) {
|
2015-08-04 07:56:03 +00:00
|
|
|
struct SoundIoChannelArea *areas;
|
2015-07-22 22:43:45 +00:00
|
|
|
int err;
|
|
|
|
char *write_ptr = soundio_ring_buffer_write_ptr(ring_buffer);
|
2015-07-25 01:43:14 +00:00
|
|
|
int free_bytes = soundio_ring_buffer_free_count(ring_buffer);
|
|
|
|
int free_count = free_bytes / instream->bytes_per_frame;
|
2015-07-22 22:43:45 +00:00
|
|
|
|
2015-08-05 04:57:46 +00:00
|
|
|
if (frame_count_min > free_count)
|
2015-08-04 07:56:03 +00:00
|
|
|
panic("ring buffer overflow");
|
|
|
|
|
2015-08-05 04:57:46 +00:00
|
|
|
int write_frames = min_int(free_count, frame_count_max);
|
|
|
|
int frames_left = write_frames;
|
|
|
|
|
2015-08-04 07:56:03 +00:00
|
|
|
for (;;) {
|
2015-08-05 04:57:46 +00:00
|
|
|
int frame_count = frames_left;
|
|
|
|
|
2015-07-22 22:43:45 +00:00
|
|
|
if ((err = soundio_instream_begin_read(instream, &areas, &frame_count)))
|
|
|
|
panic("begin read error: %s", soundio_strerror(err));
|
|
|
|
|
2015-08-04 07:56:03 +00:00
|
|
|
if (!frame_count)
|
2015-07-22 22:43:45 +00:00
|
|
|
break;
|
|
|
|
|
2015-07-23 22:04:41 +00:00
|
|
|
if (!areas) {
|
|
|
|
// Due to an overflow there is a hole. Fill the ring buffer with
|
|
|
|
// silence for the size of the hole.
|
|
|
|
memset(write_ptr, 0, frame_count * instream->bytes_per_frame);
|
2015-07-25 01:43:14 +00:00
|
|
|
fprintf(stderr, "Dropped %d frames due to internal overflow\n", frame_count);
|
2015-07-23 22:04:41 +00:00
|
|
|
} else {
|
|
|
|
for (int frame = 0; frame < frame_count; frame += 1) {
|
|
|
|
for (int ch = 0; ch < instream->layout.channel_count; ch += 1) {
|
|
|
|
memcpy(write_ptr, areas[ch].ptr, instream->bytes_per_sample);
|
|
|
|
areas[ch].ptr += areas[ch].step;
|
|
|
|
write_ptr += instream->bytes_per_sample;
|
|
|
|
}
|
2015-07-22 22:43:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((err = soundio_instream_end_read(instream)))
|
|
|
|
panic("end read error: %s", soundio_strerror(err));
|
2015-08-05 04:57:46 +00:00
|
|
|
|
|
|
|
frames_left -= frame_count;
|
|
|
|
if (frames_left <= 0)
|
|
|
|
break;
|
2015-07-22 22:43:45 +00:00
|
|
|
}
|
|
|
|
|
2015-08-05 04:57:46 +00:00
|
|
|
int advance_bytes = write_frames * instream->bytes_per_frame;
|
2015-07-24 20:26:46 +00:00
|
|
|
soundio_ring_buffer_advance_write_ptr(ring_buffer, advance_bytes);
|
2015-07-06 08:05:22 +00:00
|
|
|
}
|
|
|
|
|
2015-08-05 04:57:46 +00:00
|
|
|
static void write_callback(struct SoundIoOutStream *outstream, int frame_count_min, int frame_count_max) {
|
2015-07-22 22:43:45 +00:00
|
|
|
struct SoundIoChannelArea *areas;
|
2015-08-04 07:56:03 +00:00
|
|
|
int frame_count;
|
|
|
|
int err;
|
|
|
|
|
2015-07-22 22:43:45 +00:00
|
|
|
char *read_ptr = soundio_ring_buffer_read_ptr(ring_buffer);
|
2015-07-24 20:26:46 +00:00
|
|
|
int fill_bytes = soundio_ring_buffer_fill_count(ring_buffer);
|
|
|
|
int fill_count = fill_bytes / outstream->bytes_per_frame;
|
2015-07-22 22:43:45 +00:00
|
|
|
|
2015-08-05 04:57:46 +00:00
|
|
|
if (frame_count_min > fill_count) {
|
2015-08-04 07:56:03 +00:00
|
|
|
// Ring buffer does not have enough data, fill with zeroes.
|
|
|
|
for (;;) {
|
|
|
|
if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count)))
|
|
|
|
panic("begin write error: %s", soundio_strerror(err));
|
|
|
|
if (frame_count <= 0)
|
|
|
|
return;
|
|
|
|
for (int frame = 0; frame < frame_count; frame += 1) {
|
|
|
|
for (int ch = 0; ch < outstream->layout.channel_count; ch += 1) {
|
|
|
|
memset(areas[ch].ptr, 0, outstream->bytes_per_sample);
|
|
|
|
areas[ch].ptr += areas[ch].step;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((err = soundio_outstream_end_write(outstream)))
|
|
|
|
panic("end write error: %s", soundio_strerror(err));
|
|
|
|
}
|
|
|
|
}
|
2015-07-29 20:02:17 +00:00
|
|
|
|
2015-08-05 04:57:46 +00:00
|
|
|
int read_count = min_int(frame_count_max, fill_count);
|
|
|
|
int frames_left = read_count;
|
|
|
|
|
|
|
|
while (frames_left > 0) {
|
|
|
|
int frame_count = frames_left;
|
|
|
|
|
2015-07-22 22:43:45 +00:00
|
|
|
if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count)))
|
|
|
|
panic("begin write error: %s", soundio_strerror(err));
|
|
|
|
|
|
|
|
if (frame_count <= 0)
|
|
|
|
break;
|
|
|
|
|
2015-07-24 20:26:46 +00:00
|
|
|
for (int frame = 0; frame < frame_count; frame += 1) {
|
2015-07-22 22:43:45 +00:00
|
|
|
for (int ch = 0; ch < outstream->layout.channel_count; ch += 1) {
|
|
|
|
memcpy(areas[ch].ptr, read_ptr, outstream->bytes_per_sample);
|
|
|
|
areas[ch].ptr += areas[ch].step;
|
|
|
|
read_ptr += outstream->bytes_per_sample;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-04 07:56:03 +00:00
|
|
|
if ((err = soundio_outstream_end_write(outstream)))
|
2015-07-22 22:43:45 +00:00
|
|
|
panic("end write error: %s", soundio_strerror(err));
|
2015-08-05 04:57:46 +00:00
|
|
|
|
|
|
|
frames_left -= frame_count;
|
2015-07-22 22:43:45 +00:00
|
|
|
}
|
|
|
|
|
2015-08-05 04:57:46 +00:00
|
|
|
soundio_ring_buffer_advance_read_ptr(ring_buffer, read_count * outstream->bytes_per_frame);
|
2015-07-06 08:05:22 +00:00
|
|
|
}
|
|
|
|
|
2015-07-24 04:07:40 +00:00
|
|
|
static void underflow_callback(struct SoundIoOutStream *outstream) {
|
2015-07-25 01:43:14 +00:00
|
|
|
static int count = 0;
|
|
|
|
fprintf(stderr, "underflow %d\n", ++count);
|
2015-07-24 04:07:40 +00:00
|
|
|
}
|
|
|
|
|
2015-07-22 22:43:45 +00:00
|
|
|
static int usage(char *exe) {
|
2015-08-25 01:10:09 +00:00
|
|
|
fprintf(stderr, "Usage: %s [options]\n"
|
|
|
|
"Options:\n"
|
|
|
|
" [--backend dummy|alsa|pulseaudio|jack|coreaudio|wasapi]\n"
|
|
|
|
" [--in-device id]\n"
|
|
|
|
" [--in-raw]\n"
|
|
|
|
" [--out-device id]\n"
|
|
|
|
" [--out-raw]\n"
|
|
|
|
, exe);
|
2015-07-22 22:43:45 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-07-06 08:05:22 +00:00
|
|
|
int main(int argc, char **argv) {
|
2015-07-22 22:43:45 +00:00
|
|
|
char *exe = argv[0];
|
|
|
|
enum SoundIoBackend backend = SoundIoBackendNone;
|
2015-07-30 17:26:36 +00:00
|
|
|
char *in_device_id = NULL;
|
|
|
|
char *out_device_id = NULL;
|
2015-08-25 01:10:09 +00:00
|
|
|
bool in_raw = false;
|
|
|
|
bool out_raw = false;
|
2015-07-22 22:43:45 +00:00
|
|
|
for (int i = 1; i < argc; i += 1) {
|
|
|
|
char *arg = argv[i];
|
2015-08-25 01:10:09 +00:00
|
|
|
if (arg[0] == '-' && arg[1] == '-') {
|
|
|
|
if (strcmp(arg, "--in-raw") == 0) {
|
|
|
|
in_raw = true;
|
|
|
|
} else if (strcmp(arg, "--out-raw") == 0) {
|
|
|
|
out_raw = true;
|
|
|
|
} else if (++i >= argc) {
|
2015-07-24 03:55:36 +00:00
|
|
|
return usage(exe);
|
2015-08-25 01:10:09 +00:00
|
|
|
} else if (strcmp(arg, "--backend") == 0) {
|
|
|
|
if (strcmp("dummy", argv[i]) == 0) {
|
|
|
|
backend = SoundIoBackendDummy;
|
|
|
|
} else if (strcmp("alsa", argv[i]) == 0) {
|
|
|
|
backend = SoundIoBackendAlsa;
|
|
|
|
} else if (strcmp("pulseaudio", argv[i]) == 0) {
|
|
|
|
backend = SoundIoBackendPulseAudio;
|
|
|
|
} else if (strcmp("jack", argv[i]) == 0) {
|
|
|
|
backend = SoundIoBackendJack;
|
|
|
|
} else if (strcmp("coreaudio", argv[i]) == 0) {
|
|
|
|
backend = SoundIoBackendCoreAudio;
|
|
|
|
} else if (strcmp("wasapi", argv[i]) == 0) {
|
|
|
|
backend = SoundIoBackendWasapi;
|
|
|
|
} else {
|
|
|
|
fprintf(stderr, "Invalid backend: %s\n", argv[i]);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
} else if (strcmp(arg, "--in-device") == 0) {
|
2015-07-30 17:26:36 +00:00
|
|
|
in_device_id = argv[i];
|
2015-08-25 01:10:09 +00:00
|
|
|
} else if (strcmp(arg, "--out-device") == 0) {
|
2015-07-30 17:26:36 +00:00
|
|
|
out_device_id = argv[i];
|
2015-08-25 01:10:09 +00:00
|
|
|
} else {
|
|
|
|
return usage(exe);
|
2015-07-24 03:55:36 +00:00
|
|
|
}
|
2015-07-22 22:43:45 +00:00
|
|
|
} else {
|
|
|
|
return usage(exe);
|
|
|
|
}
|
|
|
|
}
|
2015-07-06 08:05:22 +00:00
|
|
|
struct SoundIo *soundio = soundio_create();
|
|
|
|
if (!soundio)
|
|
|
|
panic("out of memory");
|
|
|
|
|
2015-07-22 22:43:45 +00:00
|
|
|
int err = (backend == SoundIoBackendNone) ?
|
|
|
|
soundio_connect(soundio) : soundio_connect_backend(soundio, backend);
|
2015-07-30 04:50:12 +00:00
|
|
|
if (err)
|
|
|
|
panic("error connecting: %s", soundio_strerror(err));
|
|
|
|
|
2015-08-02 05:10:43 +00:00
|
|
|
soundio_flush_events(soundio);
|
2015-07-06 08:05:22 +00:00
|
|
|
|
2015-07-24 03:55:36 +00:00
|
|
|
int default_out_device_index = soundio_default_output_device_index(soundio);
|
2015-07-06 08:05:22 +00:00
|
|
|
if (default_out_device_index < 0)
|
|
|
|
panic("no output device found");
|
|
|
|
|
2015-07-24 03:55:36 +00:00
|
|
|
int default_in_device_index = soundio_default_input_device_index(soundio);
|
2015-07-06 08:05:22 +00:00
|
|
|
if (default_in_device_index < 0)
|
|
|
|
panic("no output device found");
|
|
|
|
|
2015-07-24 03:55:36 +00:00
|
|
|
int in_device_index = default_in_device_index;
|
2015-07-30 17:26:36 +00:00
|
|
|
if (in_device_id) {
|
2015-07-24 03:55:36 +00:00
|
|
|
bool found = false;
|
|
|
|
for (int i = 0; i < soundio_input_device_count(soundio); i += 1) {
|
|
|
|
struct SoundIoDevice *device = soundio_get_input_device(soundio, i);
|
2015-08-25 01:10:09 +00:00
|
|
|
if (device->is_raw == in_raw && strcmp(device->id, in_device_id) == 0) {
|
2015-07-24 03:55:36 +00:00
|
|
|
in_device_index = i;
|
|
|
|
found = true;
|
|
|
|
soundio_device_unref(device);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
soundio_device_unref(device);
|
|
|
|
}
|
|
|
|
if (!found)
|
2015-07-30 17:26:36 +00:00
|
|
|
panic("invalid input device id: %s", in_device_id);
|
2015-07-24 03:55:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int out_device_index = default_out_device_index;
|
2015-07-30 17:26:36 +00:00
|
|
|
if (out_device_id) {
|
2015-07-24 03:55:36 +00:00
|
|
|
bool found = false;
|
|
|
|
for (int i = 0; i < soundio_output_device_count(soundio); i += 1) {
|
|
|
|
struct SoundIoDevice *device = soundio_get_output_device(soundio, i);
|
2015-08-25 01:10:09 +00:00
|
|
|
if (device->is_raw == out_raw && strcmp(device->id, out_device_id) == 0) {
|
2015-07-24 03:55:36 +00:00
|
|
|
out_device_index = i;
|
|
|
|
found = true;
|
|
|
|
soundio_device_unref(device);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
soundio_device_unref(device);
|
|
|
|
}
|
|
|
|
if (!found)
|
2015-07-30 17:26:36 +00:00
|
|
|
panic("invalid output device id: %s", out_device_id);
|
2015-07-24 03:55:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct SoundIoDevice *out_device = soundio_get_output_device(soundio, out_device_index);
|
2015-07-06 08:05:22 +00:00
|
|
|
if (!out_device)
|
|
|
|
panic("could not get output device: out of memory");
|
|
|
|
|
2015-07-24 03:55:36 +00:00
|
|
|
struct SoundIoDevice *in_device = soundio_get_input_device(soundio, in_device_index);
|
2015-07-06 08:05:22 +00:00
|
|
|
if (!in_device)
|
|
|
|
panic("could not get input device: out of memory");
|
|
|
|
|
2015-07-30 17:26:36 +00:00
|
|
|
fprintf(stderr, "Input device: %s\n", in_device->name);
|
|
|
|
fprintf(stderr, "Output device: %s\n", out_device->name);
|
2015-07-06 08:05:22 +00:00
|
|
|
|
2015-07-13 16:17:20 +00:00
|
|
|
soundio_device_sort_channel_layouts(out_device);
|
|
|
|
const struct SoundIoChannelLayout *layout = soundio_best_matching_channel_layout(
|
|
|
|
out_device->layouts, out_device->layout_count,
|
|
|
|
in_device->layouts, in_device->layout_count);
|
|
|
|
|
|
|
|
if (!layout)
|
2015-07-07 00:16:03 +00:00
|
|
|
panic("channel layouts not compatible");
|
|
|
|
|
2015-08-08 21:44:31 +00:00
|
|
|
int *sample_rate;
|
|
|
|
for (sample_rate = prioritized_sample_rates; *sample_rate; sample_rate += 1) {
|
|
|
|
if (soundio_device_supports_sample_rate(in_device, *sample_rate) &&
|
|
|
|
soundio_device_supports_sample_rate(out_device, *sample_rate))
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!*sample_rate)
|
2015-07-13 16:59:42 +00:00
|
|
|
panic("incompatible sample rates");
|
|
|
|
|
|
|
|
enum SoundIoFormat *fmt;
|
|
|
|
for (fmt = prioritized_formats; *fmt != SoundIoFormatInvalid; fmt += 1) {
|
|
|
|
if (soundio_device_supports_format(in_device, *fmt) &&
|
|
|
|
soundio_device_supports_format(out_device, *fmt))
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (*fmt == SoundIoFormatInvalid)
|
|
|
|
panic("incompatible sample formats");
|
|
|
|
|
2015-07-13 16:17:20 +00:00
|
|
|
struct SoundIoInStream *instream = soundio_instream_create(in_device);
|
|
|
|
if (!instream)
|
|
|
|
panic("out of memory");
|
2015-07-13 16:59:42 +00:00
|
|
|
instream->format = *fmt;
|
2015-08-08 21:44:31 +00:00
|
|
|
instream->sample_rate = *sample_rate;
|
2015-07-13 16:17:20 +00:00
|
|
|
instream->layout = *layout;
|
2015-08-14 05:54:15 +00:00
|
|
|
instream->software_latency = microphone_latency;
|
2015-07-13 16:17:20 +00:00
|
|
|
instream->read_callback = read_callback;
|
|
|
|
|
2015-08-25 00:42:57 +00:00
|
|
|
if ((err = soundio_instream_open(instream))) {
|
|
|
|
fprintf(stderr, "unable to open input stream: %s", soundio_strerror(err));
|
|
|
|
return 1;
|
|
|
|
}
|
2015-07-07 00:16:03 +00:00
|
|
|
|
2015-07-13 16:17:20 +00:00
|
|
|
struct SoundIoOutStream *outstream = soundio_outstream_create(out_device);
|
|
|
|
if (!outstream)
|
|
|
|
panic("out of memory");
|
2015-07-13 16:59:42 +00:00
|
|
|
outstream->format = *fmt;
|
2015-08-08 21:44:31 +00:00
|
|
|
outstream->sample_rate = *sample_rate;
|
2015-07-13 16:17:20 +00:00
|
|
|
outstream->layout = *layout;
|
2015-08-14 05:54:15 +00:00
|
|
|
outstream->software_latency = microphone_latency;
|
2015-07-13 16:17:20 +00:00
|
|
|
outstream->write_callback = write_callback;
|
2015-07-24 04:07:40 +00:00
|
|
|
outstream->underflow_callback = underflow_callback;
|
2015-07-06 08:05:22 +00:00
|
|
|
|
2015-08-25 00:42:57 +00:00
|
|
|
if ((err = soundio_outstream_open(outstream))) {
|
|
|
|
fprintf(stderr, "unable to open output stream: %s", soundio_strerror(err));
|
|
|
|
return 1;
|
|
|
|
}
|
2015-07-06 08:05:22 +00:00
|
|
|
|
2015-07-30 04:50:12 +00:00
|
|
|
int capacity = microphone_latency * 2 * instream->sample_rate * instream->bytes_per_frame;
|
2015-07-22 22:43:45 +00:00
|
|
|
ring_buffer = soundio_ring_buffer_create(soundio, capacity);
|
|
|
|
if (!ring_buffer)
|
|
|
|
panic("unable to create ring buffer: out of memory");
|
2015-07-29 20:02:17 +00:00
|
|
|
char *buf = soundio_ring_buffer_write_ptr(ring_buffer);
|
2015-07-30 04:50:12 +00:00
|
|
|
int fill_count = microphone_latency * outstream->sample_rate * outstream->bytes_per_frame;
|
2015-07-29 20:02:17 +00:00
|
|
|
memset(buf, 0, fill_count);
|
|
|
|
soundio_ring_buffer_advance_write_ptr(ring_buffer, fill_count);
|
2015-07-22 22:43:45 +00:00
|
|
|
|
2015-07-13 16:17:20 +00:00
|
|
|
if ((err = soundio_instream_start(instream)))
|
2015-07-10 09:21:47 +00:00
|
|
|
panic("unable to start input device: %s", soundio_strerror(err));
|
2015-07-06 08:05:22 +00:00
|
|
|
|
2015-07-13 16:17:20 +00:00
|
|
|
if ((err = soundio_outstream_start(outstream)))
|
2015-07-10 09:21:47 +00:00
|
|
|
panic("unable to start output device: %s", soundio_strerror(err));
|
2015-07-06 08:05:22 +00:00
|
|
|
|
|
|
|
for (;;)
|
|
|
|
soundio_wait_events(soundio);
|
|
|
|
|
2015-07-13 16:17:20 +00:00
|
|
|
soundio_outstream_destroy(outstream);
|
|
|
|
soundio_instream_destroy(instream);
|
2015-07-06 08:05:22 +00:00
|
|
|
soundio_device_unref(in_device);
|
|
|
|
soundio_device_unref(out_device);
|
|
|
|
soundio_destroy(soundio);
|
|
|
|
return 0;
|
|
|
|
}
|