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.

101 lines
3.7 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dsutils.cpp
  6. * Content:
  7. * This module contains the implementation of the DirectSoundException class
  8. *
  9. * History:
  10. * Date By Reason
  11. * ==== == ======
  12. * 07/16/99 rodtoll Created
  13. * 09/21/99 rodtoll Updated to remove string translation in release build
  14. * 10/05/99 rodtoll Added DPF_MODNAMEs
  15. *
  16. ***************************************************************************/
  17. #include "dxvutilspch.h"
  18. #undef DPF_MODNAME
  19. #define DPF_MODNAME "DirectSoundException::MapResultToString"
  20. // MapResultToString
  21. //
  22. // This function is used by the DirectSoundException class to map from
  23. // HRESULT's returned from DirectSound to the string equivalent which
  24. // is placed into the m_szErrorString member variable. To retrieve
  25. // this string, call DirectSoundException::what().
  26. //
  27. // Parameters:
  28. // N/A
  29. //
  30. // Returns:
  31. // N/A
  32. //
  33. void DirectSoundException::MapResultToString()
  34. {
  35. #ifdef _DEBUG
  36. switch( m_result )
  37. {
  38. case DS_OK:
  39. _tcscpy( m_szErrorString, _T( "The request completed successfully." ) );
  40. break;
  41. case DSERR_ALLOCATED:
  42. _tcscpy( m_szErrorString, _T( "The request failed because resources, are already in use. " ) );
  43. break;
  44. case DSERR_ALREADYINITIALIZED:
  45. _tcscpy( m_szErrorString, _T( "The object is already initialized." ) );
  46. break;
  47. case DSERR_BADFORMAT:
  48. _tcscpy( m_szErrorString, _T( "The specified wave format is not supported." ) );
  49. break;
  50. case DSERR_BUFFERLOST:
  51. _tcscpy( m_szErrorString, _T( "The buffer memory has been lost and must be restored." ) );
  52. break;
  53. case DSERR_CONTROLUNAVAIL:
  54. _tcscpy( m_szErrorString, _T( "The control (volume, pan, and so forth) reqested not available" ) );
  55. break;
  56. case DSERR_GENERIC:
  57. _tcscpy( m_szErrorString, _T( "An undetermined error occurred inside the DirectSound subsystem." ) );
  58. break;
  59. case DSERR_INVALIDCALL:
  60. _tcscpy( m_szErrorString, _T( "This function is not valid for the current state of this object." ) );
  61. break;
  62. case DSERR_INVALIDPARAM:
  63. _tcscpy( m_szErrorString, _T( "An invalid parameter was passed to the returning function." ) );
  64. break;
  65. case DSERR_NOAGGREGATION:
  66. _tcscpy( m_szErrorString, _T( "The object does not support aggregation." ) );
  67. break;
  68. case DSERR_NODRIVER:
  69. _tcscpy( m_szErrorString, _T( "No sound driver is available for use." ) );
  70. break;
  71. case DSERR_NOINTERFACE:
  72. _tcscpy( m_szErrorString, _T( "The requested COM interface is not available." ) );
  73. break;
  74. case DSERR_OTHERAPPHASPRIO:
  75. _tcscpy( m_szErrorString, _T( "Another application has a higher priority level, preventing this call from succeeding" ) );
  76. break;
  77. case DSERR_OUTOFMEMORY:
  78. _tcscpy( m_szErrorString, _T( "The DirectSound subsystem could not allocate sufficient memory to complete the caller's request." ) );
  79. break;
  80. case DSERR_PRIOLEVELNEEDED:
  81. _tcscpy( m_szErrorString, _T( "The caller does not have the priority level required for the function to succeed." ) );
  82. break;
  83. case DSERR_UNINITIALIZED:
  84. _tcscpy( m_szErrorString, _T( "The IDirectSound::Initialize method has not been called or has not been called successfully before other methods were called." ) );
  85. break;
  86. case DSERR_UNSUPPORTED:
  87. _tcscpy( m_szErrorString, _T( "The function called is not supported at this time." ) );
  88. break;
  89. default:
  90. _tcscpy( m_szErrorString, _T( "Unknown error" ) );
  91. break;
  92. }
  93. #else
  94. _tcscpy( m_szErrorString, _T("") );
  95. #endif
  96. }