; =========================================================================
; B520 DOA estimation
; =========================================================================
; Input:  3-channel mic signal (Top, Right, Left)
;         Ordered as in Siri DSPG, but without the fist channel (Bottom).
;         Corresponds to channels (8, 9, 10) at Siri DSPG output (1-based indexing).
;
; Output: 1-channel DOA beamformer output

graphName "doa"

; -------------------------------------------------------------------------
; Definitions
; -------------------------------------------------------------------------

[def sampleRate 16000]
[def blockSize 512]
[def numBeams 72]
[def numMics 4]

in input
out output

; -------------------------------------------------------------------------
; Boxes
; -------------------------------------------------------------------------

box ANALY_INPUT       fft        1 1
box ZERO        (aufx cnst abox) 0 1
box BF          (aufx bmfd appl) 2 4
box SYNTH_bfOut       fft        1 1
box BFDeadEnd         dead       3 0

; -------------------------------------------------------------------------
; DSP Graph topology
; -------------------------------------------------------------------------

; Analysis
wire input ANALY_INPUT ([sampleRate] [numMics] [blockSize])

; Beamformer input
wire ANALY_INPUT (BF 0) (freq [sampleRate] [numMics] [blockSize])
wire ZERO        (BF 1) (freq [sampleRate] [numMics] [blockSize])

; Beamformer output
wire (BF 0) SYNTH_bfOut   (freq [sampleRate]     1      [blockSize])
wire (BF 1) (BFDeadEnd 0) (freq [sampleRate]     1      [blockSize])
wire (BF 2) (BFDeadEnd 1) (freq [sampleRate] [numBeams] [blockSize])
wire (BF 3) (BFDeadEnd 2) (freq [sampleRate] [numBeams] [blockSize])

; Output bus
wire SYNTH_bfOut output ([sampleRate] 1 [blockSize])