Click here to Skip to main content
15,893,722 members
Articles / Desktop Programming / Win32

Windows Audio Mixer API Wrapper Library

Rate me:
Please Sign up or sign in to vote.
4.11/5 (12 votes)
20 Oct 2008CPOL5 min read 122.7K   5K   27  
A small wrapper library to programmatically interact with standard audio controls
// -----------------------------------------------------------------------------
// MixerDestination.h
//
//  Copyright (C) 2008 Peter C. Studt
//
//  This software is provided 'as-is', without any express or implied
//  warranty.  In no event will the author be held liable for any damages
//  arising from the use of this software. It can be redistributed and/or 
//  modified under the terms of The Code Project Open License (CPOL)
//
// -----------------------------------------------------------------------------

#pragma once
#include "MixerControl.h"

// -----------------------------------------------------------------------------
class CMixerDestination
{
public:
	CMixerDestination(void);
	virtual ~CMixerDestination(void);

	int Init(unsigned int nDestIndex, HMIXER hMixer);

	int GetDestControlCount() ;
	int GetConnectionCount() ;
	int GetConnectionControlCount( int connectionIndex ) ;

	int GetControlMetrics( DWORD dwID, MIXERCONTROL* pMC ) ;
	int GetControlState( DWORD dwID, void* pStateData, unsigned int* nBuffSize ) ;
	int SetControlState( DWORD dwID, void* pStateData, unsigned int* nBuffSize ) ; 

	int GetDestControlMetrics( int controlIndex, MIXERCONTROL* pMC ) ;
	int GetDestControlState( int controlIndex, void* pStateData, unsigned int* nBuffSize ) ; 
	int SetDestControlState( int controlIndex, void* pStateData, unsigned int* nBuffSize ) ; 

	int GetConnectionControlMetrics( int connectionIndex, int controlIndex, MIXERCONTROL* pMC ) ;
	int GetConnectionControlState( unsigned int connectionIndex, unsigned int controlIndex, 
												void* pStateData, unsigned int* nBuffSize ) ; 
	int SetConnectionControlState( unsigned int connectionIndex, unsigned int controlIndex, 
												void* pStateData, unsigned int* nBuffSize ) ; 

	int GetConnControlDwID( int connectionIndex, int controlIndex ) ;
	int GetDestControlDwID( int controlIndex ) ;

	int GetDestMixerLineInfo( MIXERLINE* pMixerLineInfo ) ;
	int GetConnectionMixerLineInfo( unsigned int connectionIndex, MIXERLINE* pMixerLineInfo ) ;

protected:
	int GetConnectionsControlData(void);

	unsigned int		mnConnections;		// Number of connections for this destination
	unsigned int		mnDestControls ;	// Number of controls for this destination
	int					mnDestIndex ;		// Mixer destination index 0..N
	HMIXER				mhMixer ;
	MIXERLINE			mMixerLineInfo ;				// One MIXERLINE for this destination
	MIXERLINE*			mpConnectionsMixerLineInfo ;	// One MIXERLINE per connection
	CMixerControl*		mpDestControls;	// One for each control of this destination
	CMixerControl*		mpControls ;	// One for each connection, contains controls info
} ;

// -----------------------------------------------------------------------------

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 Code Project Open License (CPOL)


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions