summaryrefslogtreecommitdiff
path: root/tests/unit/audio/receive_reference_probe.f90
blob: 71c43acddfafe5a255ae2e52c6744c814d096875 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
! Keep the production reference-spectrum implementation in this test.  This
! bridge only supplies its flags and the compiler-specific CHARACTER argument.
subroutine receive_reference_probe(id2,ninput) bind(C)
  use iso_c_binding, only: c_int16_t,c_int
  implicit none
  integer(c_int16_t) :: id2(*)
  integer(c_int), value :: ninput
  logical*1 :: clear, measure, apply

  clear=.false.
  measure=.true.
  apply=.false.
  ! One measurement per process: refspectrum writes a file every fourth call.
  call refspectrum(id2,ninput,clear,measure,apply,'unused-receive-reference.dat')
end subroutine

! Exercise the production filter-application path.  Build a deterministic,
! non-identity reference file in the test process so the write footprint is
! observable without relying on a user's writable-data directory.
subroutine receive_reference_apply_probe(id2,ninput) bind(C)
  use iso_c_binding, only: c_int16_t,c_int
  implicit none
  integer(c_int16_t) :: id2(*)
  integer(c_int), value :: ninput
  logical*1 :: clear, measure, apply
  integer :: i
  real :: frequency
  character(len=*), parameter :: path='receive-reference-apply.dat'

  open(16,file=path,status='replace')
  write(16,'(3i5,5e25.16)') 400,2600,5,0.d0,0.d0,0.d0,0.d0,0.d0
  do i=1,3456
     frequency=12000.0*i/6912.0
     write(16,'(f10.3,e12.3,f12.6,e12.3,f12.6)') &
          frequency,1.0,0.0,0.5,20.0*log10(0.5)
  enddo
  close(16)

  clear=.false.
  measure=.false.
  apply=.true.
  call refspectrum(id2,ninput,clear,measure,apply,path)
end subroutine