Пример #1
0
  private void run() throws Exception {

    ISettingsHandler settings = new BasicSettingsHandler();

    DataFiles.addSearchPath(settings, "/usr/local/src/v9t9-data/roms");
    DataFiles.addSearchPath(settings, "l:/src/v9t9-data/roms");
    IMachine machine = new StandardTI994AMachineModel().createMachine(settings);
    SpeechTMS5220 tms5220 = (SpeechTMS5220) machine.getSpeech();

    settings.get(ISpeechChip.settingLogSpeech).setInt(1);
    settings.get(ISpeechChip.settingTalkSpeed).setDouble(1.0);

    LPCSpeech speech = tms5220.getLpcSpeech();
    speech.init();

    machine.start();
    machine.setPaused(true);

    final FileOutputStream fos = new FileOutputStream("/tmp/speech.raw");

    SpeechDataSender sender = new SpeechDataSender(8000, 20);
    sender.setOutputStream(fos);

    tms5220.addSpeechListener(sender);

    // reset
    tms5220.command((byte) 0x70);

    // "test" from TEII
    sayDirect(
        tms5220,
        new short[] {
          0, 0x10, 0x80, 0x1d, 0xc5, 0x3, 0x70, 0xac, 0x87, 0x1, 0x52, 0x28, 0x2e, 0x69, 0xcc, 0xee,
          0x1a, 0x35, 0x79, 0xa5, 0x31, 0xbb, 0x6b, 0xd4, 0xe4, 0x9d, 0xae, 0x34, 0x66, 0x4b, 0x89,
          0x1c, 0x3d, 0x52, 0x57, 0x35, 0x2c, 0xbb, 0xb4, 0x7, 0x8, 0xf0, 0x53, 0x84, 0x4, 0x34,
          0x60, 0x80, 0x9f, 0x32, 0x3d, 0x10, 0x80, 0x9f, 0xdc, 0x24, 0, 0, 0xe, 0x58, 0xc2, 0x3,
          0x4, 0x58, 0xc2, 0xfc, 0x1
        });

    if (true) {
      // should exit quickly (or not...)
      // sayPhrase(tms5220, 0xfff0);

      sayPhrase(tms5220, 0x351a); // HELLO
      sayPhrase(tms5220, 0x71f4); // UHOH

      sayDirect(tms5220, THAT_IS_RIGHT);

      sayPhrase(tms5220, 0x4642); // MORE

      sayDirect(tms5220, THAT_IS_RIGHT);
      sayDirect(tms5220, THAT_IS_RIGHT);
    }

    ///

    // bad usage, no waiting -- should delay anyway!
    //		sayPhrase(tms5220, 0x1D82);	// CHECK
    //		sayPhrase(tms5220, 0x2612);	// DRAW
    //		sayPhrase(tms5220, 0x1c48);	// BYE
    //		sayPhrase(tms5220, 0x3148);	// GOODBYE

    if (true) {
      sayPhrase(tms5220, 0x1a42, false); // BE
      sayPhrase(tms5220, 0x4642, false); // MORE
      sayPhrase(tms5220, 0x51b3, false); // POSITIVE
      sayPhrase(tms5220, 0x1714, false); // ABOUT
      sayPhrase(tms5220, 0x69b6, false); // THE1
      sayPhrase(tms5220, 0x208b, false); // CONNECTED
      sayPhrase(tms5220, 0x2034, false); // COMPUTER
      sayPhrase(tms5220, 0x24ea, false); // DOING
      sayPhrase(tms5220, 0x2599, false); // DOUBLE
      sayPhrase(tms5220, 0x6e69, false); // TIME
      sayPhrase(tms5220, 0x1769, false); // AFTER
      sayPhrase(tms5220, 0x70ce, false); // TWELVE
      sayPhrase(tms5220, 0x4e66, false); // P
      sayPhrase(tms5220, 0x4233, false); // M

    } else {
      //			sayPhrase(tms5220, 0x70ce, false);	// TWELVE
      //			sayPhrase(tms5220, 0x4e66, false);	// P
    }
    Thread.sleep(2000);

    fos.close();
    // System.exit(0);
  }