JunkBox_Win_Lib 1.5.3
Loading...
Searching...
No Matches
WinAudioTool.h
Go to the documentation of this file.
1#pragma once
2
3/*
4一般のマイク用オーディオツール
5
6WinAudioStream.h を使用する.
7
8作成中
9参考  KinectAudio
10
11*/
12
13#include "WinAudioStream.h"
14
15#include <mfapi.h> // IPropertyStore
16#include <wmcodecdsp.h> // MFPKEY_WMAAECMA_SYSTEM_MODE
17#include <uuids.h> // FORMAT_WaveFormatEx
18
19
20// Lib
21#pragma comment(lib, "Msdmo.lib")
22#pragma comment(lib, "amstrmid.lib")
23
24
25//
26namespace jbxwl {
27
28
29// Audio Parameters
30static const WORD WinAudioToolFormat = WAVE_FORMAT_PCM;
31static const WORD WinAudioToolChannels = 1;
32static const DWORD WinAudioToolSamplesPerSec = 16000;
33static const WORD WinAudioToolBitsPerSample = 16;
34
35//static const WORD WinAudioToolBlockAlign = 2;
36//static const DWORD WinAudioToolAverageBytesPerSec = 32000;
37
38
39
41{
42public:
43 //
44 CWinAudioTool(void);
45 virtual ~CWinAudioTool(void);
46
47 BOOL init(void);
48 void free(void);
49 IStream* getIStream(void) { return m_pStream;}
50
51// BOOL setProperty(int mode);
52 BOOL setMediaType(void);
53
54 BOOL startCapture(void) { if (m_audioStream!=NULL) return m_audioStream->startCapture(); else return FALSE;}
55 void stopCapture(void) { if (m_audioStream!=NULL) m_audioStream->stopCapture(); }
56
57 Buffer getAudioData(void) { if (m_audioStream!=NULL) return m_audioStream->input(); else return init_Buffer();} // not free
58 void getAudioData(Buffer* pbuf);
59
60 //
61 BOOL openOutput(void) { if (m_audioStream!=NULL) return m_audioStream->openOutput(); else return FALSE;}
63
64public:
65 //
66 WAVEFORMATEX getAudioFormat(void);
67
68private:
69 //
71
72 IMediaObject* m_audioMedia;
73 IPropertyStore* m_audioProperty;
74 IStream* m_pStream;
75
76private:
77 // コピーしないで参照を返す
79
80};
81
82
83} // namespace
84
オーディオストリーム ヘッダ
BOOL startCapture(WAVEFORMATEX *format=NULL)
BOOL openOutput(ULONG bufcount=100, WAVEFORMATEX *format=NULL)
BOOL startCapture(void)
virtual ~CWinAudioTool(void)
IPropertyStore * m_audioProperty
CWinAudioTool & operator=(CWinAudioTool &rhs)
WAVEFORMATEX getAudioFormat(void)
IStream * getIStream(void)
CWinAudioStream * m_audioStream
Buffer getAudioData(void)
IMediaObject * m_audioMedia
static const WORD WinAudioToolFormat
static const DWORD WinAudioToolSamplesPerSec
static const WORD WinAudioToolChannels
static const WORD WinAudioToolBitsPerSample