Click here to Skip to main content
11,721,385 members (82,537 online)
Click here to Skip to main content
Add your own
alternative version

Multidevice ASIO output plugin for WinAMP

, 13 Feb 2009 CDDL 26.9K 372 21
A tiny WinAMP output DLL that uses a C++ replacement of the official ASIO SDK that supports multiple ASIO devices.
#pragma once


//  Generic utility namespace for WinAMP modules.

namespace WinAMP
{
#pragma warning( push )
#pragma warning( disable : 4100 )   // unreferenced formal wParam
    #include "WA SDK/Winamp/WA_IPC.h"
#pragma warning( pop )

//  Must be implemented by the specific WinAMP module that receives the handles
// from WinAMP upon startup.
HWND      WinAMPWindowHandle();
HINSTANCE DLLInstanceHandle ();


//  Helpers for controlling WinAMP via Windows messages.
inline LRESULT WAMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 ) { return ::SendMessage( WinAMPWindowHandle(), message, wParam, lParam ); }

struct WAMessages
{
    // (todo) Fill as needed.
    enum
    {
        StopPlayback = 40047
    };
};

inline LRESULT    WACommand( LPARAM command, WPARAM parameter = 0 ) { return WAMessage( WM_WA_IPC, parameter, command ); }
template<typename ReturnType>
inline ReturnType WACommand( LPARAM command, WPARAM parameter = 0 ) { return reinterpret_cast<ReturnType>( WACommand( command, parameter ) ); }

inline char const * GetWinAMPIniPath  () { return WACommand<char const *>( IPC_GETINIFILE         ); }
inline char const * GetIniDirectory   () { return WACommand<char const *>( IPC_GETINIDIRECTORY    ); }
inline char const * GetPluginDirectory() { return WACommand<char const *>( IPC_GETPLUGINDIRECTORY ); }

static char const pluginIniFileName[] = "plugin.ini";

char const * GetPluginIniPath();


template<class Config>
inline bool ReadConfig( Config & config, char const * const iniSection, char const * const iniFile = GetPluginIniPath() )
{
    return ( ::GetPrivateProfileStructA( iniSection, "binaryConfigData", (LPVOID)&config, sizeof( config ), iniFile ) != 0 );
}

template<class Config>
inline bool SaveConfig( Config const & config, char const * const iniSection, char const * const iniFile = GetPluginIniPath() )
{
    return ( ::WritePrivateProfileStructA( iniSection, "binaryConfigData", (LPVOID)&config, sizeof( config ), iniFile ) != 0 );
}

}   // 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)

Share

About the Author

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

You may also be interested in...

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