Alejandro Acuña
2024-08-12 1876e65234c20209001178705cfa50d8f9ded67a
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
// AudioSample.h: interface for the AudioSample class.
//
//////////////////////////////////////////////////////////////////////
 
#ifndef AFX_AUDIOSAMPLE_H__963A2A54_7AFE_4DE9_BF2A_1E79F911E37B__INCLUDED_
#define AFX_AUDIOSAMPLE_H__963A2A54_7AFE_4DE9_BF2A_1E79F911E37B__INCLUDED_
 
#include <windows.h>    // required by mmsystem.h
#include <mmsystem.h>   // required for WAVEFORMATEX structure
 
#include "WaveFormats.h"
#include "TraceUser.h"
 
// #define DEBUG_AUDIOSAMPLES
 
class AudioSampleManager;
class RTPPacket;
 
class AudioSample :
    public TraceUser
{
friend class AudioSampleManager;
public:
    virtual ~AudioSample();
    bool operator <  (AudioSample &);
    bool operator >= (AudioSample &);
    int GetFormat(WAVEFORMATEX *waveFormat);
    int SetFormat(WAVEFORMATEX &waveFormat);
    int BufferSize();
    int DataSize();
    int SilenceSize();
    int MinFrameDuration();
    int MinFrameSize();
    int SetDataSize(int dataSize);
    char * Data();
    int GetDuration();
    int SetSilenceDuration(int milliseconds);
    int GetSilenceDuration();
    RTPPacket* RTPHeader();
    int SetRTPHeader(RTPPacket *headerPtr);
    int AddRef(TraceUser *container);
    int Release(TraceUser *container);
protected:
    virtual int SetTraceLevel();
private:
    int AddRef();
    int Release();
    int Initialize(AudioSampleManager *manager, int size);
    int Uninitialize();
    AudioSample(AudioSampleManager *audioSampleManager, int size);
    AudioSample(AudioSampleManager *audioSampleManager);
private:
    WAVEFORMATEX format;
    int bufferSize;
    int dataSize;
    char *data;
    RTPPacket *rtpHeader;
    int refCount;
    int silenceLengthMilliseconds;
    AudioSampleManager *manager;
    int minFrameSize;       // no. of bytes in the minimum sized frame for this format
    int minFrameDuration;   // duration (in microseconds) of the minimum frame for this format
    CRITICAL_SECTION sampleMutex;
};
 
#endif // !defined(AFX_AUDIOSAMPLE_H__963A2A54_7AFE_4DE9_BF2A_1E79F911E37B__INCLUDED_)