summaryrefslogtreecommitdiff
path: root/engine/audio/private/vox_private.h
blob: cd29c05794308db2148dfa6a5cb44c72b09c6453 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $Workfile:     $
// $Date:         $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//

#ifndef VOX_PRIVATE_H
#define VOX_PRIVATE_H
#pragma once

#ifndef VOX_H
#include "vox.h"
#endif

#ifndef UTLVECTOR_H
#include "utlvector.h"
#endif

#include "utlsymbol.h"

struct channel_t;
class CSfxTable;
class CAudioMixer;

struct voxword_t
{
	int		volume;						// increase percent, ie: 125 = 125% increase
	int		pitch;						// pitch shift up percent
	int		start;						// offset start of wave percent
	int		end;						// offset end of wave percent
	int		cbtrim;						// end of wave after being trimmed to 'end'
	int		fKeepCached;				// 1 if this word was already in cache before sentence referenced it
	int		samplefrac;					// if pitch shifting, this is position into wav * 256
	int		timecompress;				// % of wave to skip during playback (causes no pitch shift)
	CSfxTable *sfx;					// name and cache pointer
};

#define CVOXWORDMAX		32
#define CVOXZEROSCANMAX	255			// scan up to this many samples for next zero crossing

struct sentence_t
{
	sentence_t() :
		pName( 0 ),
		length( 0.0f ),
		closecaption( false )
	{
	}

	char		*pName;
	float		length;
	bool		closecaption : 7;
	bool		isPrecached : 1;
	CUtlSymbol	caption;
};

extern CUtlVector<sentence_t>	g_Sentences;


extern int				VOX_FPaintPitchChannelFrom8( channel_t *ch, sfxcache_t *sc, int count, int pitch, int timecompress );
extern void				VOX_TrimStartEndTimes( channel_t *ch, sfxcache_t *sc );
extern int				VOX_ParseWordParams( char *psz, voxword_t *pvoxword, int fFirst );
extern void				VOX_SetChanVol( channel_t *ch );
extern char				**VOX_ParseString( char *psz );
extern CAudioMixer		*CreateSentenceMixer( voxword_t *pwords );

#endif // VOX_PRIVATE_H