-
Notifications
You must be signed in to change notification settings - Fork 0
/
CardioidSound.h
41 lines (35 loc) · 1.38 KB
/
CardioidSound.h
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
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#pragma once
#include <AudioFileReaderXaml12.h>
//
// Sound with Cardioid radiation pattern.
//
class CardioidSound
{
public:
virtual ~CardioidSound();
HRESULT Initialize(_In_ LPCWSTR filename);
HRESULT ConfigureApo(_In_ float scaling, _In_ float order);
HRESULT Start();
HRESULT Stop();
HRESULT OnUpdate(_In_ float x, _In_ float y, _In_ float z, _In_ float pitch, _In_ float yaw, _In_ float roll);
HRESULT SetEnvironment(_In_ HrtfEnvironment environment);
HrtfEnvironment GetEnvironment() { return _environment; }
private:
HrtfOrientation OrientationFromAngles(_In_ float pitch, _In_ float yaw, _In_ float roll);
private:
AudioFileReader _audioFile;
ComPtr<IXAudio2> _xaudio2;
IXAudio2SourceVoice* _sourceVoice = nullptr;
ComPtr<IXAPOHrtfParameters> _hrtfParams;
HrtfEnvironment _environment = HrtfEnvironment::Outdoors;
};