rem: ULONG clip = FALSE, actime = 0;
add: ULONG clip = FALSE, actime = 0, scalemode = AHI_SCALE_FIXED_0_DB;
context: void EventLoop(void){  ULONG sigs = 0UL;  while (1)  {    ULONG rc = DoMethod(MUIApp, MUIM_Application_NewInput, &sigs);    switch(rc)    {      case MUIV_Application_ReturnID_Quit:        return;      case ACTID_OPEN:      {        struct FileRequester *request;        request = MUI_AllocAslRequestTags(ASL_FileRequest,             ASLFR_Window, xget(MUIWindow, MUIA_Window_Window),            ASLFR_TitleText, msgTextProgramName,             ASLFR_RejectIcons, TRUE,             ASLFR_InitialDrawer, "SYS:Prefs/Presets",            TAG_DONE );        if( request != NULL )        {          DoMethod(MUIApp, MUIA_Application_Sleep, TRUE);          if (MUI_AslRequest(request, NULL))          {            char *file;            DoMethod(MUIApp, MUIA_Application_Sleep, FALSE);                        file = AllocVec(strlen(request->fr_Drawer)+128,0);                        if( file != NULL )            {              CopyMem(request->fr_Drawer, file, strlen(request->fr_Drawer)+1);              AddPart(file, request->fr_File, 128);              NewSettings(file);              GUINewSettings();              FreeVec(file);            }          }          else          {            DoMethod(MUIApp, MUIA_Application_Sleep, FALSE);          }          MUI_FreeAslRequest(request);        }        break;      }      case ACTID_SAVEAS:      {        struct FileRequester *request;        request = MUI_AllocAslRequestTags(ASL_FileRequest,            ASLFR_Window, xget(MUIWindow, MUIA_Window_Window),            ASLFR_TitleText, msgTextProgramName,            ASLFR_RejectIcons, TRUE,            ASLFR_DoSaveMode, TRUE,            ASLFR_InitialDrawer, "SYS:Prefs/Presets",            TAG_DONE);                    if(request != NULL )        {          DoMethod(MUIApp, MUIA_Application_Sleep, TRUE);          FillUnit();          if (MUI_AslRequest(request, NULL))          {            char *file;            DoMethod(MUIApp, MUIA_Application_Sleep, FALSE);                        file = AllocVec(strlen(request->fr_Drawer)+128,0);                        if( file != NULL )            {              CopyMem(request->fr_Drawer, file, strlen(request->fr_Drawer)+1);              AddPart(file, request->fr_File, 128);              SaveSettings(file, UnitList);              if(SaveIcons)              {                WriteIcon(file);              }              FreeVec(file);            }          }          else          {            DoMethod(MUIApp, MUIA_Application_Sleep, FALSE);          }          MUI_FreeAslRequest(request);        }        break;      }      case ACTID_ABOUT:      {        char* args[] = { "\033c",                          (char*)msgTextProgramName,                         "1996-2004 Stphane Barbaray/Martin Blom"                       };        MUI_RequestA(MUIApp, MUIWindow, 0, (char *) msgTextProgramName,            (char*)msgButtonOK, (char*)msgTextCopyright, args );        break;      }      case ACTID_SAVE:        FillUnit();        SaveSettings(ENVFILE, UnitList);        SaveSettings(ENVARCFILE, UnitList);        return;      case ACTID_USE:        FillUnit();        SaveSettings(ENVFILE, UnitList);        return;      case ACTID_QUIT:        return;      case ACTID_DEFAULT:        NewSettings(NULL);        GUINewSettings();        break;      case ACTID_LASTSAVED:        NewSettings(ENVARCFILE);        GUINewSettings();        break;      case ACTID_RESTORE:        NewSettings(args.from);        GUINewSettings();        break;      case ACTID_ICONS:      {        APTR item = (APTR)DoMethod(MUIMenu,MUIM_FindUData,ACTID_ICONS);        if(item)        {          if(xget(item, MUIA_Menuitem_Checked))          {            SaveIcons = TRUE;          }          else          {            SaveIcons = FALSE;          }        }        break;      }      case ACTID_HELP:        DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"AHI",0);        break;      case ACTID_GUIDE:        DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"MAIN",0);        break;      case ACTID_HELPINDEX:        DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"Concept Index",0);        break;      case ACTID_UNIT:        FillUnit();        NewUnit(xget(MUIUnit,MUIA_Cycle_Active));        GUINewUnit();        break;      case ACTID_MODE:        FillUnit();        NewMode(xget(MUIList, MUIA_List_Active));        GUINewMode();        break;              case ACTID_SCALEMODE:      {        ULONG scalemode = AHI_SCALE_FIXED_SAFE;        get(MUIScalemode, MUIA_Cycle_Active, &scalemode);        state.ScaleModeSelected = scalemode;        break;      }	      case ACTID_PLAY:      {        int              unit_id;        struct UnitNode* unit;        FillUnit();        unit_id = xget( MUIUnit, MUIA_Cycle_Active );        unit    = (struct UnitNode *) GetNode( unit_id, UnitList );                PlaySound( &unit->prefs );        break;      }      case ACTID_DEBUG:      case ACTID_SURROUND:      case ACTID_ECHO:      case ACTID_CPULIMIT:      case ACTID_CLIPMV:      case ACTID_ACTIME:      {        ULONG debug = AHI_DEBUG_NONE, surround = FALSE, echo = 0, cpu = 90;        ULONG clip = FALSE, actime = 0;        get(MUIDebug, MUIA_Cycle_Active, &debug);        get(MUISurround, MUIA_Cycle_Active, &surround);        get(MUIEcho, MUIA_Cycle_Active, &echo);        get(MUIClipvol, MUIA_Cycle_Active, &clip);        get(MUICpu, MUIA_Numeric_Value, &cpu);        get(MUIACTime, MUIA_Numeric_Value, &actime);        globalprefs.ahigp_DebugLevel       = debug;        globalprefs.ahigp_DisableSurround  = surround;        globalprefs.ahigp_DisableEcho      = (echo == 2);        globalprefs.ahigp_FastEcho         = (echo == 1);        globalprefs.ahigp_MaxCPU           = ((cpu << 16) + 50) / 100;        globalprefs.ahigp_ClipMasterVolume = clip;        globalprefs.ahigp_AntiClickTime    = ((actime << 16) + 500) / 1000;        break;      }    }    if (sigs)    {      sigs = Wait(sigs | SIGBREAKF_CTRL_C);      if (sigs & SIGBREAKF_CTRL_C)	return;    }  }}