Soundeffect Class; Soundeffect Methods; Using Soundeffect; Sprite Class - Motorola C370 Series Technical Manual

J2me developer guide
Hide thumbs Also See for C370 Series:
Table of Contents

Advertisement

8
Gaming API and Sound

SoundEffect Class

The
SoundEffect
create several
The sound data may be stored on the device as a named resource in the application JAR
file, or it can be stored on a server and retrieved via the network.
instances are played by a

SoundEffect Methods

The
SoundEffect
public static SoundEffect
createSoundEffect(String resource) throws
FileFormatNotSupportedException – Creates a
the sound data stored in the specified named resource or URL. The data must be in a
sound format that is supported by the device. Though additional formats may be
supported, all devices must support some format yet to be determined.

Using SoundEffect

As described above, a game can need several different sound effects. The code below
exemplifies the creation of some
The following is a code sample to show the creation of
SoundEffect Objects
try{
// Create a SoundEffect using a wave file inside the JAR
SoundEffect s1 = createSoundEffect("/jump.wav");
// Create a SoundEffect using a wave located
// on a web site
SoundEffect s2=
createSoundEffect("http://www.motorola.com/sound/mp.wav");
}catch(FileFormatNotSupportedException fe){}

Sprite Class

The
Sprite
user can interact with and move around.
class encapsulates the data for a game sound effect. A game may
objects, one for each of the sounds that it needs to play.
SoundEffect
GameScreen
class implements the following method:
SoundEffect
class is used to create graphic images, animated or non-animated, that a
SoundEffect
.
objects:
SoundEffect
for
SoundEffect
objects:
55

Advertisement

Table of Contents
loading

This manual is also suitable for:

C450 seriesC550 series

Table of Contents