Example #1
0
/*
    This program prints the currently connected audio devices.

    The output consists of device declarations separated by blank lines.

    An example device declaration:

        Name:           Built-in Microphone
        Host:           Core Audio
        Input:          2
        Output:         0

 */
void print_device(fa_audio_device_t x)
{
    fa_print("Name: %s\n", fa_audio_name(x));
    // fa_print("Name length: %d\n", fa_string_length(fa_audio_name(x)));
    fa_print("In:   %s\n", fa_i16(fa_audio_input_channels(x)));
    fa_print("Out:  %s\n", fa_i16(fa_audio_output_channels(x)));
    fa_print("Host: %s\n", fa_audio_host_name(x));
    fa_print("Rate: %s\n", fa_f64(fa_audio_default_sample_rate(x)));
    fa_print_ln(fa_string(""));
}
Example #2
0
inline static stream_t new_stream(device_t input, device_t output, double sample_rate, long max_buffer_size)
{
    stream_t stream         = fa_new(audio_stream);

    stream->impl            = &audio_stream_impl;

    stream->input           = input;
    stream->output          = output;
    stream->input_channels  = fa_audio_input_channels(input);
    stream->output_channels = fa_audio_output_channels(output);

    stream->sample_rate     = sample_rate;
    stream->max_buffer_size = max_buffer_size;

    stream->signal_count    = 0;
    stream->sample_count    = 0;

    stream->in_controls     = atomic_queue();
    stream->controls        = priority_queue();

    return stream;
}