home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Graphics⁄Sound / Speech / speechdemo.c < prev   
Encoding:
C/C++ Source or Header  |  1985-09-03  |  1.8 KB  |  66 lines  |  [TEXT/MACA]

  1. /* Written 12:47 am  Aug  8, 1985 by ALAN@NCSUVM.BITNET in uiucdcsc:net.sources.mac */
  2. /* ---------- "MacIntalk <--> Aztec C Demo Source" ---------- */
  3. Here is a short file written using the Aztec C <--> MacIntalk interface that
  4. I posted for Mike the other day.  The Binary (BinHex 4.0 format) will be
  5. in the next file from NCSUVM...
  6.  
  7. Author: Michael Hecht,
  8. Poster: Alan Clegg, ALAN@NCSUVM.BITNET
  9.  
  10. -----------------------------------Cut Here-----------------------------------
  11.  #include <memory.h>
  12.  #include "speech.h"
  13.  main( argc, argv )
  14.  int argc;
  15.  char **argv;
  16.  {
  17.    SpeechHandle theSpeech;
  18.    register SpeechErr err;
  19.    register Handle output;
  20.    register char * cp;
  21.    err = SpeechOn( noExcpsFile, &theSpeech );
  22.    if( err ) {
  23.      printf( "SpeechOn, err=%d\n", err );
  24.      return err;
  25.    }
  26.    output = NewHandle(( Size )0 );
  27.    for( argc--, argv++; argc; argc-- ) {
  28.      cp = *argv++;
  29.      /* Handle switches */
  30.      if( cp[ 0 ] == '-' )
  31.        switch( cp[ 1 ] ) {
  32.          case 'r':
  33.            SpeechRate( theSpeech, atoi( cp+2 ));
  34.            continue;
  35.            break;
  36.          case 's':
  37.            SpeechSex( theSpeech, atoi( cp+2 ));
  38.            continue;
  39.            break;
  40.          case 'p':
  41.            SpeechPitch( theSpeech, atoi( cp+2 ), NoChange );
  42.            continue;
  43.            break;
  44.          case 'm':
  45.            SpeechPitch( theSpeech, 0, atoi( cp+2 ) );
  46.            continue;
  47.            break;
  48.        }
  49.      err = Reader( theSpeech, cp, ( long )strlen( cp ), output );
  50.      if( err ) {
  51.        printf( "Reader, err=%d\n", err );
  52.        return err;
  53.      }
  54.      printf( "%s ", cp );
  55.      err = MacinTalk( theSpeech, output );
  56.      if ( err ) {
  57.        printf( "MacinTalk, err=%d\n", err );
  58.        return err;
  59.      }
  60.    }
  61.    printf( "\n" );
  62.    SpeechOff( theSpeech );
  63.    DisposHandle( output );
  64.  }
  65. /* End of text from uiucdcsc:net.sources.mac */
  66.