Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Multidevice ASIO output plugin for WinAMP

, 13 Feb 2009
A tiny WinAMP output DLL that uses a C++ replacement of the official ASIO SDK that supports multiple ASIO devices.
#include "WinAMP.hpp"

#include "debugMacros.hpp"

#include <algorithm>


// (todo) Reconsider if this is actually a good place to place DLLMain (it
//        forces a default implementation on this module's users).
extern "C"
{
    BOOL APIENTRY DllMain( HMODULE const hModule, DWORD const callReason, LPVOID /*lpReserved*/ )
    {
        if ( callReason == DLL_PROCESS_ATTACH )
            VERIFY( ::DisableThreadLibraryCalls( hModule ) );
        return true;
    }

};


namespace WinAMP
{

//************************************
// Method:    GetPluginIniPath
// FullName:  WinAMP::GetPluginIniPath
// Access:    global
//************************************

char const * GetPluginIniPath()
{
    static char pluginIniPath[ MAX_PATH * 2 ] = { 0 };

    if ( !*pluginIniPath )
    {
    #if 0 // Some WinAMP versions were buggy and didn't fill in their HWND.
        if ( !WinAMPWindowHandle() )
        {
            DWORD const len( ::GetModuleFileNameA( DLLInstanceHandle(), pluginIniPath, sizeof( pluginIniPath ) ) );
            char * const backslash( &*std::find( std::reverse_iterator<char *>( pluginIniPath + len ), std::reverse_iterator<char *>( pluginIniPath ), '\\' ) );
            std::memcpy( backslash + 1, pluginIniFileName, sizeof( pluginIniFileName ) );
        }
        else
    #endif // Disabled unless proven necessary.
        {
            assert( WinAMPWindowHandle() );
            char const * const pluginDirectory( GetPluginDirectory() );
            size_t const len( std::strlen( pluginDirectory ) );
            assert( sizeof( pluginIniPath ) > len + sizeof( pluginIniFileName ) );
            std::memcpy( pluginIniPath, pluginDirectory, len );
            pluginIniPath[ len ] = '\\';
            std::memcpy( pluginIniPath + len + 1, pluginIniFileName, sizeof( pluginIniFileName ) );
        }
    }

    assert( *pluginIniPath );
    return pluginIniPath;
}

}   // namespace WinAMP

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)

About the Author

Domagoj Šarić
Software Developer Little Endian Ltd.
Croatia Croatia
No Biography provided

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 13 Feb 2009
Article Copyright 2009 by Domagoj Šarić
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid