home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / util / muispeechtoy-0.01.lha / MUISpeechToy / src / Speak.c < prev    next >
C/C++ Source or Header  |  1994-07-03  |  6KB  |  192 lines

  1. #include <libraries/mui.h>
  2. #include <proto/muimaster.h>
  3. #include <clib/exec_protos.h>
  4. #include <exec/memory.h>
  5.  
  6. #ifndef MAKE_ID
  7. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  8. #endif
  9.  
  10. #ifdef _DCC
  11. #define __inline
  12. #endif
  13.  
  14. /*    ExTended KeyButton ( or Eric Totel KeyButton :-) )    */
  15. /*    to use with localization features             */
  16.  
  17. static APTR __inline ETKeyButton(char *text)
  18. {
  19.         return (KeyButton(&text[3], text[1]));
  20. }
  21.  
  22. #include "Speak.h"
  23. #include "SpeakStrings.h"
  24.  
  25.  
  26. struct ObjApp * CreateApp( void )
  27. {
  28.     struct ObjApp * Object;
  29.  
  30.     if (!(Object = AllocVec( sizeof( struct ObjApp ), MEMF_PUBLIC|MEMF_CLEAR )))
  31.         return( NULL );
  32.  
  33.     Object->STR_TX_label_0 = GetString( MSG_TX_label_0 );
  34.     Object->STR_CY_SEX [0] = GetString( MSG_CY_SEX0 );
  35.     Object->STR_CY_SEX [1] = GetString( MSG_CY_SEX1 );
  36.     Object->STR_CY_SEX [2] = NULL;
  37.     Object->STR_TX_label_1 = GetString( MSG_TX_label_1 );
  38.     Object->STR_CY_KIND [0] = GetString( MSG_CY_KIND0 );
  39.     Object->STR_CY_KIND [1] = GetString( MSG_CY_KIND1 );
  40.     Object->STR_CY_KIND [2] = GetString( MSG_CY_KIND2 );
  41.     Object->STR_CY_KIND [3] = NULL;
  42.     Object->STR_TX_label_2 = GetString( MSG_TX_label_2 );
  43.     Object->STR_TX_label_3 = GetString( MSG_TX_label_3 );
  44.     Object->STR_TX_label_4 = GetString( MSG_TX_label_4 );
  45.     Object->STR_TX_label_5 = GetString( MSG_TX_label_5 );
  46.     Object->STR_TX_label_6 = GetString( MSG_TX_label_6 );
  47.  
  48.     Object->App = ApplicationObject,
  49.         MUIA_Application_Author, "Andreas Jung, Klosterstr. 21, D-66125 Saarbrücken, Germany",
  50.         MUIA_Application_Base, "MUISPEECHTOY",
  51.         MUIA_Application_Title, "MUI-Speechtoy",
  52.         MUIA_Application_Version, "$VER: MuiSpeechtoy 0.01 (03.07.94)",
  53.         MUIA_Application_Copyright, "This program is freely distributable ",
  54.         MUIA_Application_Description, GetString( MSG_AppDescription ),
  55.         SubWindow, Object->WIN_MAIN = WindowObject,
  56.             MUIA_Window_Title, GetString( MSG_WIN_MAIN ),
  57.             MUIA_Window_ID, MAKE_ID( '0','W','I','N' ),
  58.             WindowContents, GroupObject,
  59.                 Child, GroupObject,
  60.                     GroupFrameT( GetString( MSG_GR_grp_0 ) ),
  61.                     MUIA_Group_Columns, 2,
  62.                     Child, Object->TX_label_0 = TextObject,
  63.                         MUIA_Background, 128,
  64.                         MUIA_Text_Contents, Object->STR_TX_label_0,
  65.                         MUIA_Text_SetMax, 0,
  66.                         MUIA_Text_SetMin, 1,
  67.                         MUIA_Frame, 0,
  68.                     End,
  69.                     Child, Object->CY_SEX = CycleObject,
  70.                         MUIA_Cycle_Entries, Object->STR_CY_SEX,
  71.                     End,
  72.                     Child, Object->TX_label_1 = TextObject,
  73.                         MUIA_Background, 128,
  74.                         MUIA_Text_Contents, Object->STR_TX_label_1,
  75.                         MUIA_Text_SetMax, 0,
  76.                         MUIA_Text_SetMin, 1,
  77.                         MUIA_Frame, 0,
  78.                     End,
  79.                     Child, Object->CY_KIND = CycleObject,
  80.                         MUIA_Cycle_Entries, Object->STR_CY_KIND,
  81.                     End,
  82.                     Child, Object->TX_label_2 = TextObject,
  83.                         MUIA_Background, 128,
  84.                         MUIA_Text_Contents, Object->STR_TX_label_2,
  85.                         MUIA_Text_SetMax, 0,
  86.                         MUIA_Text_SetMin, 1,
  87.                         MUIA_Frame, 0,
  88.                     End,
  89.                     Child, Object->SL_HEIGHT = SliderObject,
  90.                         MUIA_Slider_Min, 65,
  91.                         MUIA_Slider_Max, 320,
  92.                         MUIA_Slider_Quiet, FALSE,
  93.                         MUIA_Slider_Level, 65,
  94.                         MUIA_Slider_Reverse, FALSE,
  95.                     End,
  96.                     Child, Object->TX_label_3 = TextObject,
  97.                         MUIA_Background, 128,
  98.                         MUIA_Text_Contents, Object->STR_TX_label_3,
  99.                         MUIA_Text_SetMax, 0,
  100.                         MUIA_Text_SetMin, 1,
  101.                         MUIA_Frame, 0,
  102.                     End,
  103.                     Child, Object->SL_SPEED = SliderObject,
  104.                         MUIA_Slider_Min, 40,
  105.                         MUIA_Slider_Max, 400,
  106.                         MUIA_Slider_Quiet, FALSE,
  107.                         MUIA_Slider_Level, 100,
  108.                         MUIA_Slider_Reverse, FALSE,
  109.                     End,
  110.                     Child, Object->TX_label_4 = TextObject,
  111.                         MUIA_Background, 128,
  112.                         MUIA_Text_Contents, Object->STR_TX_label_4,
  113.                         MUIA_Text_SetMax, 0,
  114.                         MUIA_Text_SetMin, 1,
  115.                         MUIA_Frame, 0,
  116.                     End,
  117.                     Child, Object->SL_VOLUME = SliderObject,
  118.                         MUIA_Slider_Min, 0,
  119.                         MUIA_Slider_Max, 64,
  120.                         MUIA_Slider_Quiet, FALSE,
  121.                         MUIA_Slider_Level, 64,
  122.                         MUIA_Slider_Reverse, FALSE,
  123.                     End,
  124.                 End,
  125.                 Child, GroupObject,
  126.                     GroupFrameT( GetString( MSG_GR_grp_3 ) ),
  127.                     MUIA_Group_Columns, 2,
  128.                     Child, Object->TX_label_5 = TextObject,
  129.                         MUIA_Background, 128,
  130.                         MUIA_Text_Contents, Object->STR_TX_label_5,
  131.                         MUIA_Text_SetMax, 0,
  132.                         MUIA_Text_SetMin, 1,
  133.                         MUIA_Frame, 0,
  134.                     End,
  135.                     Child, Object->SL_ENTHUSIASMUS = SliderObject,
  136.                         MUIA_Slider_Min, 0,
  137.                         MUIA_Slider_Max, 255,
  138.                         MUIA_Slider_Quiet, FALSE,
  139.                         MUIA_Slider_Level, 0,
  140.                         MUIA_Slider_Reverse, FALSE,
  141.                     End,
  142.                     Child, Object->TX_label_6 = TextObject,
  143.                         MUIA_Background, 128,
  144.                         MUIA_Text_Contents, Object->STR_TX_label_6,
  145.                         MUIA_Text_SetMax, 0,
  146.                         MUIA_Text_SetMin, 1,
  147.                         MUIA_Frame, 0,
  148.                     End,
  149.                     Child, Object->SL_PERTUBATION = SliderObject,
  150.                         MUIA_Slider_Min, 0,
  151.                         MUIA_Slider_Max, 255,
  152.                         MUIA_Slider_Quiet, FALSE,
  153.                         MUIA_Slider_Level, 0,
  154.                         MUIA_Slider_Reverse, FALSE,
  155.                     End,
  156.                 End,
  157.                 Child, GroupObject,
  158.                     Child, ColGroup( 2 ),
  159.                         Child, Label2( GetString( MSG_STR_TEXT ) ),
  160.                         Child, Object->STR_TEXT = StringObject,
  161.                             StringFrame,
  162.                             MUIA_String_MaxLen, 255,
  163.                             MUIA_String_Format, 0,
  164.                         End,
  165.                     End,
  166.                     Child, ColGroup( 2 ),
  167.                         Child, Label2( GetString( MSG_STR_PHONEME ) ),
  168.                         Child, Object->STR_PHONEME = StringObject,
  169.                             StringFrame,
  170.                             MUIA_String_MaxLen, 1000,
  171.                             MUIA_String_Format, 0,
  172.                         End,
  173.                     End,
  174.                     Child, Object->BT_SPEAK = ETKeyButton( GetString( MSG_BT_SPEAK ) ),
  175.                 End,
  176.             End,
  177.         End,
  178.     End;
  179.  
  180.     if (!(Object->App))
  181.     {
  182.         FreeVec(Object);
  183.         Object = NULL;
  184.     }
  185.     return( Object );
  186. }
  187.  
  188. void DisposeApp( struct ObjApp * Object )
  189. {
  190.     MUI_DisposeObject(Object->App);
  191.     FreeVec( Object );
  192. }