summaryrefslogtreecommitdiff
path: root/audio/tests/wavetest/PreComp.h
blob: 2044d6b12e1eb1e9192d00aa3cef0063311cb583 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// ------------------------------------------------------------------------------
//
// Copyright (C) Microsoft. All rights reserved.
//
// File Name:
//
//  PreComp.h
//
// Abstract:
//
//  Precompiled common headers
//
// -------------------------------------------------------------------------------

#include <basiclog.h>
#include <BasicLogHelper.h>
#include <mmsystem.h>
#include <atlbase.h>
#include <atlcom.h>
#include <initguid.h>

#include <AudioEngineEndpoint.h>
#include <AudioEngineEndpointP.h>
#include <Audioclient.h>
#include <mmdeviceapi.h>
#include <mmdeviceapip.h>
#include <devicetopology.h>
#include <devicetopologyp.h> 
#include <propvarutil.h>

#include <wil\com.h>

#include <winioctl.h>
#include <KsLib.h>
#include <Waveutil.h>
#include <aecommon.h>
#include <ilog.h>
#include <shlflags.h>
#include <basicprintf.h>
#include <wextestclass.h>
#include <resourcelist.h>

// ------------------------------------------------------------------------------
// Log
#define LOG(log, ...) BasicLogPrintf( log, XMSG, 1, __VA_ARGS__ )
#define SKIP(log, ...) BasicLogPrintf( log, XSKIP, 1, __VA_ARGS__ )
#define WARN(log, ...) BasicLogPrintf( log, XWARN, 1, __VA_ARGS__ )
#define BLOCK(log, ...) BasicLogPrintf( log, XBLOCK, 1, __VA_ARGS__ )
#define ERR(log, ...) BasicLogPrintf( log, XFAIL, 1, __VA_ARGS__ )

// ------------------------------------------------------------------------------
// Data flow
enum STACKWISE_DATAFLOW { render, capture };

// ------------------------------------------------------------------------------
// Structs used to hold results of format records
typedef struct
{
    WAVEFORMATEXTENSIBLE wfxEx;
    UINT32 fundamentalPeriodInFrames;
    UINT32 defaultPeriodInFrames;
    UINT32 minPeriodInFrames;
    UINT32 maxPeriodInFrames;
    UINT32 maxPeriodInFramesExtended;
} FORMAT_RECORD, *PFORMAT_RECORD;

// ----------------------------------------------------------
// Parameters for test sine tone
#define TEST_AMPLITUDE 1.0f
#define TEST_FREQUENCY 200.0f

// ----------------------------------------------------------
// Predefined format list for offload streaming
#define COUNT_FORMATS             4

static WAVEFORMATEXTENSIBLE ListofFormats[COUNT_FORMATS] =
{
    // 1
    {
        // Format
        {
            WAVE_FORMAT_EXTENSIBLE, // wFormatTag
            2, // nChannels
            44100, // nSamplesPerSec
            176400, // nAvgBytesPerSec
            4, // nBlockAlign
            16, // wBitsPerSample
            22 // cbSize
        },
        // Samples
        {
            16 // wValidBitsPerSample
        },
        KSAUDIO_SPEAKER_STEREO, // dwChannelMask
        KSDATAFORMAT_SUBTYPE_PCM // SubFormat
    },
    // 2
    {
        // Format
        {
            WAVE_FORMAT_EXTENSIBLE, // wFormatTag
            2, // nChannels
            48000, // nSamplesPerSec
            192000, // nAvgBytesPerSec
            4, // nBlockAlign
            16, // wBitsPerSample
            22 // cbSize
        },
        // Samples
        {
            16 // wValidBitsPerSample
        },
        KSAUDIO_SPEAKER_STEREO, // dwChannelMask
        KSDATAFORMAT_SUBTYPE_PCM // SubFormat
    },
    // 3
    {
        // Format
        {
            WAVE_FORMAT_EXTENSIBLE, // wFormatTag
            2, // nChannels
            88200, // nSamplesPerSec
            352800, // nAvgBytesPerSec
            4, // nBlockAlign
            16, // wBitsPerSample
            22 // cbSize
        },
        // Samples
        {
            16 // wValidBitsPerSample
        },
        KSAUDIO_SPEAKER_STEREO, // dwChannelMask
        KSDATAFORMAT_SUBTYPE_PCM // SubFormat
    },
    // 4
    {
        // Format
        {
            WAVE_FORMAT_EXTENSIBLE, // wFormatTag
            2, // nChannels
            96000, // nSamplesPerSec
            384000, // nAvgBytesPerSec
            4, // nBlockAlign
            16, // wBitsPerSample
            22 // cbSize
        },
        // Samples
        {
            16 // wValidBitsPerSample
        },
        KSAUDIO_SPEAKER_STEREO, // dwChannelMask
        KSDATAFORMAT_SUBTYPE_PCM // SubFormat
    },
};