blob: a335507695b8238327be2677278c1fc5c87d14e3 (
plain) (
blame)
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
67
68
69
70
71
72
73
74
75
76
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//=============================================================================//
#ifndef SND_WAVE_SOURCE_H
#define SND_WAVE_SOURCE_H
#ifdef _WIN32
#pragma once
#endif
#include "soundsystem/snd_audio_source.h"
#include "sentence.h"
class IterateRIFF;
class CAudioSourceWave : public CAudioSource
{
public:
CAudioSourceWave( void );
~CAudioSourceWave( void );
void Setup( const char *pFormat, int formatSize, IterateRIFF &walk );
virtual int SampleRate( void ) { return m_rate; }
inline int SampleSize( void ) { return m_sampleSize; }
virtual float TrueSampleSize( void );
void *GetHeader( void );
// Legacy
virtual void ParseChunk( IterateRIFF &walk, int chunkName );
virtual void ParseSentence( IterateRIFF &walk );
void ConvertSamples( char *pData, int sampleCount );
bool IsLooped( void ) { return (m_loopStart >= 0) ? true : false; }
bool IsStreaming( void ) { return false; }
int ConvertLoopedPosition( int samplePosition );
int SampleCount( void );
virtual float GetRunningLength( void )
{
if ( m_rate > 0.0 )
{
return (float)SampleCount() / m_rate;
}
return 0.0f; }
CSentence *GetSentence( void );
protected:
// returns the loop start from a cue chunk
int ParseCueChunk( IterateRIFF &walk );
void Init( const char *pHeaderBuffer, int headerSize );
int m_bits;
int m_rate;
int m_channels;
int m_format;
int m_sampleSize;
int m_loopStart;
int m_sampleCount;
private:
char *m_pHeader;
CSentence m_Sentence;
};
#endif // SND_WAVE_SOURCE_H
|