Leaked source code of windows server 2003
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.

118 lines
5.7 KiB

  1. /**MOD+**********************************************************************/ /**MOD+**********************************************************************/
  2. /* Module: aspapi.c */
  3. /* */
  4. /* Purpose: Sound Player API functions */
  5. /* */
  6. /* Copyright(C) Microsoft Corporation 1997 */
  7. /* */
  8. /****************************************************************************/
  9. #include <adcg.h>
  10. extern "C" {
  11. #define TRC_GROUP TRC_GROUP_CORE
  12. #define TRC_FILE "aspapi"
  13. #include <atrcapi.h>
  14. }
  15. #include "sp.h"
  16. CSP::CSP(CObjs* objs)
  17. {
  18. _pClientObjects = objs;
  19. }
  20. CSP::~CSP()
  21. {
  22. }
  23. /**PROC+*********************************************************************/
  24. /* Name: SP_Init */
  25. /* */
  26. /* Purpose: Sound Player initialization function */
  27. /* */
  28. /* Returns: Nothing. */
  29. /* */
  30. /* Params: None */
  31. /* */
  32. /**PROC-*********************************************************************/
  33. DCVOID DCAPI CSP::SP_Init(DCVOID)
  34. {
  35. DC_BEGIN_FN("SP_Init");
  36. TRC_NRM((TB, _T("SP Initialized")));
  37. DC_EXIT_POINT:
  38. DC_END_FN();
  39. return;
  40. }
  41. /**PROC+*********************************************************************/
  42. /* Name: SP_Term */
  43. /* */
  44. /* Purpose: Sound Player termination function */
  45. /* */
  46. /* Returns: Nothing */
  47. /* */
  48. /* Params: None */
  49. /* */
  50. /**PROC-*********************************************************************/
  51. DCVOID DCAPI CSP::SP_Term(DCVOID)
  52. {
  53. DC_BEGIN_FN("SP_Term");
  54. TRC_NRM((TB, _T("SP terminated")));
  55. DC_END_FN();
  56. return;
  57. }
  58. /**PROC+*********************************************************************/
  59. /* Name: SP_OnPlaySoundPDU */
  60. /* */
  61. /* Purpose: Handles the arrival of a PlaySound PDU */
  62. /* */
  63. /* Returns: Nothing */
  64. /* */
  65. /* Params: IN pPlaySoundPDU: pointer to a PlaySound PDU */
  66. /* */
  67. /**PROC-*********************************************************************/
  68. HRESULT DCAPI CSP::SP_OnPlaySoundPDU(PTS_PLAY_SOUND_PDU_DATA pPlaySoundPDU,
  69. DCUINT dataLen)
  70. {
  71. DC_BEGIN_FN("SP_OnPlaySoundPDU");
  72. DC_IGNORE_PARAMETER(dataLen);
  73. /************************************************************************/
  74. /* Check the sound frequency is within the allowed Windows range. */
  75. /************************************************************************/
  76. if((pPlaySoundPDU->frequency >= 0x25) &&
  77. (pPlaySoundPDU->frequency <= 0x7fff))
  78. {
  79. /************************************************************************/
  80. /* Check the sound is of a sensible duration (less than 1 minute). */
  81. /************************************************************************/
  82. TRC_ASSERT((pPlaySoundPDU->duration < 60000),
  83. (TB, _T("PlaySound PDU duration is %lu ms"),
  84. pPlaySoundPDU->duration));
  85. TRC_NRM((TB, _T("PlaySound PDU frequency %#lx duration %lu"),
  86. pPlaySoundPDU->frequency,
  87. pPlaySoundPDU->duration));
  88. /************************************************************************/
  89. /* Play the sound. This is synchronous for Win32, asynchronous for */
  90. /* Win16. */
  91. /************************************************************************/
  92. SPPlaySound(pPlaySoundPDU->frequency, pPlaySoundPDU->duration);
  93. }
  94. else
  95. {
  96. TRC_ERR((TB, _T("PlaySound PDU frequency %#lx out of range"),
  97. pPlaySoundPDU->frequency));
  98. }
  99. DC_END_FN();
  100. return S_OK;
  101. }