Click here to Skip to main content
12,451,896 members (27,088 online)
Click here to Skip to main content

Stats

413.7K views
11.2K downloads
158 bookmarked
Posted

Audio Library Part I - (Windows Mixer Control)

, 1 Oct 2006 CPOL
Library to control Windows Mixer from C#
//
//  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.Diagnostics;
using System.Windows.Forms;

namespace WaveLib.AudioMixer
{
	[Author("Gustavo Franco")]
	public class CallbackWindow : NativeWindow, IDisposable
	{
		#region Constants Declaration
		private const int WS_CHILD = 0x40000000, WS_VISIBLE = 0x10000000, WM_ACTIVATEAPP = 0x001C;
		#endregion

		#region Variables Declaration
		private CallbackWindowControlChangeHandler	mPtrMixerControlChange;
		private CallbackWindowLineChangeHandler		mPtrMixerLineChange;
		#endregion

		#region Constructors
		internal CallbackWindow(CallbackWindowControlChangeHandler ptrMixerControlChange, CallbackWindowLineChangeHandler ptrMixerLineChange)
		{
			CreateParams cp = new CreateParams();

			mPtrMixerControlChange	= ptrMixerControlChange;
			mPtrMixerLineChange		= ptrMixerLineChange;

			this.CreateHandle(cp);
		}
		#endregion

		#region Overrides
		[DebuggerNonUserCode(), System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
		protected override void WndProc(ref Message m)
		{
			switch (m.Msg)
			{
				case MixerNative.MM_MIXM_LINE_CHANGE:
					mPtrMixerLineChange(m.WParam, (uint) m.LParam);
					break;

				case MixerNative.MM_MIXM_CONTROL_CHANGE:
					mPtrMixerControlChange(m.WParam, (uint) m.LParam);
					break;
				default:
					break;

			}
			base.WndProc (ref m);
		}
		#endregion

		#region IDisposable Members
		public void Dispose()
		{
			if (this.Handle != IntPtr.Zero)
			{
				this.DestroyHandle();
			}
		}
		#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.

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160826.1 | Last Updated 1 Oct 2006
Article Copyright 2005 by CastorTiu
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid