		Profiles management as part of alsa
		2004-05-16 Dirk Kalis <dirk.kalis@t-online.de>

General
=======

Profiles management can be used from all applications like mixers or hardware control programs.
It uses always alsactl and if directorys for the profiles file doesn't exists - mkdir.
profiles file means the file in which the profiles will be stored.
For other application the following files are needed:
profiles.h - header file with the exported functions
profiles.c - profiles implementation
new_process.c - used to start external programs (alsactl and mkdir)
strstr_icase_blank.c - string search function with ignoring case sensitivity, number of blanks, empty and
			comment lines (first non blank character '#')
Profile numbers beginning with number 1 not 0 !

Introduction
============

Profiles management stores and restores alsactl settings in a profiles file.
Every card is stored in the profiles and every card profile can have a profile name.
The profiles file has the following structure:

[ profile <profile number> ]
< Card <card number> >
{ /<profile name/ }
***************************
***   alsactl settings  ***
***************************
< /CARD <card number> >
-----next card or next profile or end of file-----

The header for profile name and card footer are optional.
The functions in profile.c write always a card footer.

DO NOT EDIT THIS FILE MANUALLY BECAUSE EVERY WRITE ACCESS MAKE A REORGANIZATION AND COMMENTS NOT WRITTEN IN
THE ALSACTL SECTION WILL BE REMOVED! ALSO THE STRUCTURE OF THE FILE WILL BE MODIFIED!

With the environment variables ALACTL_PROG and MKDIR_PROG can the compiled defaults for this
programs be overwritten.
e.g.:
export ALSACTL_PROG=<path and name from alsactl>;export MKDIR_PROG=<path and name from mkdir>;<mixer program with profiles management>

This pathes must not be a link !

The profiles file name and path can explicit given.
If is not given (by value NULL) two defined defaults will be used.
Two variables can be set in the profiles header file for the default profiles file and for the system profiles file.
The default for DEFAULT_PROFILERC is ~/<program name>/profiles.conf.
The default for SYS_PROFILERC is /etc/<program name>/profiles.conf

The profiles management search for profiles file if no profiles file name is given.
Search order for restore:
<given profiles file> if not -> <DEFAULT_PROFILERC> if doesn't exists -> <SYS_PROFILERC>

Search order for save:
<given profiles file> if not -> <DEFAULT_PROFILERC>

The SYS_PROFILERC can only be written as root by explicit given profiles file name or
you make a copy as root from one of the DEFAULT_PROFILERC.

This files must not be a link!

The delete_card function can be used to remove card profiles from profiles file if a card is removed from your pc.

Miscellaneous cards can have same profile names - thats no problem.
One card with equal profile names is also no problem if you use profile number for searching.
If you use profile name for searching you will allways get the least profile number with this profile name.

Profiles management in mudita24
====================================

In mudita24 you can find a new map named "Profiles".
In this map you can store 8 profiles for every envy24 card.
You can change/give name by activating this profile and then click in the name entry.
You can only change the name for the active profile.
If all settings in the active profile are done you can save settings by clicking button "Save active profile".
Error messages will only displayed on stderr in the text window if you start mudita24 from xterm.

To activate a profile click only the profile button.

You can start mudita24 with given profiles file and a default profile. if a default profile is given
after initialisation of mudita24 this profile will be activated.
Default profile can be given by profile number or profile name.
The accuracy of discrimination works in the following way:
	- if the given default profile contains a letter -> profile name
	- if the given default profile has a number outside the range [1 ... MAX_PROFILES] -> profile name
	- the given default profile is interpreted as profile number.

Profile names should have at least one letter.

For "Delete card from profiles" and equal profile names read above.
One card with equal names is only a problem if you start mudita24 with default profile name. You activate
allways the profile with the least profile number with this profile name.

Copyright
=========

Copyright Dirk Kalis<dirk.kalis@t-online.de>
Modified for mudita24 (C) Copyright 2011 Tim E. Real (terminator356 on sourceforge).
This is free and can be distributed under GPL.
