id: fft_vxx
label: FFT
flags: [ python, cpp ]

parameters:
-   id: type
    label: Input Type
    dtype: enum
    options: [complex, float]
    option_attributes:
        fcn: [vcc, vfc]
    hide: part
-   id: fft_size
    label: FFT Size
    dtype: int
    default: '1024'
-   id: forward
    label: Forward/Reverse
    dtype: enum
    options: ['True', 'False']
    option_labels: [Forward, Reverse]
-   id: window
    label: Window
    dtype: real_vector
    default: window.blackmanharris(1024)
-   id: shift
    label: Shift
    dtype: enum
    options: ['True', 'False']
    option_labels: ['Yes', 'No']
-   id: nthreads
    label: Num. Threads
    dtype: int
    default: '1'

inputs:
-   domain: stream
    dtype: ${ type }
    vlen: ${ fft_size }

outputs:
-   domain: stream
    dtype: complex
    vlen: ${ fft_size }

templates:
    imports: |-
        from gnuradio import fft
        from gnuradio.fft import window
    make: |-
        % if type == "complex":
        fft.fft_vcc(${fft_size}, ${forward}, ${window}, ${shift}, ${nthreads})
        % else:
        fft.fft_vfc(${fft_size}, ${forward}, ${window}, ${shift}, ${nthreads})
        % endif
    callbacks:
    - set_nthreads(${nthreads})
    - set_window(${window})

cpp_templates:
    includes: [ '#include <gnuradio/fft/fft.h>', '#include <gnuradio/fft/fft_${type.fcn}.h>', '#include <gnuradio/fft/window.h>' ]
    declarations: 'fft::fft_${type.fcn}::sptr ${id};'
    make: |-
        % if type == "complex":
        this->${id} = fft::fft_vcc::make(${fft_size}, ${forward}, ${window}, ${shift}, ${nthreads});
        % else:
        this->${id} = fft::fft_vfc::make(${fft_size}, ${forward}, ${window}, ${shift}, ${nthreads});
        % endif
    link: ['gnuradio::gnuradio-fft']
    callbacks:
    - set_nthreads(${nthreads})
    - set_window(${window})
    translations:
        'window\.': 'fft::window::'

file_format: 1
