src/proser_interface.c
author Markus Bröker <mbroeker@largo.dyndns.tv>
Tue, 02 Feb 2010 13:41:48 +0100
changeset 3 a80adbcf4882
parent 0 06dd3b8d90ad
permissions -rw-r--r--
Default txt2pho file committer: Markus Bröker <mbroeker@largo.homelinux.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     1
/**
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     2
 *  $Id: proser_interface.c 53 2008-01-10 00:19:41Z mbroeker $
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     3
 * $URL: http://localhost/svn/c/VirtualReader/trunk/src/proser_interface.c $
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     4
 */
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     5
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     6
#ifdef PROSER
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     7
#include <proser_interface.h>
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     8
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     9
ttshandles interface_init (tts_options propt)
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    10
{
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    11
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    12
    ttshandles pr_handle;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    13
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    14
    // initialize Proser options and set default values for a given voice
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    15
    if (init_ProserOpt (&propt.ProserOpt, propt.Voice)) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    16
        fprintf (stderr, "Fatal error occurred in set_ProserOpt: %s\n", GetLastNlpErrorDescription (NULL));
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    17
        exit (-1);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    18
    }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    19
    // the path to the TTS input data like dictionaries and prosodic stuff has to be set
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    20
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    21
    propt.ProserOpt.Path = strdup (propt.Path);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    22
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    23
    // here some more manipulations of the standard settings can be done
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    24
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    25
    propt.ProserOpt.PreEmphasis = propt.PreEmphasis;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    26
    propt.ProserOpt.Speed = propt.Speed;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    27
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    28
    // initialize channel //
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    29
    if (!(pr_handle.GermanNlp = OpenNlp (&propt.ProserOpt))) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    30
        fprintf (stderr, "Fatal error occurred in OpenNlp: %s (%d)\n",
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    31
                 GetLastNlpErrorDescription (pr_handle.GermanNlp), (int)GetLastNlpError (pr_handle.GermanNlp));
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    32
        exit (-1);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    33
    }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    34
    // delete structure for Proser Options //
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    35
    if (delete_ProserOpt (&propt.ProserOpt)) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    36
        fprintf (stderr, "Fatal error occurred in delete_ProserOpt: %s\n", GetLastNlpErrorDescription (NULL));
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    37
        exit (-1);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    38
    }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    39
    return pr_handle;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    40
}
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    41
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    42
int interface_write_to_wav (char *Filename, char *Text, ttshandles prosh, tts_options propt)
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    43
{
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    44
    // write Text to a file
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    45
    if (ProserSynthText (prosh.GermanNlp, Text, Filename, propt.FileType, propt.Stype)) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    46
        fprintf (stderr, "Fatal error occurred in ProserSynthText: %s\n", GetLastNlpErrorDescription (prosh.GermanNlp));
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    47
        return (-1);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    48
    }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    49
    return (0);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    50
}
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    51
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    52
long *interface_get_timing (ttshandles prosh, char *Text)
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    53
{
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    54
    // analyze given text, return array with long values containing
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    55
    // time in ms when each word of the given text will start in the
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    56
    // output
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    57
    long *timings = NULL;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    58
    LPPHONEME PhoneticSentenceDescription;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    59
    long NumberOfPhoneticUnits;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    60
    int i = 0, WordNum = 0;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    61
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    62
    PhoneticSentenceDescription = TextToPho (prosh.GermanNlp, Text, &NumberOfPhoneticUnits);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    63
#ifdef DEBUG
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    64
    printf ("\n[S] %s\n", Text);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    65
#endif
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    66
    while (i < (NumberOfPhoneticUnits - 1)) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    67
        if (PhoneticSentenceDescription[i + 1].Event != 0) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    68
            timings = realloc (timings, (WordNum + 2) * sizeof (long));
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    69
            timings[WordNum] = PhoneticSentenceDescription[i + 1].Offset;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    70
#ifdef DEBUG
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    71
            printf ("Wort:\t %i \t Time: %ld ms\n", WordNum, PhoneticSentenceDescription[i + 1].Offset);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    72
#endif
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    73
            WordNum++;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    74
        }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    75
        i++;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    76
    }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    77
    timings[WordNum] = 0;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    78
    return timings;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    79
}
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    80
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    81
tts_options interface_get_cl_opts (int argc, char **argv)
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    82
{
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    83
    int i, j;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    84
    tts_options propt;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    85
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    86
    propt.TextFile = propt.AudioFile = propt.Voice = propt.Path = NULL;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    87
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    88
    j = 0;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    89
    propt.PreEmphasis = 0.0f;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    90
    propt.Speed = 1.0f;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    91
    propt.Stype = LIN16;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    92
    propt.FileType = WAV;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    93
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    94
    for (i = 1; i < argc; i++) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    95
        if (!strcmp (argv[i], "-i")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    96
            propt.TextFile = argv[++i];
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    97
            continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    98
        } else if (!strcmp (argv[i], "-o")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    99
            propt.AudioFile = argv[++i];
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   100
            continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   101
        } else if (!strcmp (argv[i], "-v")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   102
            propt.Voice = argv[++i];
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   103
            continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   104
        } else if (!strcmp (argv[i], "-p")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   105
            propt.Path = argv[++i];
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   106
            continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   107
        } else if (!strcmp (argv[i], "-pre")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   108
            propt.PreEmphasis = atof (argv[++i]);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   109
            continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   110
        } else if (!strcmp (argv[i], "-speed")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   111
            propt.Speed = atof (argv[++i]);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   112
            continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   113
        } else if (!strcmp (argv[i], "-format")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   114
            i++;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   115
            for (j = 0; j < (int)strlen (argv[i]); j++)
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   116
                argv[i][j] = toupper (argv[i][j]);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   117
            if (!strcmp (argv[i], "RAW")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   118
                propt.FileType = RAW;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   119
                continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   120
            } else if (!strcmp (argv[i], "WAV")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   121
                propt.FileType = WAV;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   122
                continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   123
            } else if (!strcmp (argv[i], "AU")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   124
                propt.FileType = AU;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   125
                continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   126
            } else {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   127
                fprintf (stderr, "Unknown output type %s\n", argv[i]);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   128
                fprintf (stderr, "Supported output types: RAW - AU - WAV\n");
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   129
                exit (-1);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   130
            }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   131
        }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   132
        if (strcmp (argv[i], "-audio") == 0) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   133
            i++;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   134
            for (j = 0; j < strlen (argv[i]); j++)
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   135
                argv[i][j] = toupper (argv[i][j]);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   136
            if (!strcmp (argv[i], "LIN16")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   137
                propt.Stype = LIN16;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   138
                continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   139
            } else if (!strcmp (argv[i], "LIN8")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   140
                propt.Stype = LIN8;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   141
                continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   142
            } else if (!strcmp (argv[i], "ULAW")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   143
                propt.Stype = ULAW;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   144
                continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   145
            } else if (!strcmp (argv[i], "ALAW")) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   146
                propt.Stype = ALAW;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   147
                continue;
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   148
            }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   149
        } else {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   150
            fprintf (stderr, "Unknown option: %s\n", argv[i]);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   151
            exit (-1);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   152
        }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   153
    }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   154
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   155
    if (!propt.TextFile) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   156
        fprintf (stderr, "It's substantial to give a text file by -i <text file>!\n");
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   157
        exit (-1);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   158
    } else if (!propt.Voice) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   159
        fprintf (stderr, "It's substantial to give a voice database by -v <voice>!\n");
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   160
        exit (-1);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   161
    } else if (!propt.Path) {
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   162
        fprintf (stderr, "It's substantial to give a path for the prosodic stuff by -p <path>!\n");
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   163
        exit (-1);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   164
    }
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   165
    return (propt);
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   166
}
06dd3b8d90ad Virtual Reader
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
   167
#endif