Ejemplo n.º 1
0
// precache methods
bool CEngineTool::PrecacheSound( const char *pName, bool bPreload )
{
	if ( pName && TestSoundChar( pName, CHAR_SENTENCE ) )
		return true;

	bool bState = networkStringTableContainerServer->Lock( false );
	int flags = bPreload ? RES_PRELOAD : 0;
	int i = sv.PrecacheSound( pName, flags );
	networkStringTableContainerServer->Lock( bState );
	return i >= 0;
}
//-----------------------------------------------------------------------------
// Purpose: Simple wrapper to crack naming convention and create the proper wave source
// Input  : *pName - WAVE filename
// Output : CAudioSource
//-----------------------------------------------------------------------------
CAudioSource *AudioSource_Create( const char *pName )
{
	if ( !pName )
		return NULL;

//	if ( TestSoundChars(pName, CHAR_SENTENCE) )		// sentence
		;

	// Names that begin with CHAR_STREAM are streaming.
	// Skip over the CHAR_STREAM and create a streamed source
	if ( TestSoundChar( pName, CHAR_STREAM ) )		// stream
		return Audio_CreateStreamedWave( PSkipSoundChars(pName) );

	// These are loaded into memory directly
	return Audio_CreateMemoryWave( PSkipSoundCars(pName) );
}