soundbase.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "pch.h"
  2. #include "soundbase.h"
  3. //
  4. // These includes are the real heart of this file. They were all originally
  5. // part of this file, but I spun them off into .h files when they became too
  6. // big to be managable.
  7. //
  8. #include "ds3dutil.h"
  9. #include "ds3dbuffer.h"
  10. #include "ds3dvirtualbuffer.h"
  11. #include "ds3dengine.h"
  12. namespace SoundEngine {
  13. // create a default sound engine
  14. HRESULT CreateSoundEngine(TRef<ISoundEngine>& psoundengine, HWND hwnd)
  15. {
  16. TRef<DS3DSoundEngine> psoundengineimpl = new DS3DSoundEngine();
  17. HRESULT hr = psoundengineimpl->Init(hwnd);
  18. if (hr == DSERR_NODRIVER || hr == DSERR_ALLOCATED || ZFailed(hr))
  19. return hr;
  20. psoundengine = psoundengineimpl;
  21. return S_OK;
  22. }
  23. #ifdef _DEBUG
  24. // a helper function for trying to dump an arbitrary object
  25. ZString SoundDebugDump(ISoundObject* pobject, const ZString& strIndent)
  26. {
  27. ISoundDebugDump* pdebug = dynamic_cast<ISoundDebugDump*>(pobject);
  28. if (pdebug)
  29. {
  30. return pdebug->DebugDump(strIndent);
  31. }
  32. else
  33. {
  34. return strIndent + "<unknown>\n";
  35. }
  36. }
  37. #endif
  38. };