Copyright 2011-01-06 Werner Randelshofer

ch.randelshofer.media.anim
Class ANIMAudioCommand

java.lang.Object
  extended by ch.randelshofer.media.anim.ANIMAudioCommand

public class ANIMAudioCommand
extends java.lang.Object

An ANIMAudioCommand handles an audio command that is associated to a single ANIMFrame of a ANIMMovieTrack. An ANIMFrame may be associated to multiple ANIMAudioCommands.

This version of ANIMAudioCommand is designed to handle audio commands as specified by the ANIM+SLA Sound Control collection chunk (ILBM SCTL).

Here's the specification of the SCTL collection chunk:

 typedef UBYTE Command; // Choice of commands
 #define cmdPlaySound 1 // Start playing a sound
 #define cmdStopSound 2 // Stop the sound in a given channelMask
 #define cmdSetFreqvol 3 // Change frequency/volume for a channelMask

 typedef USHORT Flags; // Choice of flags
 #define flagNoInterrupt 1 // Play the sound, but only if
                           // the channelMask isn't in use

 typedef struct {
 Command  command;   // What to do, see above
 UBYTE    volume;    // Volume 0..64
 UWORD    sound,     // Sound number (one based)
          repeats,   // Number of times to play the sound
          channelMask,   // Channel(s) to use for playing (bit mask)
          frequency; // If non-zero, overrides the VHDR value
 Flags    flags;     // Flags, see above
 UBYTE    pad[4];       // For future use

Version:
1.2.1 2010-12-25 Minor fixes for J2SE 5.
1.2 2005-09-16 Support for swapping left and right speakers added.
1.1 2003-04-25 Revised.
1.0 April 3, 2003 Created.
Author:
Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland

Field Summary
static int COMMAND_PLAY_SOUND
          Start playing a sound.
static int COMMAND_SET_FREQVOL
          Change frequency/volume for a channelMask.
static int COMMAND_STOP_SOUND
          Stop the sound in a given channelMask.
static int FLAG_NO_INTERRUPT
          Play the sound, but only if the channelMask isn't in use.
 
Constructor Summary
ANIMAudioCommand(int command, int volume, int sound, int repeats, int channelMask, int frequency, int flags)
          Creates a new instance.
 
Method Summary
 void dispose()
           
 void doCommand(ANIMMovieTrack track, ANIMAudioCommand[] runningCommands)
           
 int getChannelMask()
           
 int getCommand()
           
 int getFrequency()
           
 int getSound()
           
 int getVolume()
           
 void play(ANIMMovieTrack track)
           
 void prepare(ANIMMovieTrack track)
           
 void stop(ANIMMovieTrack track)
           
 void stop(ANIMMovieTrack track, int channelMask)
          Stops playback of this audio command on the specified channels.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMAND_PLAY_SOUND

public static final int COMMAND_PLAY_SOUND
Start playing a sound.

See Also:
Constant Field Values

COMMAND_STOP_SOUND

public static final int COMMAND_STOP_SOUND
Stop the sound in a given channelMask.

See Also:
Constant Field Values

COMMAND_SET_FREQVOL

public static final int COMMAND_SET_FREQVOL
Change frequency/volume for a channelMask.

See Also:
Constant Field Values

FLAG_NO_INTERRUPT

public static final int FLAG_NO_INTERRUPT
Play the sound, but only if the channelMask isn't in use.

See Also:
Constant Field Values
Constructor Detail

ANIMAudioCommand

public ANIMAudioCommand(int command,
                        int volume,
                        int sound,
                        int repeats,
                        int channelMask,
                        int frequency,
                        int flags)
Creates a new instance.

Method Detail

getChannelMask

public int getChannelMask()

getFrequency

public int getFrequency()

getSound

public int getSound()

getVolume

public int getVolume()

getCommand

public int getCommand()

prepare

public void prepare(ANIMMovieTrack track)

play

public void play(ANIMMovieTrack track)

stop

public void stop(ANIMMovieTrack track)

stop

public void stop(ANIMMovieTrack track,
                 int channelMask)
Stops playback of this audio command on the specified channels.


doCommand

public void doCommand(ANIMMovieTrack track,
                      ANIMAudioCommand[] runningCommands)

dispose

public void dispose()

Copyright 2011-01-06 Werner Randelshofer