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

Audio Library Part I - (Windows Mixer Control)

, 1 Oct 2006
Library to control Windows Mixer from C#
audiolib_demo.zip
WaveLibMixer.dll
MixerTest.exe
audiolib_src.zip
MixerTest
WaveLibMixer
AudioMixer
WaveServices
WaveLibMixer.suo
App.ico
MixerTest.csproj.user
WaveLibMixer.csproj.user
//
//  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
//  PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
//  REMAINS UNCHANGED.
//
//  Email:  gustavo_franco@hotmail.com
//
//  Copyright (C) 2005 Franco, Gustavo 
//
using System;
using System.Collections;

namespace WaveLib.AudioMixer
{
	[Author("Gustavo Franco")]
	public class MixerControls : System.Collections.CollectionBase
	{
		#region Constructors
		public MixerControls()
		{
		}
		#endregion

		#region Properties
		#endregion

		#region Methods
		public MixerControl GetControlByType(MIXERCONTROL_CONTROLTYPE type)
		{
			foreach(MixerControl mixerControl in this.InnerList)
				if (mixerControl.Type == type)
					return mixerControl;
			
			return null;
		}

		public MixerControl GetControlByIndex(int index)
		{
			return this[index];
		}

		public void Add(MixerControl mixerControl)
		{
			this.InnerList.Add(mixerControl);
		}

		public void Remove(MixerControl mixerControl)
		{
			if (this.InnerList.Contains(mixerControl))
			{
				this.InnerList.Remove(mixerControl);
				return;
			}

			MixerControl mixerControlToRemove = null;
			foreach(MixerControl mixerControlLoop in this.InnerList)
			{
				if (mixerControlLoop.Id		== mixerControl.Id &&
					mixerControlLoop.Name	== mixerControl.Name &&
					mixerControlLoop.Line	== mixerControl.Line)
				{
					mixerControlToRemove = mixerControlLoop;
					break;
				}
			}
			
			if (mixerControlToRemove != null)
				this.InnerList.Remove(mixerControlToRemove);
		}
		#endregion

		#region Indexers
		public MixerControl this[int index]
		{
			get
			{
				if (index >= this.InnerList.Count || index < 0)
					return null;

				return (MixerControl) this.InnerList[index];
			}
		}
		#endregion
	}
}

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)

Share

About the Author

CastorTiu
Software Developer Microsoft
United States United States
I started with programming about 19 years ago as a teenager, from my old Commodore moving to PC/Server environment Windows/UNIX SQLServer/Oracle doing gwBasic, QBasic, Turbo Pascal, Assembler, Turbo C, BC, Summer87, Clipper, Fox, SQL, C/C++, Pro*C, VB3/5/6, Java, and today loving C#.
 
Currently working as SDE on Failover Clustering team for Microsoft.
 
Passion for most programming languages and my kids Aidan&Nadia.

| Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 1 Oct 2006
Article Copyright 2005 by CastorTiu
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid