<< Chapter < Page Chapter >> Page >

Then Listing 4 calls the getMelody method and saves the reference that is returned by the method in the instance variable named melody discussed earlier .

Finally, Listing 4 instantiates an object of the AudioPlayOrFile01 class, passing audioParams , melody , and args[0] as parameters, and then calls the method named playOrFileData on that object's reference. Depending on the value of args[0] , this method will either play the sound contained in melody immediately, or write it into an output audio file.

The class named AudioSignalGenerator02

The class named AudioSignalGenerator02 is shown in Listing 15 . This is another class that will probably be used throughout this series of modules on Java sound and which probably won't change, at least for the earlymodules in the series. Therefore, we will only need to discuss it this one time.

Beginning of the class named AudioSignalGenerator02

This is an abstract class that serves as the base class or superclass for several other classes that can be used to create sounds or melodies of different types.

Listing 5 . Beginning of the class named AudioSignalGenerator02.
import java.io.*; import java.nio.*;import java.util.*; public abstract class AudioSignalGenerator02{//Note: This class can only be used to generate signed 16-bit data.ByteBuffer byteBuffer; String[]args; byte[]melody; AudioFormatParameters01 audioParams;//-------------------------------------------------------------------------//

The code in Listing 5 declares four instance variables. You are already familiar with the purpose of three of them. The variable named byteBuffer isn't actually used in the program in this module, but will be used in later modules. I will explain it in the firstmodule in which it is actually used.

The constructor for AudioSignalGenerator02

The constructor is shown in Listing 6 . The constructor simply receives three input parameters and saves them in the instance variables shown in Listing 5 .

Listing 6 . The constructor for AudioSignalGenerator02.
public AudioSignalGenerator02(AudioFormatParameters01 audioParams, String[]args, byte[]melody){ this.audioParams = audioParams;this.args = args; this.melody = melody;}//end constructor //-------------------------------------------------------------------------//

The abstract method named getMelody

Listing 7 shows an abstract method named getMelody . In case you don't remember what an abstract method is, see Ap0100 : Self-assessment, The this keyword, static final variables, and initialization of instance variables .

Briefly, an abstract method is a method that is designed to be overridden. The method named getMelody in Listing 7 must be overridden in a subclass to be of any use. You will see the overridden version of the method named getMelody shortly in the class named WhiteNoise .

Recall that the method was called on a reference to a WhiteNoise object in Listing 4 . (You will get a better idea of the purpose of this abstract method when we discuss runtime polymorphism in a future module.)

Questions & Answers

anyone know any internet site where one can find nanotechnology papers?
Damian Reply
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
characteristics of micro business
for teaching engĺish at school how nano technology help us
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
what is the actual application of fullerenes nowadays?
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
is Bucky paper clear?
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Do you know which machine is used to that process?
how to fabricate graphene ink ?
for screen printed electrodes ?
What is lattice structure?
s. Reply
of graphene you mean?
or in general
in general
Graphene has a hexagonal structure
On having this app for quite a bit time, Haven't realised there's a chat room in it.
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
many many of nanotubes
what is the k.e before it land
what is the function of carbon nanotubes?
I'm interested in nanotube
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Berger describes sociologists as concerned with
Mueller Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!

Source:  OpenStax, Accessible objected-oriented programming concepts for blind students using java. OpenStax CNX. Sep 01, 2014 Download for free at https://legacy.cnx.org/content/col11349/1.17
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Accessible objected-oriented programming concepts for blind students using java' conversation and receive update notifications?