<< Chapter < Page Chapter >> Page >

Code reuse

It is unlikely that the class named AudioPlayOrFile01 will be modified throughout the next several modules. Therefore, unless I change the name of the class, (which I will do if I modify the file) , you will only need to copy and compile the source code once. After that, you can simply copy the compiled class file from oneproject folder to the next.

The class named AudioFormatParameters01

An object of the class named AudioFormatParameters01 is simply a container for some of the parameters required by the class named AudioPlayOrFile01 . A complete listing of the class named AudioFormatParameters01 is provided in Listing 13 .

With the exception of bigEndian , the comments should be sufficient to describe the parameters. If you would like to learn more about bigEndian , simply Google it.

Disk organization

Although there are more elegant ways to organize your disk by making use of the classpath environment variable, unless stated otherwise, the disk organization that I will use in this collection of sound modules will not usethe classpath environment variable.

With the exception of the classes in the Java Standard Edition library, these modules will assume that source code files or compiled class files for allrequired classes are physically contained in the folder from which the program is executed. For the program that I will explain in this module, this means that the following source code orcompiled class files must be contained in the execution folder:

  • MusicComposer04
  • AudioSignalGenerator02
  • WhiteNoise
  • AudioFormatParameters01
  • AudioPlayOrFile01

The class named MusicComposer04

An object of this class creates and plays three seconds of monaural white or pink noise. It works in conjunction with the following classes:

  • WhiteNoise
  • AudioSignalGenerator02
  • AudioPlayOrFile01
  • AudioFormatParameters01

The sound can be played immediately or can be saved in an audio file of type AU for playback later. (Click WhiteNoise to download and play the audio file produced by this program.)

A complete listing of the class named MusicComposer04 is provided in Listing 14 . I will break this code down and explain it in fragments. The first fragment isshown in Listing 1 .

Beginning of class MusicComposer04

Listing 1 shows the beginning of the class named MusicComposer04 along with the main method.

Listing 1 . Beginning of the class named MusicComposer04.
public class MusicComposer04{ AudioFormatParameters01 audioParams = new AudioFormatParameters01();byte[] melody;String[] args;//-------------------------------------------------------------------------// public static void main(String[]args){ new MusicComposer04(args);}//end main //-------------------------------------------------------------------------//

The instance variables

The first instance variable named audioParams instantiates and saves a reference to anobject containing audio format parameters with predefined values. They may be modified by the signal generator later at runtime. Values that areallowed by Java SDK 1.4.1 are shown in comments in the class definition for the class named AudioFormatParameters01 .

Questions & Answers

what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
cell is the building block of life.
Condoleezza Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




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?

Ask