forked from microsoft/Xbox-ATG-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CBuffer.h
43 lines (35 loc) · 1.1 KB
/
CBuffer.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
42
43
//--------------------------------------------------------------------------------------
// CBuffer.h
//
// Circular buffer
//
// Advanced Technology Group (ATG)
// Copyright (C) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#pragma once
#include <Mmreg.h>
#include "Common.h"
class CBuffer
{
public:
CBuffer(uint32_t size);
virtual ~CBuffer();
void GetCaptureBuffer(uint32_t numBytesRequested, byte *data);
void SetCaptureBuffer(uint32_t numBytesGiven, byte *data);
void SetSourceFormat(WAVEFORMATEX* sourceWfx);
void SetRenderFormat(WAVEFORMATEX* renderWfx);
uint32_t GetCurrentUsage(){ return m_size - m_free;};
private:
void AllocateSize(uint32_t inSize);
void SetFormatCalculations();
WAVEFORMATEX m_sourceFormat;
WAVEFORMATEX m_renderFormat;
byte* m_buffer;
uint32_t m_size;
uint32_t m_front;
uint32_t m_back;
uint32_t m_free;
CRITICAL_SECTION m_critSec;
int m_sourceSampleSize;
int m_renderSampleSize;
};