|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--quicktime.QTObject | +--quicktime.util.QTHandleRef | +--quicktime.util.QTHandle | +--quicktime.std.music.MusicData
MusicData objects contain general information for a Music Track that the TunePlayer uses when it instantiates NoteChannels for the parts contained in the music media. MusicData object's internal data are all aligned on int values (ie. 32bit data segments) so the offsets for getting and setting values in this structure are expressed in terms of these 32bit values.
Data in MusicData is in big endian order and the stuff static methods return values are in the correct big endian format and order to be added to a MusicData object as is. If an application writes its own stuff methods they can return the data in big endian order to ensure compatibility with the existing stuff methods. Thus when music events are added to the MusicData they must be in big endian format and the values retrieved from a constructed MusicData object will be in big endian order.
Many of the macros that are provided in the QuickTimeMusic.h file are translated here as static methods. The names of the macros are represented here with the qtma_ removed and the first letter after the _ is NOT a capital. Thus qtma_StuffRestEvent becomes stuffRestEvent.
An application does NOT need to set the end of sequence marker event if this marker should be set as the last music data element in the MusicData object. The set... and get... calls will check for proper bounds and include a check that allows for the required existence of the end of sequence marker.
Field Summary | |
static int |
kNoteRequestHeaderEventLength
The size (numer of ints) of a kNoteRequestEvent (including its header and footer) |
Fields inherited from interface quicktime.jdirect.QuickTimeLib |
JDirect_MacOSX, libraryInstance, name |
Constructor Summary | |
MusicData(int size)
Create a MusicData object of the specified number of bytes. |
Method Summary | |
static int |
controlController(int x)
Given a stuffed big-endian order QuickTime music event this method will extract the controller number. |
static int |
controlValue(int x)
Given a stuffed big-endian order QuickTime music event this method will extract the controller's specified value. |
static int |
eventType(int x)
Given a stuffed big-endian order QuickTime music event this method will extract the event type. |
static int |
generalLength(int x)
Given a stuffed big-endian order QuickTime music event this method will extract the general event's length from either header or the footer of the general event. |
static int |
generalSubtype_Footer(int x)
Given a stuffed big-endian order QuickTime music event this method will extract the general event's sub type from the footer of the general event. |
AtomicInstrument |
getAtomicInstrument(int offset)
Returns an AtomicInstrument from the specified offset (numer of ints) into the MusicData. |
int |
getMusicEvent(int offset)
Returns the big endian ordered stuffed QuickTime music event at the specified number of ints into the MusicData. |
NoteRequest |
getNoteRequest(int offset)
Returns a NoteRequest object from the specified offset (numer of ints) into the MusicData. |
long |
getXMusicEvent(int offset)
Returns the stuffed QuickTime extended music event at the specified number of ints into the MusicData. |
static int |
markerSubtype(int x)
Given a stuffed big-endian order QuickTime music event this method will extract the marker's sub type. |
static int |
markerValue(int x)
Given a stuffed big-endian order QuickTime music event this method will extract the marker's value. |
static int |
noteDuration(int x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the note duration. |
static int |
notePitch(int x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the note pitch. |
static int |
noteVelocity(int x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the note velocity. |
static int |
part(int x)
Given a stuffed big-endian order QuickTime music event this method will extract the part number. |
static int |
restDuration(int x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the rest duration. |
void |
setAtomicInstrument(int offset,
int partNumber,
AtomicInstrument ai)
Copies the AtomicInstrument data to the specified offset (numer of ints) into the MusicData. |
void |
setMusicEvent(int offset,
int musicData)
Sets the big endian ordered stuffed QuickTime music event at the specified number of ints into the MusicData. |
void |
setNoteRequest(int offset,
int partNumber,
NoteRequest nr)
Copies the NoteRequest data to the specified offset (numer of ints) into the MusicData. |
void |
setSize(int newSize)
Resets the size of the MusicData object to the new size (in bytes). |
void |
setXMusicEvent(int offset,
long musicData)
Sets the stuffed QuickTime extended music event at the specified number of ints into the MusicData. |
static int |
stuffControlEvent(int part,
int control,
int value)
Returns an int that is the stuffed representation of the control music event. |
static int |
stuffGeneralEvent_Footer(int subType,
int length)
Returns an int that is the stuffed representation of the footer portion of a general music event. |
static int |
stuffGeneralEvent_Header(int part,
int length)
Returns an int that is the stuffed representation of the header portion of a general music event. |
static int |
stuffMarkerEvent(int markerType,
int markerValue)
Returns an int that is the stuffed representation of the marker music event. |
static int |
stuffNoteEvent(int part,
int pitch,
int velocity,
int duration)
Returns an int that is the stuffed representation of the note music event. |
static int |
stuffRestEvent(int duration)
Returns an int that is the stuffed representation of the rest music event. |
static long |
stuffXControlEvent(int part,
int control,
int value)
Returns a long that is the stuffed representation of the extended note music event. |
static long |
stuffXKnobEvent(int part,
int knob,
int value)
Returns a long that is the stuffed representation of the extended note music event. |
static long |
stuffXNoteEvent(int part,
int pitch,
int volume,
int duration)
Returns a long that is the stuffed representation of the extended note music event. |
static int |
xControlController(long x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the controller number. |
static int |
xControlValue(long x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the controller number. |
static int |
xKnobID(long x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the knob's value. |
static int |
xKnobValue(long x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the knob's value. |
static int |
xNoteDuration(long x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the note duration. |
static int |
xNotePitch(long x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the note pitch. |
static int |
xNoteVelocity(long x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the note velocity. |
static int |
xPart(long x)
Given a stuffed big-endian order QuickTime extended music event this method will extract the part number. |
Methods inherited from class quicktime.util.QTHandle |
clone, concatenate, fromEncodedImage, fromGraphicsExporterInput, fromGraphicsExporterOutput, fromGraphicsExporterText, fromGraphicsImporterAlias, fromGraphicsImporterData, fromSoundDescription, fromTimeCoderCurrent, fromTimeCoderSource, fromTimeCoderTime, fromTrack, reserveMemory |
Methods inherited from class quicktime.util.QTHandleRef |
copyFromArray, copyFromArray, copyFromArray, copyFromArray, copyFromArray, copyFromArray, copyFromArray, copyToArray, copyToArray, copyToArray, copyToArray, copyToArray, copyToArray, copyToArray, fromCompressionDialogState, fromSCSequence, getBytes, getSize, inMemory, isLocked, lock, lockHigh, moveHigh, toQTPointer, toQTPointer, toString, unlock |
Methods inherited from class quicktime.QTObject |
disposeQTObject, equals, ID |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int kNoteRequestHeaderEventLength
Constructor Detail |
public MusicData(int size) throws QTException
size
- the size in bytes of the required MusicData objectMethod Detail |
public static int stuffGeneralEvent_Header(int part, int length)
part
- the part that the event applies tolength
- the length (including the surrounding general event header and footer)
of the size of the general event. This size is in bytes.public static int stuffGeneralEvent_Footer(int subType, int length)
part
- the part that the event applies tolength
- the length (including the surrounding general event header and footer)
of the size of the general event. This size is in bytes.public static int stuffRestEvent(int duration)
duration
- the duration in the time scale of the TunePlayer or the MusicMediapublic static int stuffNoteEvent(int part, int pitch, int velocity, int duration)
part
- the part that the note is played bypitch
- the MIDI note pitch of the note - valid range is 32 - 95 (with middle C as 60)velocity
- the note-on velocity when the note is playedduration
- the duration in the time scale of the TunePlayer or the MusicMediapublic static int stuffControlEvent(int part, int control, int value)
part
- the part that the note is played bycontrol
- the number of the controllervalue
- 8.8 bit fixed point signed controller specific valuepublic static int stuffMarkerEvent(int markerType, int markerValue)
markerType
- the type of marker that is requiredmarkerValue
- the value applied to the specified markerpublic static long stuffXNoteEvent(int part, int pitch, int volume, int duration)
part
- the part that the note is played bypitch
- a 8.8 pitch value where the high 8 bits are the MIDI note number and the low 8 bits represent some fractional value of a semitonevelocity
- the note-on velocity when the note is playedduration
- the duration in the time scale of the TunePlayer or the MusicMediapublic static long stuffXControlEvent(int part, int control, int value)
part
- the part that the note is played bycontrol
- the number of the controllervalue
- 8.8 bit fixed point signed controller specific valuepublic static long stuffXKnobEvent(int part, int knob, int value)
part
- the part that the knob is applied tooknob
- the knobvalue
- the new value for the specified knobpublic static int eventType(int x)
x
- the stuffed big-endian music eventpublic static int part(int x)
x
- the stuffed big-endian music eventpublic static int xPart(long x)
x
- the stuffed big-endian music eventpublic static int restDuration(int x)
x
- the stuffed big-endian music eventpublic static int notePitch(int x)
x
- the stuffed big-endian music eventpublic static int noteVelocity(int x)
x
- the stuffed big-endian music eventpublic static int noteDuration(int x)
x
- the stuffed big-endian music eventpublic static int xNotePitch(long x)
x
- the stuffed big-endian music eventpublic static int xNoteVelocity(long x)
x
- the stuffed big-endian music eventpublic static int xNoteDuration(long x)
x
- the stuffed big-endian music eventpublic static int controlController(int x)
x
- the stuffed big-endian music eventpublic static int controlValue(int x)
x
- the stuffed big-endian music eventpublic static int xControlController(long x)
x
- the stuffed big-endian music eventpublic static int xControlValue(long x)
x
- the stuffed big-endian music eventpublic static int markerSubtype(int x)
x
- the stuffed big-endian music eventpublic static int markerValue(int x)
x
- the stuffed big-endian music eventpublic static int xKnobValue(long x)
x
- the stuffed big-endian music eventpublic static int xKnobID(long x)
x
- the stuffed big-endian music eventpublic static int generalSubtype_Footer(int x)
x
- the stuffed big-endian music eventpublic static int generalLength(int x)
x
- the stuffed big-endian music eventpublic void setSize(int newSize) throws UtilException
setSize
in class QTHandle
newSize
- - the new size of the MusicData object.public int getMusicEvent(int offset) throws QTException
offset
- - the number of ints in the headerQTException
- if the offset would get data past the end of the MusicDatapublic void setMusicEvent(int offset, int musicData) throws QTException
An application can only set the last four bytes if the value of the musicData in this case is the end of sequence marker - this is generally not required as it will be set by the constructor and setSize calls.
offset
- - the number of ints in the headermusicData
- the big endian ordered music eventQTException
- if the offset would set data past the end of the MusicDatapublic long getXMusicEvent(int offset) throws QTException
offset
- - the number of ints in the headerQTException
- if the offset would get data past the end of the MusicData
minus 4 bytes which is the end of sequence marker - which is not an extended music event.public void setXMusicEvent(int offset, long musicData) throws QTException
offset
- - the number of ints in the headermusicData
- the music event - two big endian ints stuffed into a longQTException
- if the offset would set data past the end of the MusicData
minus 4 bytes which is the end of sequence marker - which is not an extended music event.public void setNoteRequest(int offset, int partNumber, NoteRequest nr) throws QTException
When a note request event is stuffed into music data it is surrounded by two ints:
offset
- - the number of music events (ints) into the headerpartNumber
- - the partNumber that is associated with this note request. The partNumber
must be in the range of 0 to 0xFFF - the method will itself do the bit shifting required for the noteRequestEventnr
- the NoteRequest to copyQTException
- if the offset would set data past the end of the MusicData
minus 4 bytes which is the end of sequence marker - which is not a general music event.public NoteRequest getNoteRequest(int offset) throws QTException
offset
- - the number of ints in the headerQTException
- if the offset would get data past the end of the MusicData
minus 4 bytes which is the end of sequence marker - which is not a general music event.public void setAtomicInstrument(int offset, int partNumber, AtomicInstrument ai) throws QTException
When an AtomicInstrument event is stuffed into music data it is surrounded by two music events (ints):
offset
- - the number of ints into the headerpartNumber
- - the partNumber that is associated with this atomic instrument. The partNumber
must be in the range of 0 to 0xFFF - the method will itself do the bit shifting required for the noteRequestEventai
- the AtomicInstrument to copyQTException
- if the offset would set data past the end of the MusicData
minus 4 bytes which is the end of sequence marker - which is not a general music event.public AtomicInstrument getAtomicInstrument(int offset) throws QTException
offset
- - the number of ints in the headerQTException
- if the offset would get data past the end of the MusicData
minus 4 bytes which is the end of sequence marker - which is not a general music event.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |