home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sound Sensations!
/
sound_sensations.iso
/
soundb
/
sndhack
/
fpaste.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-30
|
25KB
|
783 lines
#include <windows.h>
#include <string.h>
#include "app.h"
/*
* Module: fpaste.c
*
* Contains: Function paste specific functions. Menu
* commands are handled here, and Function paste dialog box
* callback functions should be located here.
*
*/
/*********************************************************************/
/* Local Function Prototypes */
/*********************************************************************/
/*********************************************************************/
/* Local data and structures */
/*********************************************************************/
extern SndDef SndState;
static BOOL b;
static int rc;
static char rcmsg[80];
static char str[255];
/*********************************************************************/
/* Global functions */
/*********************************************************************/
/*-------------------------------------------------------------------*/
/* Function paste command processor */
/*-------------------------------------------------------------------*/
void PasteMenuCommand(hWnd, id)
HWND hWnd;
int id;
{
switch (id) {
case IDM_CLOSESOUND:
EditPutString("CloseSound();\r");
break;
case IDM_COUNTVOICENOTES:
GoDialogBox(hInst, "DlgCountVoiceNotes", hWnd, DlgCountVoiceNotes);
break;
case IDM_GETTHRESHOLDEVENT:
EditPutString("GetThresholdEvent();\r");
break;
case IDM_GETTHRESHOLDSTATUS:
EditPutString("GetThresholdStatus();\r");
break;
case IDM_OPENSOUND:
EditPutString("OpenSound();\r");
break;
case IDM_SETSOUNDNOISE:
GoDialogBox(hInst, "DlgSetSoundNoise", hWnd, DlgSetSoundNoise);
break;
case IDM_SETVOICEACCENT:
GoDialogBox(hInst, "DlgSetVoiceAccent", hWnd, DlgSetVoiceAccent);
break;
case IDM_SETVOICEENVELOPE:
GoDialogBox(hInst, "DlgSetVoiceEnvelope", hWnd, DlgSetVoiceEnvelope);
break;
case IDM_SETVOICENOTE:
GoDialogBox(hInst, "DlgSetVoiceNote", hWnd, DlgSetVoiceNote);
break;
case IDM_SETVOICEQUEUESIZE:
GoDialogBox(hInst, "DlgSetVoiceQueueSize", hWnd, DlgSetVoiceQueueSize);
break;
case IDM_SETVOICESOUND:
GoDialogBox(hInst, "DlgSetVoiceSound", hWnd, DlgSetVoiceSound);
break;
case IDM_SETVOICETHRESHOLD:
GoDialogBox(hInst, "DlgSetVoiceThreshold", hWnd, DlgSetVoiceThreshold);
break;
case IDM_STARTSOUND:
EditPutString("StartSound();\r");
break;
case IDM_STOPSOUND:
EditPutString("StopSound();\r");
break;
case IDM_SYNCALLVOICES:
EditPutString("SyncAllVoices();\r");
break;
case IDM_WAITSOUNDSTATE:
GoDialogBox(hInst, "DlgWaitSoundState", hWnd, DlgWaitSoundState);
break;
default:
break;
}
}
/*-------------------------------------------------------------------*/
/* CountVoiceNotes dialog box callback function */
/*-------------------------------------------------------------------*/
BOOL FAR PASCAL DlgCountVoiceNotes(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
static char fname[] = "CountVoiceNotes";
switch (message) {
case WM_COMMAND:
switch (wParam) {
case IDD_OK:
SndState.voice = GetDlgItemInt(hDlg, IDD_COUNTVOICENOTES_VOICE, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_COUNTVOICENOTES_VOICE));
MessageBeep(0);
return(FALSE);
}
wsprintf(str,"%s(%d);\r",
(LPSTR)fname,
SndState.voice);
EditPutString(str);
case IDD_CANCEL:
EndDialog(hDlg, NULL);
return(TRUE);
case IDD_HELP:
WinHelp(hDlg,HelpFileName,HELP_KEY,(DWORD)(LPSTR)fname);
return(TRUE);
default:
break;
}
return(FALSE);
case WM_INITDIALOG:
SetDlgItemInt(hDlg, IDD_COUNTVOICENOTES_VOICE, SndState.voice, TRUE);
break;
default:
return(FALSE);
}
return(TRUE);
}
/*-------------------------------------------------------------------*/
/* SetSoundNoise dialog box callback function */
/*-------------------------------------------------------------------*/
BOOL FAR PASCAL DlgSetSoundNoise(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
static char fname[] = "SetSoundNoise";
static char sourcestr[15];
switch (message) {
case WM_COMMAND:
switch (wParam) {
case IDD_OK:
GetDlgItemText(hDlg, IDD_SETSOUNDNOISE_SOURCE, sourcestr, sizeof(sourcestr)-1);
if (strcmp(sourcestr,"S_PERIOD512") == 0)
SndState.source = S_PERIOD512;
else if (strcmp(sourcestr,"S_PERIOD1024") == 0)
SndState.source = S_PERIOD1024;
else if (strcmp(sourcestr,"S_PERIOD2048") == 0)
SndState.source = S_PERIOD2048;
else if (strcmp(sourcestr,"S_PERIODVOICE") == 0)
SndState.source = S_PERIODVOICE;
else if (strcmp(sourcestr,"S_WHITE512") == 0)
SndState.source = S_WHITE512;
else if (strcmp(sourcestr,"S_WHITE1024") == 0)
SndState.source = S_WHITE1024;
else if (strcmp(sourcestr,"S_WHITE2048") == 0)
SndState.source = S_WHITE2048;
else if (strcmp(sourcestr,"S_WHITEVOICE") == 0)
SndState.source = S_WHITEVOICE;
else {
SetFocus(GetDlgItem(hDlg, IDD_SETSOUNDNOISE_SOURCE));
MessageBeep(0);
return(FALSE);
}
SndState.duration = GetDlgItemInt(hDlg, IDD_SETSOUNDNOISE_DURATION, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETSOUNDNOISE_DURATION));
MessageBeep(0);
return(FALSE);
}
wsprintf(str,"%s(%s, %d);\r",
(LPSTR)fname,
(LPSTR)sourcestr,
SndState.duration);
EditPutString(str);
case IDD_CANCEL:
EndDialog(hDlg, NULL);
return(TRUE);
case IDD_HELP:
WinHelp(hDlg,HelpFileName,HELP_KEY,(DWORD)(LPSTR)fname);
return(TRUE);
default:
break;
}
return(FALSE);
case WM_INITDIALOG:
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_PERIOD512"));
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_PERIOD1024"));
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_PERIOD2048"));
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_PERIODVOICE"));
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_WHITE512"));
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_WHITE1024"));
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_WHITE2048"));
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_WHITEVOICE"));
if (SndState.source == S_PERIOD512)
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_PERIOD512"));
else if (SndState.source == S_PERIOD1024)
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_PERIOD1024"));
else if (SndState.source == S_PERIOD2048)
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_PERIOD2048"));
else if (SndState.source == S_PERIODVOICE)
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_PERIODVOICE"));
else if (SndState.source == S_WHITE512)
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_WHITE512"));
else if (SndState.source == S_WHITE1024)
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_WHITE1024"));
else if (SndState.source == S_WHITE2048)
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_WHITE2048"));
else {
SendDlgItemMessage(hDlg,IDD_SETSOUNDNOISE_SOURCE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_WHITEVOICE"));
SndState.source = S_WHITEVOICE;
}
SetDlgItemInt(hDlg, IDD_SETSOUNDNOISE_DURATION, SndState.duration, TRUE);
break;
default:
return(FALSE);
}
return(TRUE);
}
/*-------------------------------------------------------------------*/
/* SetVoiceAccent dialog box callback function */
/*-------------------------------------------------------------------*/
BOOL FAR PASCAL DlgSetVoiceAccent(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
static char fname[] = "SetVoiceAccent";
static char modestr[11];
switch (message) {
case WM_COMMAND:
switch (wParam) {
case IDD_OK:
SndState.voice = GetDlgItemInt(hDlg, IDD_SETVOICEACCENT_VOICE, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICEACCENT_VOICE));
MessageBeep(0);
return(FALSE);
}
SndState.tempo = GetDlgItemInt(hDlg, IDD_SETVOICEACCENT_TEMPO, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICEACCENT_TEMPO));
MessageBeep(0);
return(FALSE);
}
SndState.volume = GetDlgItemInt(hDlg, IDD_SETVOICEACCENT_VOLUME, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICEACCENT_VOLUME));
MessageBeep(0);
return(FALSE);
}
GetDlgItemText(hDlg, IDD_SETVOICEACCENT_MODE, modestr, sizeof(modestr)-1);
if (strcmp(modestr,"S_LEGATO") == 0)
SndState.mode = S_LEGATO;
else if (strcmp(modestr,"S_NORMAL") == 0)
SndState.mode = S_NORMAL;
else if (strcmp(modestr,"S_STACCATO") == 0)
SndState.mode = S_STACCATO;
else {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICEACCENT_MODE));
MessageBeep(0);
return(FALSE);
}
SndState.pitch = GetDlgItemInt(hDlg, IDD_SETVOICEACCENT_PITCH, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICEACCENT_PITCH));
MessageBeep(0);
return(FALSE);
}
wsprintf(str,"%s(%d, %d, %d, %s, %d);\r",
(LPSTR)fname,
SndState.voice,
SndState.tempo,
SndState.volume,
(LPSTR)modestr,
SndState.pitch);
EditPutString(str);
case IDD_CANCEL:
EndDialog(hDlg, NULL);
return(TRUE);
case IDD_HELP:
WinHelp(hDlg,HelpFileName,HELP_KEY,(DWORD)(LPSTR)fname);
return(TRUE);
default:
break;
}
return(FALSE);
case WM_INITDIALOG:
SetDlgItemInt(hDlg, IDD_SETVOICEACCENT_VOICE, SndState.voice, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICEACCENT_TEMPO, SndState.tempo, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICEACCENT_VOLUME, SndState.volume, TRUE);
SendDlgItemMessage(hDlg,IDD_SETVOICEACCENT_MODE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_LEGATO"));
SendDlgItemMessage(hDlg,IDD_SETVOICEACCENT_MODE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_NORMAL"));
SendDlgItemMessage(hDlg,IDD_SETVOICEACCENT_MODE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_STACCATO"));
if (SndState.mode == S_LEGATO)
SendDlgItemMessage(hDlg,IDD_SETVOICEACCENT_MODE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_LEGATO"));
else if (SndState.mode == S_STACCATO)
SendDlgItemMessage(hDlg,IDD_SETVOICEACCENT_MODE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_STACCATO"));
else {
SendDlgItemMessage(hDlg,IDD_SETVOICEACCENT_MODE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_NORMAL"));
SndState.mode = S_NORMAL;
}
SetDlgItemInt(hDlg, IDD_SETVOICEACCENT_PITCH, SndState.pitch, TRUE);
break;
default:
return(FALSE);
}
return(TRUE);
}
/*-------------------------------------------------------------------*/
/* SetVoiceEnvelope dialog box callback function */
/*-------------------------------------------------------------------*/
BOOL FAR PASCAL DlgSetVoiceEnvelope(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
static char fname[] = "SetVoiceEnvelope";
switch (message) {
case WM_COMMAND:
switch (wParam) {
case IDD_OK:
SndState.voice = GetDlgItemInt(hDlg, IDD_SETVOICEENVELOPE_VOICE, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICEENVELOPE_VOICE));
MessageBeep(0);
return(FALSE);
}
SndState.shape = GetDlgItemInt(hDlg, IDD_SETVOICEENVELOPE_SHAPE, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICEENVELOPE_SHAPE));
MessageBeep(0);
return(FALSE);
}
SndState.repeat = GetDlgItemInt(hDlg, IDD_SETVOICEENVELOPE_REPEAT, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICEENVELOPE_REPEAT));
MessageBeep(0);
return(FALSE);
}
wsprintf(str,"%s(%d, %d, %d);\r",
(LPSTR)fname,
SndState.voice,
SndState.shape,
SndState.repeat);
EditPutString(str);
case IDD_CANCEL:
EndDialog(hDlg, NULL);
return(TRUE);
case IDD_HELP:
WinHelp(hDlg,HelpFileName,HELP_KEY,(DWORD)(LPSTR)fname);
return(TRUE);
default:
break;
}
return(FALSE);
case WM_INITDIALOG:
SetDlgItemInt(hDlg, IDD_SETVOICEENVELOPE_VOICE, SndState.voice, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICEENVELOPE_SHAPE, SndState.shape, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICEENVELOPE_REPEAT, SndState.repeat, TRUE);
break;
default:
return(FALSE);
}
return(TRUE);
}
/*-------------------------------------------------------------------*/
/* SetVoiceNote dialog box callback function */
/*-------------------------------------------------------------------*/
BOOL FAR PASCAL DlgSetVoiceNote(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
static char fname[] = "SetVoiceNote";
static char notestr[5];
switch (message) {
case WM_COMMAND:
switch (wParam) {
case IDD_OK:
SndState.voice = GetDlgItemInt(hDlg, IDD_SETVOICENOTE_VOICE, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICENOTE_VOICE));
MessageBeep(0);
return(FALSE);
}
GetDlgItemText(hDlg, IDD_SETVOICENOTE_VALUE, notestr, sizeof(notestr)-1);
b = PlayNoteConvert(notestr,&SndState.value);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICENOTE_VALUE));
MessageBeep(0);
return(FALSE);
}
SndState.length = GetDlgItemInt(hDlg, IDD_SETVOICENOTE_LENGTH, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICENOTE_LENGTH));
MessageBeep(0);
return(FALSE);
}
SndState.cdots = GetDlgItemInt(hDlg, IDD_SETVOICENOTE_CDOTS, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICENOTE_CDOTS));
MessageBeep(0);
return(FALSE);
}
wsprintf(str,"%s(%d, %d, %d, %d);\r",
(LPSTR)fname,
SndState.voice,
SndState.value,
SndState.length,
SndState.cdots);
EditPutString(str);
case IDD_CANCEL:
EndDialog(hDlg, NULL);
return(TRUE);
case IDD_HELP:
WinHelp(hDlg,HelpFileName,HELP_KEY,(DWORD)(LPSTR)fname);
return(TRUE);
default:
break;
}
return(FALSE);
case WM_INITDIALOG:
SetDlgItemInt(hDlg, IDD_SETVOICENOTE_VOICE, SndState.voice, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICENOTE_VALUE, SndState.value, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICENOTE_LENGTH, SndState.length, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICENOTE_CDOTS, SndState.cdots, TRUE);
break;
default:
return(FALSE);
}
return(TRUE);
}
/*-------------------------------------------------------------------*/
/* SetVoiceQueueSize dialog box callback function */
/*-------------------------------------------------------------------*/
BOOL FAR PASCAL DlgSetVoiceQueueSize(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
static char fname[] = "SetVoiceQueueSize";
switch (message) {
case WM_COMMAND:
switch (wParam) {
case IDD_OK:
SndState.voice = GetDlgItemInt(hDlg, IDD_SETVOICEQUEUESIZE_VOICE, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICEQUEUESIZE_VOICE));
MessageBeep(0);
return(FALSE);
}
SndState.qsize= GetDlgItemInt(hDlg, IDD_SETVOICEQUEUESIZE_QSIZE, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICEQUEUESIZE_QSIZE));
MessageBeep(0);
return(FALSE);
}
wsprintf(str,"%s(%d, %d);\r",
(LPSTR)fname,
SndState.voice,
SndState.qsize);
EditPutString(str);
case IDD_CANCEL:
EndDialog(hDlg, NULL);
return(TRUE);
case IDD_HELP:
WinHelp(hDlg,HelpFileName,HELP_KEY,(DWORD)(LPSTR)fname);
return(TRUE);
default:
break;
}
return(FALSE);
case WM_INITDIALOG:
SetDlgItemInt(hDlg, IDD_SETVOICEQUEUESIZE_VOICE, SndState.voice, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICEQUEUESIZE_QSIZE, SndState.qsize, TRUE);
break;
default:
return(FALSE);
}
return(TRUE);
}
/*-------------------------------------------------------------------*/
/* SetVoiceSound dialog box callback function */
/*-------------------------------------------------------------------*/
BOOL FAR PASCAL DlgSetVoiceSound(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
static char fname[] = "SetVoiceSound";
switch (message) {
case WM_COMMAND:
switch (wParam) {
case IDD_OK:
SndState.voice = GetDlgItemInt(hDlg, IDD_SETVOICESOUND_VOICE, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICESOUND_VOICE));
MessageBeep(0);
return(FALSE);
}
SndState.frequency = GetDlgItemInt(hDlg, IDD_SETVOICESOUND_FREQUENCY, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICESOUND_FREQUENCY));
MessageBeep(0);
return(FALSE);
}
SndState.fraction = GetDlgItemInt(hDlg, IDD_SETVOICESOUND_FRACTION, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICESOUND_FRACTION));
MessageBeep(0);
return(FALSE);
}
SndState.duration = GetDlgItemInt(hDlg, IDD_SETVOICESOUND_DURATION, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICESOUND_DURATION));
MessageBeep(0);
return(FALSE);
}
SndState.lfreq = ((LONG)SndState.frequency << 16) + SndState.fraction;
wsprintf(str,"%s(%d, 0x%lx, %d);\r",
(LPSTR)fname,
SndState.voice,
SndState.lfreq,
SndState.duration);
EditPutString(str);
case IDD_CANCEL:
EndDialog(hDlg, NULL);
return(TRUE);
case IDD_HELP:
WinHelp(hDlg,HelpFileName,HELP_KEY,(DWORD)(LPSTR)fname);
return(TRUE);
default:
break;
}
return(FALSE);
case WM_INITDIALOG:
SetDlgItemInt(hDlg, IDD_SETVOICESOUND_VOICE, SndState.voice, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICESOUND_FREQUENCY, SndState.frequency, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICESOUND_FRACTION, SndState.fraction, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICESOUND_DURATION, SndState.duration, TRUE);
break;
default:
return(FALSE);
}
return(TRUE);
}
/*-------------------------------------------------------------------*/
/* SetVoiceThreshold dialog box callback function */
/*-------------------------------------------------------------------*/
BOOL FAR PASCAL DlgSetVoiceThreshold(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
static char fname[] = "SetVoiceThreshold";
switch (message) {
case WM_COMMAND:
switch (wParam) {
case IDD_OK:
SndState.voice = GetDlgItemInt(hDlg, IDD_SETVOICETHRESHOLD_VOICE, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICETHRESHOLD_VOICE));
MessageBeep(0);
return(FALSE);
}
SndState.tcount = GetDlgItemInt(hDlg, IDD_SETVOICETHRESHOLD_TCOUNT, &b, FALSE);
if (!b) {
SetFocus(GetDlgItem(hDlg, IDD_SETVOICETHRESHOLD_TCOUNT));
MessageBeep(0);
return(FALSE);
}
wsprintf(str,"%s(%d, %d);\r",
(LPSTR)fname,
SndState.voice,
SndState.tcount);
EditPutString(str);
case IDD_CANCEL:
EndDialog(hDlg, NULL);
return(TRUE);
case IDD_HELP:
WinHelp(hDlg,HelpFileName,HELP_KEY,(DWORD)(LPSTR)fname);
return(TRUE);
default:
break;
}
return(FALSE);
case WM_INITDIALOG:
SetDlgItemInt(hDlg, IDD_SETVOICETHRESHOLD_VOICE, SndState.voice, TRUE);
SetDlgItemInt(hDlg, IDD_SETVOICETHRESHOLD_TCOUNT, SndState.tcount, TRUE);
break;
default:
return(FALSE);
}
return(TRUE);
}
/*-------------------------------------------------------------------*/
/* WaitSoundState dialog box callback function */
/*-------------------------------------------------------------------*/
BOOL FAR PASCAL DlgWaitSoundState(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
static char fname[] = "WaitSoundState";
static char waitstr[15];
switch (message) {
case WM_COMMAND:
switch (wParam) {
case IDD_OK:
GetDlgItemText(hDlg, IDD_WAITSOUNDSTATE_STATE, waitstr, sizeof(waitstr)-1);
if (strcmp(waitstr,"S_ALLTHRESHOLD") == 0)
SndState.waitstate = S_ALLTHRESHOLD;
else if (strcmp(waitstr,"S_QUEUEEMPTY") == 0)
SndState.waitstate = S_QUEUEEMPTY;
else if (strcmp(waitstr,"S_THRESHOLD") == 0)
SndState.waitstate = S_THRESHOLD;
else {
SetFocus(GetDlgItem(hDlg, IDD_WAITSOUNDSTATE_STATE));
MessageBeep(0);
return(FALSE);
}
wsprintf(str,"%s(%s);\r",
(LPSTR)fname,
(LPSTR)waitstr);
EditPutString(str);
case IDD_CANCEL:
EndDialog(hDlg, NULL);
return(TRUE);
case IDD_HELP:
WinHelp(hDlg,HelpFileName,HELP_KEY,(DWORD)(LPSTR)fname);
return(TRUE);
default:
break;
}
return(FALSE);
case WM_INITDIALOG:
SendDlgItemMessage(hDlg,IDD_WAITSOUNDSTATE_STATE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_ALLTHRESHOLD"));
SendDlgItemMessage(hDlg,IDD_WAITSOUNDSTATE_STATE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_QUEUEEMPTY"));
SendDlgItemMessage(hDlg,IDD_WAITSOUNDSTATE_STATE,CB_ADDSTRING,0,(DWORD)((LPSTR)"S_THRESHOLD"));
if (SndState.waitstate == S_ALLTHRESHOLD)
SendDlgItemMessage(hDlg,IDD_WAITSOUNDSTATE_STATE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_ALLTHRESHOLD"));
else if (SndState.waitstate == S_THRESHOLD)
SendDlgItemMessage(hDlg,IDD_WAITSOUNDSTATE_STATE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_THRESHOLD"));
else {
SendDlgItemMessage(hDlg,IDD_WAITSOUNDSTATE_STATE,CB_SELECTSTRING,0,(DWORD)((LPSTR)"S_QUEUEEMPTY"));
SndState.waitstate = S_QUEUEEMPTY;
}
break;
default:
return(FALSE);
}
return(TRUE);
}