JunkBox_Win_Lib 1.5.3
Loading...
Searching...
No Matches
KinectAudio.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef ENABLE_KINECT_SDK
4
5
6#include "WinAudioStream.h"
7
8#include <NuiApi.h>
9#include <mfapi.h> // IPropertyStore
10#include <wmcodecdsp.h> // MFPKEY_WMAAECMA_SYSTEM_MODE
11#include <uuids.h> // FORMAT_WaveFormatEx
12
13
14// Lib
15#pragma comment(lib, "Msdmo.lib")
16#pragma comment(lib, "amstrmid.lib")
17#pragma comment(lib, "Kinect10.lib")
18
19
20#define KINECT_AUDIO_SINGLE_AEC 0
21#define KINECT_AUDIO_ARRAY 2
22#define KINECT_AUDIO_ARRAY_AEC 4
23#define KINECT_AUDIO_SINGLE 5
24
25
26//
27namespace jbxwl {
28
29
30
31// Audio Parameters
32static const WORD KinectAudioFormat = WAVE_FORMAT_PCM;
33static const WORD KinectAudioChannels = 1;
34static const DWORD KinectAudioSamplesPerSec = 16000;
35static const WORD KinectAudioBitsPerSample = 16;
36
37//static const WORD KinectAudioBlockAlign = 2;
38//static const DWORD KinectAudioAverageBytesPerSec = 32000;
39
40
41class CKinectAudio
42{
43public:
44 //
45 CKinectAudio(INuiSensor* sensor=NULL, int mode=KINECT_AUDIO_SINGLE_AEC);
46 virtual ~CKinectAudio(void);
47
48 BOOL init(INuiSensor* sensor, int mode=KINECT_AUDIO_SINGLE_AEC);
49 void free(void);
50 IStream* getIStream(void) { return m_pStream;}
51
52 //
53 BOOL setProperty(int mode);
54 BOOL setMediaType(void);
55
56 BOOL startCapture(void) { if (m_audioStream!=NULL) return m_audioStream->startCapture(); else return FALSE;}
57 void stopCapture(void) { if (m_audioStream!=NULL) m_audioStream->stopCapture(); }
58
59 Buffer getAudioData(void) { if (m_audioStream!=NULL) return m_audioStream->input(); else return init_Buffer();} // not free
60 void getAudioData(Buffer* pbuf);
61
62 //
63 BOOL openOutput(void) { if (m_audioStream!=NULL) return m_audioStream->openOutput(); else return FALSE;}
64 void closeOutput(void) { if (m_audioStream!=NULL) m_audioStream->closeOutput();}
65
66public:
67 //
68 WAVEFORMATEX getAudioFormat(void);
69
70private:
71 //
72 CWinAudioStream* m_audioStream;
73
74 INuiAudioBeam* m_audioSource;
75 IMediaObject* m_audioMedia;
76 IPropertyStore* m_audioProperty;
77 IStream* m_pStream;
78
79private:
80 // コピーしないで参照を返す
81 CKinectAudio& operator = (CKinectAudio& rhs) { return rhs;}
82
83};
84
85
86} // namespace
87
88#endif
オーディオストリーム ヘッダ