home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / source / talkdemo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-05  |  1.4 KB  |  59 lines

  1. /* Here is a short file written using the Aztec C <--> MacIntalk interface that
  2. I posted for Mike the other day. */
  3.  
  4.  #include <memory.h>
  5.  #include "speech.h"
  6.  main( argc, argv )
  7.  int argc;
  8.  char **argv;
  9.  {
  10.    SpeechHandle theSpeech;
  11.    register SpeechErr err;
  12.    register Handle output;
  13.    register char * cp;
  14.    err = SpeechOn( noExcpsFile, &theSpeech );
  15.    if( err ) {
  16.      printf( "SpeechOn, err=%d\n", err );
  17.      return err;
  18.    }
  19.    output = NewHandle(( Size )0 );
  20.    for( argc--, argv++; argc; argc-- ) {
  21.      cp = *argv++;
  22.      /* Handle switches */
  23.      if( cp[ 0 ] == '-' )
  24.        switch( cp[ 1 ] ) {
  25.          case 'r':
  26.            SpeechRate( theSpeech, atoi( cp+2 ));
  27.            continue;
  28.            break;
  29.          case 's':
  30.            SpeechSex( theSpeech, atoi( cp+2 ));
  31.            continue;
  32.            break;
  33.          case 'p':
  34.            SpeechPitch( theSpeech, atoi( cp+2 ), NoChange );
  35.            continue;
  36.            break;
  37.          case 'm':
  38.            SpeechPitch( theSpeech, 0, atoi( cp+2 ) );
  39.            continue;
  40.            break;
  41.        }
  42.      err = Reader( theSpeech, cp, ( long )strlen( cp ), output );
  43.      if( err ) {
  44.        printf( "Reader, err=%d\n", err );
  45.        return err;
  46.      }
  47.      printf( "%s ", cp );
  48.      err = MacinTalk( theSpeech, output );
  49.      if ( err ) {
  50.        printf( "MacinTalk, err=%d\n", err );
  51.        return err;
  52.      }
  53.    }
  54.    printf( "\n" );
  55.    SpeechOff( theSpeech );
  56.    DisposHandle( output );
  57.  }
  58.  
  59.