home *** CD-ROM | disk | FTP | other *** search
- /* Front end for EventSound application
- * Front end version 1.00
- * Written in ARM C version 3.0
- * By and (c) Neil A Carson 1993 A.D.
- * FreeWare!
- */
-
- #include "baricon.h"
- #include "dbox.h"
- #include "event.h"
- #include "kernel.h"
- #include "menu.h"
- #include "res.h"
- #include "resspr.h"
- #include "template.h"
- #include "visdelay.h"
- #include "werr.h"
- #include "wimp.h"
- #include "wimpt.h"
- #include "win.h"
-
- #include <stdlib.h>
- #include <string.h>
-
- #define event_count 14
- #define EvSound_VoiceInfo 0xDFFC1
- #define EvSound_WriteVoiceName 0xDFFC2
- #define EvSound_WriteTuning 0xDFFC3
- #define ins_path_prefix 13
-
- int events[event_count] =
- {
- 0x4,
- 0x6,
- 0x9,
- 0x27,
- 0x2A,
- 0x45,
- 0x46,
- 0x49,
- 0x4A,
- 0x4D,
- 0x4E,
- 0x52,
- 0x53,
- 0x57
- };
- char voice_string[64] = "Sample";
- menu main_menu;
- dbox main_win;
- char path_prefix[32] = "<Sounds$Dir>.";
- int sound_tuning = 0;
-
- void show_main(wimp_i);
- void main_menu_handler(void *, char *);
- void get_filenames(void);
- void set_filenames(void);
-
- int main(void)
- {
- _kernel_swi_regs r;
-
- visdelay_begin();
- trace_on();
- wimpt_init("Event Sounder");
- res_init("EvSound");
- resspr_init();
- template_init();
- baricon("!Ev Sound", (int) resspr_area(), show_main);
- main_menu = menu_new("EvSound", ">Info,Quit");
- event_attachmenu(win_ICONBAR, main_menu, main_menu_handler, 0);
-
- r.r[0] = (int) voice_string;
- _kernel_swi(EvSound_WriteVoiceName, &r, &r);
-
- visdelay_end();
-
- for (;;)
- event_process();
- }
-
- void main_menu_handler(void *handle, char *hit)
- {
- handle = handle; /* Stops compiler warning */
-
- switch (hit[0])
- {
- case 1:
- {
- dbox d = dbox_new("Info");
- dbox_show(d);
- dbox_fillin(d);
- dbox_dispose(&d);
- }
- break;
-
- case 2:
- exit(0);
- break;
- }
- }
-
- void show_main(wimp_i icon)
- {
- BOOL filling = TRUE;
-
- icon = icon;
-
- main_win = dbox_new("Main");
- set_filenames();
- dbox_showstatic(main_win);
-
- while (filling)
- {
- switch (dbox_fillin(main_win))
- {
- case 30:
- get_filenames();
- filling = FALSE;
- dbox_dispose(&main_win);
- break;
-
- case dbox_CLOSE:
- filling = FALSE;
- dbox_dispose(&main_win);
- break;
- }
- }
- }
-
- void set_filenames(void)
- {
- _kernel_swi_regs r;
- int cnt;
- char *base;
-
- for (cnt=0; cnt<event_count; cnt++)
- {
- r.r[0] = events[cnt];
- _kernel_swi(EvSound_VoiceInfo, &r, &r);
-
- if (r.r[0] == 0) werr(1,"Fatal error: Event not found! Report!");
- base = (char *) (r.r[0] + ins_path_prefix);
- dbox_setfield(main_win, cnt + 16, base);
- }
- dbox_setfield(main_win, 31, voice_string);
- dbox_setnumeric(main_win, 34, sound_tuning);
- }
-
- void get_filenames(void)
- {
- _kernel_swi_regs r;
- int cnt;
- char temp[32];
- int *base;
-
- for (cnt=0; cnt<event_count; cnt++)
- {
- r.r[0] = events[cnt];
- _kernel_swi(EvSound_VoiceInfo, &r, &r);
-
- if (r.r[0] == 0) werr(1,"Fatal error: Event not found! Report!");
- strcpy(&temp[0], path_prefix);
- dbox_getfield(main_win, cnt + 16, &temp[ins_path_prefix],
- 32-ins_path_prefix);
- strncpy((char *) r.r[0], temp, 31);
- if ((temp[ins_path_prefix+1] == 0) || (temp[ins_path_prefix] == 0))
- {
- base = (int *) r.r[0];
- *base= 0;
- }
- }
- dbox_getfield(main_win, 31, voice_string, 63);
- r.r[0] = (int) voice_string;
- _kernel_swi(EvSound_WriteVoiceName, &r, &r);
- sound_tuning = dbox_getnumeric(main_win, 34);
- r.r[0] = sound_tuning;
- _kernel_swi(EvSound_WriteTuning, &r, &r);
- }
-