Statics Methods Relevant to SoundBvr Objects

importSound(url, soundLength) Creates a sound behavior by synchronously importing the given .wav or MIDI file.
importSound(url, soundLength, sndStandIn, ev, progress, size) Creates a SoundBvr by asynchronously importing the given .wav or MIDI file.
mix Creates a sound behavior that is equivalent to sound1 + sound2.
mixArray Creates a sound behavior that is equivalent to sound1 + sound2 + soundn.

importSound(url, soundLength)

Statics Class

Creates a sound behavior by synchronously importing the given .wav or MIDI file. The soundLength parameter receives the length of the sound. These downloads should be small and listed before asynchronous downloads. Use asynchronous downloads for more complex images and sounds. See below for a description of the asynchronous import method.

Syntax

public static SoundBvr importSound( URL url, NumberBvr[] soundLength );

Parameters

url
File path.
soundLength
NumberBvr array that receives the length of the sound in seconds. An array is used because this is an output parameter, and the system writes into the first element of the array. In Java, this is the simplest way to pass information back to the caller if you are already using the return value, which, in this case, is the sound).

Return Value

Returns the SoundBvr object.

importSound(url, soundLength, sndStandIn, ev, progress, size)

Statics Class

Creates a SoundBvr by asynchronously importing the given .wav or MIDI file. Asynchronous downloads should be listed after synchronous ones and used for more complex sounds and images. For a description of the synchronous import method, see above.

Syntax

public static SoundBvr importSound(
     URL url,
     NumberBvr[] soundLength,
     SoundBvr sndStandIn,
     DXMEvent[] ev,
     NumberBvr[] progress,
     NumberBvr[] size
);

Parameters

url
Fully qualified path of the file. It is of type java.net.URL.
soundLength
Length, in seconds, of the sound.
sndStandIn
Sound to use while the contents at url are still being downloaded. This argument cannot be null, however, the sound can be silence.
ev
Event to trigger once the download is complete. This argument can be null. Using this event is probably the best way to determine when the download is complete. (Otherwise, the Java constant Double.POSITIVE_INFINITY must be extracted.
progress
NumberBvr that goes from 0 to 1, tracking the progress of the download. For files downloaded via http, progress is reported as the percentage of the file that has been downloaded. Other protocols, the value may simply start at 0 and change to 1 once the download is complete. This argument can be null.
size
NumberBvr that is the size of the sound, in bytes. The value begins at -1 and will change to the true size if it is available. This argument can be null.

Return Value

Returns the SoundBvr object.

mix

Statics Class

Creates a sound behavior that is equivalent to sound1 + sound2.

Syntax

public static SoundBvr mix( SoundBvr sound1, SoundBvr sound2 );

Parameters

sound1 and sound2
SoundBvr objects.

Return Value

Returns the SoundBvr object.

mixArray

Statics Class

Creates a sound behavior that is equivalent to sound1 + sound2 + soundn.

Syntax

public static SoundBvr mixArray( SoundBvr[] sounds );

Parameters

sounds
SoundBvr objects in the array.

Return Value

Returns the SoundBvr object.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.