www.pudn.com > CAudioRouting.zip > CAudioRouting.cpp, change:2008-08-28,size:1305b


#include "stdafx.h" 
 
CAudioRouting::CAudioRouting() 
{ 
    hDllCeddk_=NULL; 
    pfnMmMapIoSpace_= NULL; 
    pfnMmUnmapIoSpace_ = NULL; 
} 
 
bool CAudioRouting::Deinit() 
{ 
        
    if (hDllCeddk_)  
    { 
        FreeLibrary( hDllCeddk_ ); 
        hDllCeddk_ = NULL; 
        pfnMmMapIoSpace_= NULL; 
        pfnMmUnmapIoSpace_ = NULL; 
    } 
 
    return true; 
} 
 
bool CAudioRouting::Init() 
{ 
    bool bRet=false; 
 
    if ( NULL == hDllCeddk_ ) 
    { 
        hDllCeddk_ = LoadLibrary(TEXT("ceddk.dll")); 
    } 
 
    // grab MmMapIoSpace 
    if ( hDllCeddk_ )  
    { 
        pfnMmMapIoSpace_ = (_MmMapIoSpace)GetProcAddress(hDllCeddk_,TEXT("MmMapIoSpace")); 
        pfnMmUnmapIoSpace_  = (_MmUnmapIoSpace)GetProcAddress(hDllCeddk_,TEXT("MmUnmapIoSpace")); 
        if ( pfnMmMapIoSpace_ && pfnMmUnmapIoSpace_ ) 
        { 
            bRet = true; 
        } 
    } 
    return bRet; 
} 
 
CAudioRouting * CAudioRouting::AudioRoutingFactory( CPUTYPE Cpu ) 
{ 
    CAudioRouting *Object = NULL; 
 
    switch ( Cpu ) 
    { 
    case CAudioRouting::OMAP730: 
        Object = new CAudioRoutingTIOmap; 
        break; 
    } 
 
    return Object; 
} 
 
void CAudioRouting::CAudioRoutingFactoryDestroy( CAudioRouting * CAudioRoutingObject ) 
{ 
    delete CAudioRoutingObject; 
}