Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include <stdio.h>
  9. #include "snd_audio_source.h"
  10. extern CAudioSource *Audio_CreateMemoryWave( const char *pName );
  11. //-----------------------------------------------------------------------------
  12. // Purpose: Simple wrapper to crack naming convention and create the proper wave source
  13. // Input : *pName - WAVE filename
  14. // Output : CAudioSource
  15. //-----------------------------------------------------------------------------
  16. CAudioSource *AudioSource_Create( const char *pName )
  17. {
  18. if ( !pName )
  19. return NULL;
  20. // if ( pName[0] == '!' ) // sentence
  21. ;
  22. // Names that begin with "*" are streaming.
  23. // Skip over the * and create a streamed source
  24. if ( pName[0] == '*' )
  25. {
  26. return NULL;
  27. }
  28. // These are loaded into memory directly
  29. return Audio_CreateMemoryWave( pName );
  30. }
  31. #define WIN32_LEAN_AND_MEAN
  32. #include <windows.h>
  33. #include "hlfaceposer.h"
  34. #include "ifaceposersound.h"
  35. CAudioSource::~CAudioSource( void )
  36. {
  37. CAudioMixer *mixer;
  38. while ( 1 )
  39. {
  40. mixer = sound->FindMixer( this );
  41. if ( !mixer )
  42. break;
  43. sound->StopSound( mixer );
  44. }
  45. sound->EnsureNoModelReferences( this );
  46. }
  47. CAudioSource::CAudioSource( void )
  48. {
  49. }