home *** CD-ROM | disk | FTP | other *** search
- //------------------------------------------------------------------------------
- // File: $$DLL_NAME$$.cpp
- //
- // Desc: Audio Effect DMO Wizard generated code - Implementation of DLL Exports.
- //
- // Copyright (c) Microsoft Corporation. All rights reserved.
- //------------------------------------------------------------------------------
-
-
- #include "stdafx.h"
-
- #define _ATL_FREE_THREADED
- #define _ATL_STATIC_REGISTRY
-
- #include <atlbase.h>
- //You may derive a class from CComModule and use it if you want to override
- //something, but do not change the name of _Module
- extern CComModule _Module;
- #include <atlcom.h>
- #include <atlctl.h>
- #include <statreg.h>
- #include <statreg.cpp>
- #include <atlimpl.cpp>
-
- #include "resource.h"
-
- #define FIX_LOCK_NAME
- #include <dmo.h>
- #include <dmoimpl.h>
- $$IF(SUPPORT_DS_IMEDPARAM || SUPPORT_DS_DMP)
- #include "param.h" // (param.h must come before uuids to avoid redefinitions)
- $$ENDIF
-
- #include "$$CLASS_NAME$$.h"
- $$IF(SUPPORT_DS_DMP)
- #include "$$CLASS_NAME$$Prop.h"
- $$ENDIF
-
- CComModule _Module;
-
- BEGIN_OBJECT_MAP(ObjectMap)
- OBJECT_ENTRY(CLSID_$$DSDMO_DEFINE$$, $$CLASS_NAME$$)
- $$IF(SUPPORT_DS_DMP)
- OBJECT_ENTRY(CLSID_$$DSDMO_DEFINE$$PROP, $$CLASS_NAME$$Prop)
- $$ENDIF
- END_OBJECT_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // DLL Entry Point
-
- extern "C"
- BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
- {
- if (DLL_PROCESS_ATTACH == dwReason)
- {
- _Module.Init(ObjectMap, hInstance);
- DisableThreadLibraryCalls(hInstance);
- }
- else if (DLL_PROCESS_DETACH == dwReason)
- _Module.Term();
- return TRUE; // ok
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // Used to determine whether the DLL can be unloaded by OLE
-
- STDAPI DllCanUnloadNow(void)
- {
- return (0 == _Module.GetLockCount()) ? S_OK : S_FALSE;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // Returns a class factory to create an object of the requested type
-
- STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
- {
- return _Module.GetClassObject(rclsid, riid, ppv);
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // DllRegisterServer - Adds entries to the system registry
-
- STDAPI DllRegisterServer(void)
- {
- // Register ourself as a PCM audio effect DMO
- DMO_PARTIAL_MEDIATYPE mt;
- mt.type = MEDIATYPE_Audio;
- $$IF(PROCESS_MEDIATYPE_16BIT_PCM || PROCESS_MEDIATYPE_8BIT_PCM) // If processes PCM
- mt.subtype = MEDIASUBTYPE_PCM;
- $$ELIF(PROCESS_MEDIATYPE_FLOAT) // If processes only float
- mt.subtype = MEDIASUBTYPE_IEEE_FLOAT;
- $$ELSE // If neither, set to PCM as it's DirectSound's default
- mt.subtype = MEDIASUBTYPE_PCM;
- $$ENDIF
-
- HRESULT hr = DMORegister(L"$$DSDMO_NAME$$",
- CLSID_$$DSDMO_DEFINE$$,
- DMOCATEGORY_AUDIO_EFFECT,
- 0,
- 1,
- &mt,
- 1,
- &mt);
-
- // registers object
- return _Module.RegisterServer();
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // DllUnregisterServer - Removes entries from the system registry
-
- STDAPI DllUnregisterServer(void)
- {
- DMOUnregister(CLSID_$$DSDMO_DEFINE$$, DMOCATEGORY_AUDIO_EFFECT);
- return _Module.UnregisterServer();
- }
-
-
-