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.

83 lines
1.9 KiB

  1. // here is a rough summary of the code you will need.
  2. //
  3. // point to the AVWAV project for these
  4. // link with AVWAV.LIB, ship with AVWAV.DLL
  5. //
  6. #include "wav.h"
  7. #include "strmio.h"
  8. #include "mulaw.h"
  9. #include "vox.h"
  10. //
  11. ///////////////////// create a new wav stream /////////////////////////
  12. //
  13. // get a pointer to an new stream from somewhere
  14. //
  15. LPSTREAM lpStream = PaolaCreateStream();
  16. DWORD adwInfo[3] = { lpStream, 0L, 0L };
  17. // choose one of these audio formats
  18. //
  19. LPWAVEFORMATEX lpwfx = VoxFormat(NULL, 6000); // low quality
  20. LPWAVEFORMATEX lpwfx = VoxFormat(NULL, 8000); // medium quality, default for messages
  21. LPWAVEFORMATEX lpwfx = MulawFormat(NULL, 8000); // high quality, default for prompts and greetings
  22. // create a new wav stream
  23. //
  24. HWAV hWav = WavOpen(WAV_VERSION, AfxGetInstanceHandle(),
  25. NULL, lpwfx, StreamIOProc, adwInfo, WAV_CREATE | WAV_READWRITE);
  26. // when the user presses the Record button
  27. //
  28. WavRecord(hWav, -1, WAV_RECORDASYNCH);
  29. // when the user presses the Stop button
  30. //
  31. WavStop(hWav);
  32. // when the user presses the Play button
  33. //
  34. WavPlay(hWav, -1, WAV_PLAYASYNCH);
  35. // when you are finished
  36. //
  37. WavClose(hWav);
  38. //
  39. ///////////////////// play an existing wav stream /////////////////////////
  40. //
  41. // get a pointer to an existing stream from somewhere
  42. //
  43. LPSTREAM lpStream = PaolaGetStream();
  44. DWORD adwInfo[3] = { lpStream, 0L, 0L };
  45. // or open an existing wav stream
  46. //
  47. HWAV hWav = WavOpen(WAV_VERSION, AfxGetInstanceHandle(),
  48. NULL, NULL, StreamIOProc, adwInfo, WAV_READ);
  49. // when the user presses the Play button
  50. //
  51. WavPlay(hWav, -1, WAV_PLAYASYNCH);
  52. // when the user presses the Stop button
  53. //
  54. WavStop(hWav);
  55. // when you are finished
  56. //
  57. WavClose(hWav);
  58. //
  59. ///////////////////// other functions you might want to try ///////////////
  60. //
  61. WavGetLength
  62. WavGetPosition
  63. WavSetPosition