Creating a Subclass Again, (Crystaltech web hosting) you can create this
Friday, November 30th, 2007Creating a Subclass Again, you can create this class with the Create a Java Class button. This time you not only enter the name of the new class, but you also press the Browse button at the right-hand side of the Superclass field. There, select the AudioOutput field from the list. Click Finish, and you can start to enter code. In the case of import statements and Javadoc comments, just proceed as discussed previously. When you enter the processUtterance() method, the Source > OverrideMethods context function will save you some work. In this function s dialog box mark the processUtterance() method below the AudioOutput class. Then you need only add the lines for calling the processUtterance() method from the Animator instance. Alternatively, you use the Code Assistant to create specific method stubs. For example, to create a stub for the processUtterance() method you need only type the letters pro and press Ctrl+Spacebar. Then select processUtterance from the list. After you have completed this class, you must tell FreeTTS to use AnimatedAudioOutput instead of AudioOutput. Which utterance processor is used for audio output is determined in the subclasses of the com.sun.speech.freetts.Voice class in the getAudioOutput() method. Since you plan to use the voice com.sun.speech.freetts.en.us.CMUDiphoneVoice for your application, you need to extend this class. For this purpose, create a new com.sun.speech.freetts.en.us package in the DukeSpeaks project. In this package create a new class named AnimatedDiphoneVoice. The AnimatedDiphoneVoice.java class When creating the AnimatedDiphoneVoice class, specify CMUDiphoneVoice as a super class and check the Constructors from Superclass option. In the generated constructor add the new animator parameter and store this parameter in an instance field. See Listing 5.4. package com.sun.speech.freetts.en.us; import java.io.IOException; import java.net.URL; import java.util.Locale; import com.sun.speech.freetts.Age; import com.sun.speech.freetts.Gender; import com.sun.speech.freetts.UtteranceProcessor; import com.sun.speech.freetts.relp.AnimatedAudioOutput; public class AnimatedDiphoneVoice extends CMUDiphoneVoice { UtteranceProcessor animator; /** * Constructor * @param name - the name of the voice * @param gender - the gender of the voice 82 Chapter 5 Listing 5.4 (Continues)
If hosting is cheap, it doesn’t need to be second-rate. Try us if you don’t believe cheap web hosting we have 30 days money back guarantee.