myWav.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /******************************************************************************
  2. |* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  3. |* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  4. |* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  5. |* PARTICULAR PURPOSE.
  6. |*
  7. |* Copyright 1995-2005 Nero AG. All Rights Reserved.
  8. |*-----------------------------------------------------------------------------
  9. |* PROJECT: Nero Plugin Manager Example
  10. |*
  11. |* FILE: myWav.cpp
  12. |*
  13. |* PURPOSE: Global variables and implementation of the published DLL functions.
  14. ******************************************************************************/
  15. #include "stdafx.h"
  16. #include "myWav.h"
  17. // component enumerator
  18. #include "WavEnum.h"
  19. // wave target factory
  20. #include "WavTgtFactory.h"
  21. // wave source factory
  22. #include "WavSrcFactory.h"
  23. #ifdef _DEBUG
  24. # define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. BEGIN_MESSAGE_MAP(CWavApp, CWinApp)
  29. //{{AFX_MSG_MAP(CWavApp)
  30. // NOTE - the ClassWizard will add and remove mapping macros here.
  31. // DO NOT EDIT what you see in these blocks of generated code!
  32. //}}AFX_MSG_MAP
  33. END_MESSAGE_MAP()
  34. CWavApp::CWavApp() {}
  35. CWavApp theApp;
  36. // Global data
  37. // reference to the Audio Plugin Manager
  38. // this pointer will be provided during initialization by the
  39. // Audio Plugin Manager itself.
  40. IAudioPluginMgr* g_pPluginMgr = NULL;
  41. // instances of the component enumerator and the factories
  42. // will be kept alive until the DLL is unloaded
  43. CWavEnum g_enum;
  44. CWavTgtFactory g_TgtFactory;
  45. CWavSrcFactory g_SrcFactory;
  46. // The Audio Plugin Manager will call this function during initialization
  47. bool NERO_PLUGIN_GetPrimaryAudioObject(IAudioComponent** pAC)
  48. {
  49. // the pointer must be different from NULL
  50. ASSERT(pAC);
  51. if(NULL == pAC)
  52. {
  53. return false;
  54. }
  55. // our primary audio object is the component enumerator
  56. *pAC = &g_enum;
  57. if(NULL != *pAC)
  58. {
  59. (*pAC)->AddRef();
  60. }
  61. return true;
  62. }
  63. // This function will be called when the Nero application is closed
  64. bool NERO_PLUGIN_ReadyToFinish()
  65. {
  66. return (g_TgtFactory.GetRefCount() <= 1) && (g_SrcFactory.GetRefCount() <= 1) &&
  67. (g_enum.GetRefCount() <= 1);
  68. }