Muffler Programmer's Referencedavidslife.com › School › Muffler › Programmer's ReferenceThis page describes the various functions, parameters, and properties of Muffler About MufflerThe Muffler graphical user interface (GUI) is the end-user component of the Muffler application. The Muffler GUI provides low-latency error-checking, modular capacity, and direct operating system (OS) operability. The Muffler GUI offers a 'no-learning curve' interface that allows an end-user to manipulate sound files and perform speech-enhancement. It also supports stub capabilities, which enable software developers to reroute algorithm-housing console applications into the graphical user interface without the modification of source code. Muffler ArchitectureThis section introduces the components of Muffler and explains how the Muffler graphical user interface works with its stub application and operating system to process sound files. Dialog WindowsThe Muffler GUI contains three main dialogs: an about box dialog, a startup dialog, and a variable manipulation dialog. About BoxThe 'About Box' is a standard dialog box that describes (1) what the application is, (2) who created it, and (3) copyright / disclaimer notices. In this specific graphical user interface (GUI), it is brought up in two ways (1) from the system menu (3) from the help menu in the startup dialog. The Muffler 'About Box' is a rudimentary dialog box that contains one default 'OK' button, two basic static controls, which display the title of the application as well as a copyright notice, an ambient-sensitive icon, and an edit box which lists the disclaimer. The following illustration shows the one and only state of the about box.
As one can see, the edit box is visible, disabled, and has multiline capabilities. The edit box cannot be selected and is not a tab stop. An edit box was chosen instead of a static text control for two main reasons. First of all, the copyright notice is 262 characters long (including whitespace characters) and thereby exceeds the 128 character limit for static controls. Second of all, an edit box was used in order to display a string from the string-table in the resource header. This would be needed if text animation was implemented or a foreign language version of Muffler was made. The edit box's control ID is 'IDC_EDIT_BOX' and is linked with two member variables, namely a CString type named 'm_edit_box' and a CEdit type named 'm_edit_box'. Implementation of the text display process will be discussed later in the documentation.This dialog box's ID is 'IDD_ABOUTBOX'. It has a 'popup' style, and a 'dialog frame' border. It also has a system menu and a title bar. Due to the simplistic nature of this dialog, there are no context-sensitive help IDs attached to this dialog box. Startup DialogThe startup dialog is the primary dialog of the application and is brought up when a user starts the application. Most often the only dialog box used by a beginning user, all high-level operations can be executed from this central dialog box. The Muffler startup dialog is divided by group boxes into three segments, namely "File Input / Output", "Processing Controls", and "Playing Controls". An illustration of the one and only state of this dialog is displayed below.
In the "File Input / Output" group box, there are four controls: two buttons and two edit boxes. The top two controls are linked to each other and work together to display the current input file. The 'Input File' ID is IDC_BUTTON_INPUT. The edit box's ID is IDC_EDIT_INPUT. Although the 'Input File' button has no associated member variables, the Input File edit box has two. The edit box is associated with one CEdit variable called 'm_edit_ input _e' and one CString variable called 'm_edit_input'. The bottom two controls (e.g. 'Output File') are configured in the same way that its Input counterparts are. The edit box's two member variables are 'm_edit_output' (CString) and 'm_edit_output_e' (CEdit). In the "Processing Controls" group box, there are two controls. On is called 'Process' and the other is called 'Stop Process'. Each button is linked with a message map function called 'BN_CLICKED'. In this group box, there is also a list box. This control displays the present parameters. It is has one member variable of type ClistBox called 'm_listbox'. Finally, in the "Playing Controls", there are five controls: four visible and one hidden. The two buttons 'Play' and 'Stop Play' are standard message-mapped buttons that each have a linked 'BN_CLICKED' message map function. One of the two radio button has a group property ('Input File'). It has a integer member variable entitled 'm_radio_input'. Both radio variables are linked to message map functions 'BN_CLICKED'. The hidden control is an edit box with a bool member variable. This control is primarily used by the radio buttons in order to communicate with the function classes. Variable Manipulation DialogThe variable manipulation dialog box is brought up in two ways (1) double-clicking on any item in the startup dialog's list box, or (2) clicking on the 'Parameters' button in the list box. The variable manipulation dialog, often referred to as the Parameters Dialog, is illustrated below.
Each variable (e.g. Generalized Wiener Constant, Spectral Floor Scaling Factor, etc.) is paired with a slider and an edit box. The slider and the edit box are linked with each other with the windows messages "WM_ONHSCROLL" and edit box message "EN_CHANGE". Each slider is linked to a CSlider object with it's own prefix (e.g. 'spectral floor scaling factor' slider is linked with 'm_spectral_slider'). Finally, each edit box has two member variables, a CEdit and a CString. The noise adaptation member variables are configured differently than the other radio buttons in the Startup dialog. Instead, each radio button has a group property with a CButton property. These allow the radio buttons to enable / disenable sliders and edit boxes. Muffler ConstantsThere are two constants that pertain to character length. These constants are:
const int MAX_SLIDER_CHAR = 80;
The first constant represents the maximum number of characters that can be entered into an edit box that corresponds to a slider (e.g. in Parameters dialog box). The second constant limits the maximum number of characters that can be passed to a file I/O buffer. There are two constants that pertain to default radio button settings. These constants are:
const double DEFAULT_PLAY_SETTING = 0
The first constant represents the default entry for the 'Play File' radio button group in the startup dialog. The second constant represents the default entry for the 'Noise Adaptation' radio button group in the parameters dialog. There are five constants that pertain to default multiple shift settings. These constants are:
const int WIENER_SHIFT = 1;
If one closely examines the parameters dialog, they might notice that the slider and edit box are linked. For instance, when a slider is moved, the numbers in the edit box move likewise. When numbers are typed into the edit box, the slider shifts accordingly. In order to support such an interface, the slider and the edit box must be able to communicate. However, there is one problem that prevents this linkage. All operations that deals with slider bars are integers. However, all the constants and variables, as well as the units of the edit boxes, are doubles and must utilize decimal places. Therefore, in order to prevent data loss, each double is multiplied by a certain factor to form an whole integer. Now, data transactions can be executed easily, provided that there is a function that multiplies each variable with its successive multiple, as well as a function that can divide each variable with its successive multiple. The shift factor represents the multiplicative / divisable factor necessary for the data transaction. There are five default constants that pertain to original edit box / slider settings. These constants are:
const double DEFAULT_NU = 4;
At the initiation of the Muffler application, the slider / edit boxes are set to these values. There are five generalized Wiener constants that pertain to original edit box / slider settings. These constants are:
const double WIENER_PG_SZE = 2;
At the initialization of the 'Generalized Wiener' slider bar, certain constants are set. PG_SIZE corresponds to the Page Size, or how much the slider moves when the buttons 'Page Up' and 'Page Down' are pressed. LN_SZE corresponds to the Line size, or how much the slider moves when the left and right arrows are pressed. The tick frequency (TIC_FRQ) is an option that was implemented but not used. It, however, sets a tick mark at a certain interval throughout the slider bar. Finally, the range of the slider bar is set by 'MIN' and 'MAX', which are the minimum and the maximum. There are five Spectral Floor Scaling Factor constants that pertain to original edit box / slider settings. These constants are:
const double SPECTRAL_PG_SZE = .2;
At the initialization of the 'Spectral Floor Scaling Factor' slider bar, certain constants are set. PG_SIZE corresponds to the Page Size, or how much the slider moves when the buttons 'Page Up' and 'Page Down' are pressed. LN_SZE corresponds to the Line size, or how much the slider moves when the left and right arrows are pressed. The tick frequency (TIC_FRQ) is an option that was implemented but not used. It, however, sets a tick mark at a certain interval throughout the slider bar. Finally, the range of the slider bar is set by 'MIN' and 'MAX', which are the minimum and the maximum. There are five Initial Noise Estimate Frames constants that pertain to original edit box / slider settings. These constants are:
const double INITIAL_PG_SZE = 2;
At the initialization of the 'Initial Noise Estimate Frames' slider bar, certain constants are set. PG_SIZE corresponds to the Page Size, or how much the slider moves when the buttons 'Page Up' and 'Page Down' are pressed. LN_SZE corresponds to the Line size, or how much the slider moves when the left and right arrows are pressed. The tick frequency (TIC_FRQ) is an option that was implemented but not used. It, however, sets a tick mark at a certain interval throughout the slider bar. Finally, the range of the slider bar is set by 'MIN' and 'MAX', which are the minimum and the maximum. There are five Likelihood Ratio constants that pertain to original edit box / slider settings. These constants are:
const double LIKELIHOOD_PG_SZE = .2
At the initialization of the 'Likelihood Ratio' slider bar, certain constants are set. PG_SIZE corresponds to the Page Size, or how much the slider moves when the buttons 'Page Up' and 'Page Down' are pressed. LN_SZE corresponds to the Line size, or how much the slider moves when the left and right arrows are pressed. The tick frequency (TIC_FRQ) is an option that was implemented but not used. It, however, sets a tick mark at a certain interval throughout the slider bar. Finally, the range of the slider bar is set by 'MIN' and 'MAX', which are the minimum and the maximum. There are five Forgetting Factor constants that pertain to original edit box / slider settings. These constants are:
const double FORGETTING_PG_SZE = .2;
At the initialization of the 'Forgetting Factor' slider bar, certain constants are set. PG_SIZE corresponds to the Page Size, or how much the slider moves when the buttons 'Page Up' and 'Page Down' are pressed. LN_SZE corresponds to the Line size, or how much the slider moves when the left and right arrows are pressed. The tick frequency (TIC_FRQ) is an option that was implemented but not used. It, however, sets a tick mark at a certain interval throughout the slider bar. Finally, the range of the slider bar is set by 'MIN' and 'MAX', which are the minimum and the maximum. Muffler ClassesThe Muffler GUI contains five classes. The first four classes "CAboutDlg", "CDialogProperties", "CMufflerApp", and "CMufflerDlg" are all AppWizard created. The last class, "Data" is a user created class. CAboutDlg manages the 'About Muffler' dialog box and loads the copyright law string, CDialogProperties manages the 'Parameters' dialog box and all of its sliders / edit boxes, CMufflerApp and CMufflerDlg both manage the startup dialog, and Data manages data serialization between Muffler and the stub file's batch file. Muffler FunctionsThe Muffler GUI contains approximately twenty functions. Most of these functions have been modified in some way or another to make Muffler work. Shown below is a table of the functions that were predominantly created by myself along with a brief description of the purpose of the function.
Muffler Stub File IntegrationThe Muffler GUI used a single command to run the Win32 Console Application. The command 'system' enables a developer to run a program just as if one enters a command at the MS-DOS command prompt. This command enabled me to process a sound when a user clicked the 'Process' button. Muffler Data FileThe Muffler GUI communicates with the back-end algorithm executable using a batch file. The batch file is illustrated below.
Line 1: Input File |