Click here to Skip to main content
15,881,898 members
Articles / Desktop Programming / WTL

Multidevice ASIO output plugin for WinAMP

Rate me:
Please Sign up or sign in to vote.
4.80/5 (9 votes)
13 Feb 2009CDDL27 min read 48.1K   728   23  
A tiny WinAMP output DLL that uses a C++ replacement of the official ASIO SDK that supports multiple ASIO devices.
// configDlg.hpp : interface of the ConfigurationDialog class
//
////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "gui.hpp"
#include "ASIODevice.hpp"
#include "resource.h"


////////////////////////////////////////////////////////////////////////////////
//
//  ConfigurationDialog
//  -------------------
//
//  Implements the Wasiona configuration control panel.
//
////////////////////////////////////////////////////////////////////////////////

class ConfigurationDialog : public ATL::CDialogImpl<ConfigurationDialog>
{
public:
    ConfigurationDialog();

    enum { IDD = IDD_CONFIGURATION };


private:  // Message map/window procedure.
    BEGIN_MSG_MAP( ConfigurationDialog )
	    COMMAND_ID_HANDLER( IDOK                 , OnOK                   )
	    COMMAND_ID_HANDLER( IDCANCEL             , OnCancel               )
        COMMAND_ID_HANDLER( ID_AddDevice         , OnAddDeviceToList      )
        COMMAND_ID_HANDLER( ID_RemoveDevice      , OnRemoveDeviceFromList )
        COMMAND_ID_HANDLER( ID_DeviceControlPanel, OnDeviceControlPanel   )
        COMMAND_CODE_HANDLER( LBN_SELCHANGE, OnChosenDevicesSelectionChange )
        COMMAND_CODE_HANDLER( LBN_SELCANCEL, OnChosenDevicesSelectionCancel )
        NOTIFY_CODE_HANDLER_EX( TBN_DROPDOWN, OnVolumeMenu )
        NOTIFY_ID_HANDLER_EX( IDC_URL, OnURL )
        MSG_WM_INITDIALOG( OnInitDialog )
    END_MSG_MAP()

private: // Message/event handlers.
    // Handler prototypes (uncomment arguments if needed):
    //	LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    //	LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
    //	LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)

    bool OnInitDialog( HWND defaultFocusControl, LPARAM lInitParam );
    void OnDestroy();

    LRESULT OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);

    LRESULT OnAddDeviceToList             ( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled );
    LRESULT OnRemoveDeviceFromList        ( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled );
    LRESULT OnChosenDevicesSelectionChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled );
    LRESULT OnChosenDevicesSelectionCancel( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled );
    LRESULT OnDeviceControlPanel          ( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled );
    LRESULT OnVolumeMenu                  ( NMHDR const *                                             );
    LRESULT OnURL                         ( NMHDR const *                                             );
    
private:
    InDialogPropertySheet       & devicesSheet()       { return asioDevices_  ; }
    InDialogPropertySheet const & devicesSheet() const { return const_cast<ConfigurationDialog &>( *this ).asioDevices_; }
    ASIODriverList        const & driverList  () const { return asioDrivers_; }
    WTL::CListBox               & chosenDevices() { assert( chosenDevices_ && ::IsWindow( chosenDevices_ ) ); return chosenDevices_; }

    void closeDialog( int returnCode );
    void enableDeviceDependentButtons( bool const enable = true );
    void enableOKButton();
    void setDeviceListChanged() { deviceListChanged_ = true; enableOKButton(); }
    void setNewVolumeControler( unsigned long const newVolumeControler );

private:
    ASIODriverList        const asioDrivers_       ;
    InDialogPropertySheet       asioDevices_       ;
    WTL::CListBox               chosenDevices_     ;
    WTL::CToolBarCtrl           addRemoveToolbar_  ;
    WTL::CToolBarCtrl           setupToolbar_      ;
    bool                        deviceListChanged_ ;
    unsigned long               newVolumeControler_;
};

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)


Written By
Software Developer Little Endian Ltd.
Croatia Croatia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions