All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.ifarchive.glk.SoundChannel

java.lang.Object
   |
   +----org.ifarchive.glk.OpaqueObject
           |
           +----org.ifarchive.glk.SoundChannel

public class SoundChannel
extends OpaqueObject
A sound channel can play exactly one sound at a time.


Method Index

 o create()
Create a sound channel.
 o create(Object)
Create a sound channel.
 o destroy()
Destroy this sound channel.
 o finalize()
If the Glk object is still in existence when this object is garbage-collected, destroy it.
 o iterate(SoundChannel, Object[])
Iterate over sound channels.
 o loadHint(int, boolean)
Give the library a hint about whether the given sound should be loaded or not.
 o play(int)
Play a sound.
 o play(int, int, int)
Play a sound.
 o setVolume(int)
Set the volumne in this channel.
 o stop()
Stop any sound in this channel.

Methods

 o iterate
 public static SoundChannel iterate(SoundChannel f,
                                    Object r[])
Iterate over sound channels.

See Also:
iterate
 o create
 public static SoundChannel create()
Create a sound channel.

Returns:
The channel created, or null if the library failed to create it.
 o create
 public static SoundChannel create(Object jrock)
Create a sound channel.

Parameters:
jrock - The rock to give this channel.
Returns:
The channel created, or null if the library failed to create it.
 o finalize
 protected void finalize()
If the Glk object is still in existence when this object is garbage-collected, destroy it.

Overrides:
finalize in class OpaqueObject
 o destroy
 public void destroy()
Destroy this sound channel. If a sound is playing it will be stopped and no notification event will be sent.

Overrides:
destroy in class OpaqueObject
 o play
 public boolean play(int snd)
Play a sound.

Parameters:
snd - The numbber of the sound to play.
Returns:
true if the sound started playing, else false.
 o play
 public boolean play(int snd,
                     int repeats,
                     int notify)
Play a sound.

Parameters:
snd - The number of the sound to play.
repeats - The number of times to repeat; -1 means forever.
notify - If nonzero, request a sound notification event when the sound stops playing.
Returns:
true if the sound started playing, else false.
 o stop
 public void stop()
Stop any sound in this channel. There will be no notification event.

 o setVolume
 public void setVolume(int vol)
Set the volumne in this channel. Not all libraries support this function. You should test the gestalt_SoundVolume selector before you rely on it. Full volume is 0x10000. Half volume is 0x8000 etc.

Parameters:
vol - The volume to set.
 o loadHint
 public static void loadHint(int snd,
                             boolean flag)
Give the library a hint about whether the given sound should be loaded or not. If flag is true, the library may preload the sound or do other initialization, so that play() will be faster. If flag is false, the library may release memory or other resources associated with the sound.

Parameters:
snd - The number of the sound to hint about.
flag - True to hint that the sound should be preloaded; false to hint that it should be unloaded.

All Packages  Class Hierarchy  This Package  Previous  Next  Index