blob: d67eaca042442ca589b22093219410b8c2ff052f (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
//
// KWSApo.cpp -- Copyright (c) Microsoft Corporation. All rights reserved.
//
// Description:
//
// Implementation of ProcessBuffer
//
#include <atlbase.h>
#include <atlcom.h>
#include <atlcoll.h>
#include <atlsync.h>
#include <mmreg.h>
#include <audioenginebaseapo.h>
#include <baseaudioprocessingobject.h>
#include <resource.h>
#include <float.h>
#include "KWSApo.h"
#pragma AVRT_CODE_BEGIN
void WriteSilence(
_Out_writes_(u32FrameCount * u32SamplesPerFrame)
FLOAT32 *pf32Frames,
UINT32 u32FrameCount,
UINT32 u32SamplesPerFrame )
{
ZeroMemory(pf32Frames, sizeof(FLOAT32) * u32FrameCount * u32SamplesPerFrame);
}
#pragma AVRT_CODE_END
#pragma AVRT_CODE_BEGIN
void ProcessBuffer(
FLOAT32 *pf32OutputFrames,
const FLOAT32 *pf32InputFrames,
UINT32 u32ValidFrameCount,
INTERLEAVED_AUDIO_FORMAT_INFORMATION *formatInfo)
{
UINT32 totalChannelCount = (formatInfo->PrimaryChannelCount + formatInfo->InterleavedChannelCount);
ASSERT_REALTIME();
ATLASSERT( IS_VALID_TYPED_READ_POINTER(pf32InputFrames) );
ATLASSERT( IS_VALID_TYPED_WRITE_POINTER(pf32OutputFrames) );
// loop through samples
while (u32ValidFrameCount--)
{
// copy over the Primary channel data
for (UINT32 i = formatInfo->PrimaryChannelStartPosition; i < (formatInfo->PrimaryChannelStartPosition + formatInfo->PrimaryChannelCount); i++)
{
*pf32OutputFrames = *(pf32InputFrames + i);
pf32OutputFrames++;
}
// step forward to the next frame, ignoring interleaved data
pf32InputFrames += (totalChannelCount);
}
}
#pragma AVRT_CODE_END
|