id: audio_sink
label: Audio Sink
category: '[Core]/Audio'
flags: [ throttle, python, cpp ]

parameters:
-   id: samp_rate
    label: Sample Rate
    dtype: int
    default: samp_rate
    options: ['16000', '22050', '24000', '32000', '44100', '48000', '96000', '192000']
    option_labels: [16 kHz, 22.05 kHz, 24 kHz, 32 kHz, 44.1 kHz, 48 kHz, 96 kHz, 192 kHz]
-   id: device_name
    label: Device Name
    dtype: string
    hide: ${ ('none' if device_name else 'part') }
-   id: ok_to_block
    label: OK to Block
    dtype: enum
    default: 'True'
    options: ['True', 'False']
    option_labels: ['Yes', 'No']
    hide: part
-   id: num_inputs
    label: Num Inputs
    dtype: int
    default: '1'
    hide: part

inputs:
-   domain: stream
    dtype: float
    multiplicity: ${ num_inputs }

asserts:
- ${ 0 < num_inputs }

templates:
    imports: from gnuradio import audio
    make: audio.sink(${samp_rate}, ${device_name}, ${ok_to_block})

cpp_templates:
    includes: [ '#include <gnuradio/audio/sink.h>' ]
    declarations: 'audio::sink::sptr ${id};'
    make: 'this->${id} = audio::sink::make(${samp_rate}, ${device_name}, ${ok_to_block});'
    link: ['gnuradio::gnuradio-audio']

documentation: |-
    Not all sampling rates will be supported by your hardware.

    Leave the device name blank to choose default audio device. ALSA users with audio trouble may try setting the device name to plughw:0,0

    The audio sink can have multiple inputs depending upon your hardware. For example, set the inputs to 2 for stereo audio.

file_format: 1
