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 MixerDetails : System.Collections.CollectionBase
	{
		#region Constructors & Destructors
		public MixerDetails()
		{
		}

		~MixerDetails()
		{
			this.InnerList.Clear();
		}
		#endregion

		#region Methods
		public bool	Contains(MixerDetail detail)
		{
			foreach(MixerDetail mixerDetail in this.InnerList)
				if (mixerDetail == detail)
					return true;

			return false;
		}

		public MixerDetail GetMixerByDeviceId(int deviceId)
		{
			foreach(MixerDetail mixerDetail in this.InnerList)
				if (mixerDetail.DeviceId == deviceId)
					return mixerDetail;

			return null;
		}

		public MixerDetail GetMixerByIndex(int index)
		{
			return this[index];
		}

		public MixerDetail GetMixerByName(string name)
		{
			foreach(MixerDetail mixerDetail in this.InnerList)
				if (mixerDetail.MixerName == name)
					return mixerDetail;

			return null;
		}

		public void Add(MixerDetail mixer)
		{
			this.InnerList.Add(mixer);
		}

		public void Remove(MixerDetail mixer)
		{
			if (this.InnerList.Contains(mixer))
			{
				this.InnerList.Remove(mixer);
				return;
			}
			
			MixerDetail mixerDetailToRemove = null;
			foreach(MixerDetail mixerDetail in this.InnerList)
			{
				if (mixerDetail.DeviceId  == mixer.DeviceId &&
					mixerDetail.MixerName == mixer.MixerName)
				{
					mixerDetailToRemove = mixerDetail;
					break;
				}
			}
			
			if (mixerDetailToRemove != null)
				this.InnerList.Remove(mixerDetailToRemove);
		}
		#endregion

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

				return (MixerDetail) 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
Web02 | 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