public class EightSVXDecoder extends java.lang.Object implements IFFVisitor
8SVX Type Definitions
#define ID_8SVX MakeID('8', 'S', 'V', 'X') #define ID_VHDR MakeID('V', 'H', 'D', 'R') typedef LONG Fixed; // A Fixed-point value, 16 bits to the left of // the point and 16 to the right. A Fixed is a number // of 2^16ths, i.e., 65536ths. #define Unity 0x10000L // Unity = Fixed 1.0 = maximum volume // sCompression: Choice of compression algorithm applied to the samples. #define sCmpNone 0 // not compressed #define sCmpFibDelta 1 // Fibonacci-delta encoding. // Can be more kinds in the future. typedef struct { ULONG oneShotHiSamples, // # samples in the high octave 1-shot part repeatHiSamples, // # samples in the high octave repeat part samplesPerHiCycle; // # samples/cycle in high octave, else 0 UWORD samplesPerSec; // data sampling rate UBYTE ctOctave, // # octaves of waveform sCompression; // data compression technique used Fixed volume; // playback volume form 0 to Unity (full // volume). Map this value into the output // hardware's dynamic range. } Voice8Header; #define ID_NAME MakeID('N', 'A', 'M', 'E') // NAME chunk contains a CHAR[], the voice's name. #define ID_Copyright MakeID('(', 'c', ')', ' ') // "(c) " chunk contains a CHAR[], the FORM's copyright notice. #define ID_AUTH MakeID('A', 'U', 'T', 'H') // AUTH chunk contains a CHAR[], the author's name. #define ID_ANNO MakeID('A', 'N', 'N', 'O') // ANNO chunk contains a CHAR[], author's text annotations. #define ID_ATAK MakeID('A', 'T', 'A', 'K') #define ID_RLSE MakeID('R', 'L', 'S', 'E') typedef struct { UWORD duration; // segment duration in milliseconds, > 0 Fixed dest; // destination volume factor } EGPoint; // ATAK and RLSE chunks contain an EGPoint[], piecewise-linear envelope. // The envelope defines a function of time returning Fixed values. It's // used to scale the nominal volume specified in the Voice8Header. #define RIGHT 4L #define LEFT 2L #define STEREO 6L #define ID_CHAN MakeID('C', 'H', 'A', 'N') typedef sampletype LONG; #define ID_PAN MakeID('P', 'A', 'N', ' ') typedef sposition Fixed; // 0 <= sposition <= Unity // Unity refers to the maximum possible volume. #define ID_BODY MakeID('B', 'O', 'D', 'Y') typedef character BYTE; // 8 bit signed number, -128 thru 127. // BODY chunk contains a BYTE[], array of audio data samples
8SVX Regular Expression
8SVX ::= "FORM" #{ "8SVX" VHDR [NAME] [Copyright] [AUTH] ANNO* [ATAK] [RLSE] [CHAN] [PAN] BODY } VHDR ::= "VHDR" #{ Voice8Header } NAME ::= "NAME" #{ CHAR* } [0] Copyright ::= "(c) " #{ CHAR* } [0] AUTH ::= "AUTH" #{ CHAR* } [0] ANNO ::= "ANNO" #{ CHAR* } [0] ATAK ::= "ATAK" #{ EGPoint* } RLSE ::= "RLSE" #{ EGPoint* } CHAN ::= "CHAN" #{ sampletype } PAN ::= "PAN " #{ sposition } BODY ::= "BODY" #{ BYTE* } [0]The token "#" represents a ckSize LONG count of the following {braced} data bytes. E.g., a VHDR's "#" should equal sizeof(Voicd8Header). Literal items are shown in "quotes", [square bracket items] are optional, and "*" means 0 ore more replications. A sometimes-needed pad byte is shown als "[0]".
Modifier and Type | Field and Description |
---|---|
static int |
ANNO_ID |
static int |
AUTH_ID |
static int |
BODY_ID |
static int |
CHAN_ID |
static int |
COPYRIGHT_ID |
static int |
EIGHT_SVX_ID |
static int |
NAME_ID |
static int |
VHDR_ID |
Constructor and Description |
---|
EightSVXDecoder() |
EightSVXDecoder(java.io.InputStream in)
Creates a new Audio Source from the specified InputStream.
|
Modifier and Type | Method and Description |
---|---|
void |
addAudioClip(java.applet.AudioClip clip) |
protected void |
decodeANNO(EightSVXAudioClip sample,
IFFChunk[] chunks) |
protected void |
decodeAUTH(EightSVXAudioClip sample,
IFFChunk chunk) |
protected void |
decodeBODY(EightSVXAudioClip sample,
IFFChunk chunk) |
protected void |
decodeCHAN(EightSVXAudioClip sample,
IFFChunk chunk) |
protected void |
decodeCOPYRIGHT(EightSVXAudioClip sample,
IFFChunk chunk) |
protected void |
decodeNAME(EightSVXAudioClip sample,
IFFChunk chunk) |
protected void |
decodeVHDR(EightSVXAudioClip sample,
IFFChunk chunk)
The Voice 8 Header (VHDR) property chunk holds the playback parameters for the
sampled waveform.
|
void |
enterGroup(IFFChunk group)
Visits the start of an IFF GroupChunkExpression.
|
java.util.Vector |
getSamples() |
void |
leaveGroup(IFFChunk group) |
void |
registerChunks(IFFParser iff) |
void |
visitChunk(IFFChunk group,
IFFChunk chunk) |
public static final int EIGHT_SVX_ID
public static final int VHDR_ID
public static final int NAME_ID
public static final int COPYRIGHT_ID
public static final int ANNO_ID
public static final int AUTH_ID
public static final int CHAN_ID
public static final int BODY_ID
public EightSVXDecoder(java.io.InputStream in) throws java.io.IOException
in
- The input stream.java.io.IOException
public EightSVXDecoder()
public java.util.Vector getSamples()
public void registerChunks(IFFParser iff)
public void enterGroup(IFFChunk group)
enterGroup
in interface IFFVisitor
group
- Group Chunk to be visited.ParseException
- When an error has been encountered.public void leaveGroup(IFFChunk group)
leaveGroup
in interface IFFVisitor
public void visitChunk(IFFChunk group, IFFChunk chunk) throws ParseException
visitChunk
in interface IFFVisitor
ParseException
public void addAudioClip(java.applet.AudioClip clip)
protected void decodeVHDR(EightSVXAudioClip sample, IFFChunk chunk) throws ParseException
typedef LONG Fixed; // A Fixed-point value, 16 bits to the left of // the point and 16 to the right. A Fixed is a number // of 2^16ths, i.e., 65536ths. #define Unity 0x10000L // Unity = Fixed 1.0 = maximum volume // sCompression: Choice of compression algorithm applied to the samples. #define sCmpNone 0 // not compressed #define sCmpFibDelta 1 // Fibonacci-delta encoding. // Can be more kinds in the future. typedef struct { ULONG oneShotHiSamples, // # samples in the high octave 1-shot part repeatHiSamples, // # samples in the high octave repeat part samplesPerHiCycle; // # samples/cycle in high octave, else 0 UWORD samplesPerSec; // data sampling rate UBYTE ctOctave, // # octaves of waveform sCompression; // data compression technique used Fixed volume; // playback volume form 0 to Unity (full // volume). Map this value into the output // hardware's dynamic range. } Voice8Header;
ParseException
protected void decodeCHAN(EightSVXAudioClip sample, IFFChunk chunk) throws ParseException
ParseException
protected void decodeNAME(EightSVXAudioClip sample, IFFChunk chunk) throws ParseException
ParseException
protected void decodeCOPYRIGHT(EightSVXAudioClip sample, IFFChunk chunk) throws ParseException
ParseException
protected void decodeAUTH(EightSVXAudioClip sample, IFFChunk chunk) throws ParseException
ParseException
protected void decodeANNO(EightSVXAudioClip sample, IFFChunk[] chunks) throws ParseException
ParseException
protected void decodeBODY(EightSVXAudioClip sample, IFFChunk chunk) throws ParseException
ParseException