Source code of Windows XP (NT5)
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.

51 lines
1.5 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dsutils.h
  6. * Content: declares general DirectSound utils, particularly error stuff
  7. *
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 07/16/99 rodtoll Created
  12. *
  13. ***************************************************************************/
  14. #ifndef __DIRECTSOUNDUTILS_H
  15. #define __DIRECTSOUNDUTILS_H
  16. // DirectXException
  17. //
  18. // This class is the exception class for handling exceptions from
  19. // errors from DirectSound. It is used by the DSCHECK macro to
  20. // check return codes from DirectSound calls.
  21. //
  22. // It provides an implementation of the DirectXException and
  23. // provides mapping from HRESULTs to string descriptions of
  24. // directsound errors.
  25. //
  26. class DirectSoundException: public DirectXException
  27. {
  28. public:
  29. DirectSoundException(
  30. const TCHAR *funcName, HRESULT result,
  31. const unsigned int moduleID = 0, unsigned int lineNumber = 0
  32. ): DirectXException( funcName, result, moduleID, lineNumber )
  33. {
  34. MapResultToString();
  35. };
  36. protected:
  37. void MapResultToString();
  38. };
  39. // DSCHECK MACRO
  40. //
  41. // This macro is used to check the return codes from DirectSound calls. If
  42. // the directsound call does not return a DS_OK, a DirectSoundException exception
  43. // is created and thrown.
  44. //
  45. #define DSCHECK(x) if( x != DS_OK ) { throw DirectSoundException( "", x, 0, __LINE__ ); }
  46. #endif