/* */ package quicktime.std.music;
/* */
/* */ import com.apple.mrj.macos.carbon.CarbonAccess;
/* */ import com.apple.mrj.macos.carbon.CarbonEventClient;
/* */ import quicktime.QTException;
/* */ import quicktime.QTObject;
/* */ import quicktime.QTSession;
/* */ import quicktime.jdirect.QTNative;
/* */ import quicktime.std.StdQTException;
/* */ import quicktime.util.QTPointerRef;
/* */ import quicktime.util.QTUtils;
/* */
/* */ public final class NoteChannel extends QTObject
/* */ {
/* 30 */ private static boolean apriori = QTSession.apriori();
/* */ public static final float kMicrotonalResolution = 0.007813F;
/* */ public static final float kMicroControllerResolution = 0.007813F;
/* */ private NoteAllocator na;
/* */
/* */ private static int allocate(NoteAllocator paramNoteAllocator, NoteRequest paramNoteRequest)
/* */ throws QTException
/* */ {
/* 40 */ int[] arrayOfInt = new int[1];
/* 41 */ StdQTException.checkError(NANewNoteChannel(QTObject.ID(paramNoteAllocator), paramNoteRequest.getBytes(), arrayOfInt));
/* */
/* 44 */ return arrayOfInt[0];
/* */ }
/* */
/* */ private static int allocate(NoteAllocator paramNoteAllocator, int paramInt) throws QTException {
/* 48 */ ToneDescription localToneDescription = new ToneDescription(paramNoteAllocator, paramInt);
/* 49 */ NoteRequest localNoteRequest = new NoteRequest(localToneDescription);
/* 50 */ int[] arrayOfInt = new int[1];
/* 51 */ StdQTException.checkError(NANewNoteChannel(QTObject.ID(paramNoteAllocator), localNoteRequest.getBytes(), arrayOfInt));
/* */
/* 54 */ return arrayOfInt[0];
/* */ }
/* */
/* */ public NoteChannel(int paramInt1, int paramInt2)
/* */ throws QTException
/* */ {
/* 67 */ this(new NoteRequest(paramInt1, paramInt2));
/* */ }
/* */
/* */ public NoteChannel(NoteRequest paramNoteRequest)
/* */ throws QTException
/* */ {
/* 77 */ this(NoteAllocator.getDefault(), paramNoteRequest);
/* */ }
/* */
/* */ public NoteChannel(NoteAllocator paramNoteAllocator, NoteRequest paramNoteRequest)
/* */ throws QTException
/* */ {
/* 87 */ super(allocate(paramNoteAllocator, paramNoteRequest), QTObject.ID(paramNoteAllocator));
/* 88 */ this.na = paramNoteAllocator;
/* */ }
/* */
/* */ public NoteChannel(NoteAllocator paramNoteAllocator, int paramInt)
/* */ throws QTException
/* */ {
/* 99 */ super(allocate(paramNoteAllocator, paramInt), QTObject.ID(paramNoteAllocator));
/* 100 */ this.na = paramNoteAllocator;
/* */ }
/* */
/* */ NoteChannel(NoteAllocator paramNoteAllocator, int paramInt, Object paramObject)
/* */ {
/* 109 */ super(paramInt, paramObject);
/* 110 */ this.na = paramNoteAllocator;
/* */ }
/* */
/* */ public final NoteAllocator getNoteAllocator()
/* */ {
/* 118 */ return this.na;
/* */ }
/* */
/* */ public final int getIndexInfo()
/* */ throws StdQTException
/* */ {
/* 126 */ int[] arrayOfInt1 = new int[1];
/* 127 */ int[] arrayOfInt2 = new int[1];
/* 128 */ StdQTException.checkError(NAGetNoteChannelInfo(QTObject.ID(this.na), _ID(), arrayOfInt1, arrayOfInt2));
/* 129 */ return arrayOfInt1[0];
/* */ }
/* */
/* */ public final int getPartInfo()
/* */ throws StdQTException
/* */ {
/* 138 */ int[] arrayOfInt1 = new int[1];
/* 139 */ int[] arrayOfInt2 = new int[1];
/* 140 */ StdQTException.checkError(NAGetNoteChannelInfo(QTObject.ID(this.na), _ID(), arrayOfInt1, arrayOfInt2));
/* 141 */ return arrayOfInt2[0];
/* */ }
/* */
/* */ public MusicComponent getMusicComponent()
/* */ throws StdQTException
/* */ {
/* 151 */ int[] arrayOfInt = new int[1];
/* 152 */ int i = NAGetRegisteredMusicDevice(QTObject.ID(this.na), getIndexInfo(), 0, 0, 0, arrayOfInt);
/* 153 */ if (i < 0) StdQTException.checkError(i);
/* 154 */ return new MusicComponent(arrayOfInt[0], this);
/* */ }
/* */
/* */ public final void preroll()
/* */ throws StdQTException
/* */ {
/* 162 */ StdQTException.checkError(NAPrerollNoteChannel(QTObject.ID(this.na), _ID()));
/* */ }
/* */
/* */ public final void unroll()
/* */ throws StdQTException
/* */ {
/* 170 */ StdQTException.checkError(NAUnrollNoteChannel(QTObject.ID(this.na), _ID()));
/* */ }
/* */
/* */ public final void reset()
/* */ throws StdQTException
/* */ {
/* 179 */ StdQTException.checkError(NAResetNoteChannel(QTObject.ID(this.na), _ID()));
/* */ }
/* */
/* */ public final void setVolume(float paramFloat)
/* */ throws StdQTException
/* */ {
/* 188 */ StdQTException.checkError(NASetNoteChannelVolume(QTObject.ID(this.na), _ID(), QTUtils.X2Fix(paramFloat)));
/* */ }
/* */
/* */ public final void setBalance(int paramInt)
/* */ throws StdQTException
/* */ {
/* 197 */ StdQTException.checkError(NASetNoteChannelBalance(QTObject.ID(this.na), _ID(), paramInt));
/* */ }
/* */
/* */ public final void playNoteRaw(int paramInt1, int paramInt2)
/* */ throws StdQTException
/* */ {
/* 207 */ StdQTException.checkError(NAPlayNote(QTObject.ID(this.na), _ID(), paramInt1, paramInt2));
/* */ }
/* */
/* */ public final void playNoteCents(int paramInt1, int paramInt2, int paramInt3)
/* */ throws StdQTException
/* */ {
/* 219 */ paramInt1 <<= 8;
/* 220 */ paramInt1 += (int)(1.28F * paramInt2 + 0.5F);
/* 221 */ playNoteRaw(paramInt1, paramInt3);
/* */ }
/* */
/* */ public final void playNote(float paramFloat, int paramInt)
/* */ throws StdQTException
/* */ {
/* 232 */ StdQTException.checkError(NAPlayNote(QTObject.ID(this.na), _ID(), QTUtils.X2ShortFix(paramFloat), paramInt));
/* */ }
/* */
/* */ public final float getController(int paramInt)
/* */ throws StdQTException
/* */ {
/* 243 */ int[] arrayOfInt = { 0 };
/* 244 */ StdQTException.checkError(NAGetController(QTObject.ID(this.na), _ID(), paramInt, arrayOfInt));
/* 245 */ return QTUtils.ShortFix2X((short)arrayOfInt[0]);
/* */ }
/* */
/* */ public final void setControllerRaw(int paramInt1, int paramInt2)
/* */ throws StdQTException
/* */ {
/* 256 */ StdQTException.checkError(NASetController(QTObject.ID(this.na), _ID(), paramInt1, paramInt2));
/* */ }
/* */
/* */ public final void setController(int paramInt, float paramFloat)
/* */ throws StdQTException
/* */ {
/* 267 */ StdQTException.checkError(NASetController(QTObject.ID(this.na), _ID(), paramInt, QTUtils.X2ShortFix(paramFloat)));
/* */ }
/* */
/* */ public final int getKnob(int paramInt)
/* */ throws StdQTException
/* */ {
/* 277 */ int[] arrayOfInt = new int[1];
/* 278 */ StdQTException.checkError(NAGetKnob(QTObject.ID(this.na), _ID(), paramInt, arrayOfInt));
/* 279 */ return arrayOfInt[0];
/* */ }
/* */
/* */ public final void setKnob(int paramInt1, int paramInt2)
/* */ throws StdQTException
/* */ {
/* 289 */ StdQTException.checkError(NASetKnob(QTObject.ID(this.na), _ID(), paramInt1, paramInt2));
/* */ }
/* */
/* */ public final int findTone(ToneDescription paramToneDescription)
/* */ throws StdQTException
/* */ {
/* 299 */ int[] arrayOfInt = new int[1];
/* 300 */ StdQTException.checkError(NAFindNoteChannelTone(QTObject.ID(this.na), _ID(), paramToneDescription.getBytes(), arrayOfInt));
/* */
/* 303 */ return arrayOfInt[0];
/* */ }
/* */
/* */ public final void setAtomicInstrument(AtomicInstrument paramAtomicInstrument, int paramInt)
/* */ throws StdQTException
/* */ {
/* 313 */ QTPointerRef localQTPointerRef = paramAtomicInstrument.toQTPointer();
/* 314 */ int i = NASetAtomicInstrument(QTObject.ID(this.na), _ID(), QTObject.ID(localQTPointerRef), paramInt);
/* 315 */ if (!paramAtomicInstrument.isLocked()) paramAtomicInstrument.unlock();
/* 316 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public final void setInstrumentNumber(int paramInt)
/* */ throws StdQTException
/* */ {
/* 325 */ StdQTException.checkError(NASetInstrumentNumber(QTObject.ID(this.na), _ID(), paramInt));
/* */ }
/* */
/* */ public final NoteRequest getNoteRequest()
/* */ throws QTException
/* */ {
/* 334 */ NoteRequest localNoteRequest = new NoteRequest();
/* 335 */ StdQTException.checkError(NAGetNoteRequest(QTObject.ID(this.na), _ID(), localNoteRequest.getBytes()));
/* */
/* 338 */ return localNoteRequest;
/* */ }
/* */
/* */ public final void pickEditInstrument(String paramString, int paramInt)
/* */ throws StdQTException
/* */ {
/* 348 */ String str = paramString;
/* 349 */ int i = paramInt;
/* 350 */ int j = _ID();
/* 351 */ int k = 0;
/* 352 */ if (QTSession.isCurrentOS(4)) {
/* 353 */ k = ((Integer)CarbonAccess.invokeCarbonEventClient(new CarbonEventClient() { private final String val$f_prompt;
/* */ private final int val$f_i;
/* */ private final int val$f_flags;
/* */
/* 355 */ public Object invoke() { int i = 0;
/* 356 */ synchronized (QTNative.globalsLock) {
/* 357 */ i = NoteChannel.NAPickEditInstrument(QTObject.ID(NoteChannel.this.na), 0, QTUtils.String2PString(this.val$f_prompt, 255), 0, this.val$f_i, 0, this.val$f_flags);
/* 358 */ return new Integer(i);
/* */ }
/* */ }
/* */ })).intValue();
/* */
/* 362 */ StdQTException.checkError(k);
/* */ } else {
/* 364 */ synchronized (QTNative.globalsLock) {
/* 365 */ StdQTException.checkError(NAPickEditInstrument(QTObject.ID(this.na), 0, QTUtils.String2PString(paramString, 255), 0, _ID(), 0, paramInt));
/* */ }
/* */ }
/* */ }
/* */
/* */ public final void sendMIDI(MusicMIDIPacket paramMusicMIDIPacket)
/* */ throws StdQTException
/* */ {
/* 375 */ int i = NASendMIDI(QTObject.ID(this.na), _ID(), paramMusicMIDIPacket.getBytes());
/* 376 */ StdQTException.checkError(i);
/* */ }
/* */
/* */ public final void setSoundLocalization(SoundLocalization paramSoundLocalization)
/* */ throws StdQTException
/* */ {
/* 385 */ StdQTException.checkError(NASetNoteChannelSoundLocalization(QTObject.ID(this.na), _ID(), QTObject.ID(paramSoundLocalization)));
/* */ }
/* */
/* */ private static native int NANewNoteChannel(int paramInt, byte[] paramArrayOfByte, int[] paramArrayOfInt);
/* */
/* */ private static native int NAGetNoteChannelInfo(int paramInt1, int paramInt2, int[] paramArrayOfInt1, int[] paramArrayOfInt2);
/* */
/* */ private static native int NAPrerollNoteChannel(int paramInt1, int paramInt2);
/* */
/* */ private static native int NAUnrollNoteChannel(int paramInt1, int paramInt2);
/* */
/* */ private static native int NAResetNoteChannel(int paramInt1, int paramInt2);
/* */
/* */ private static native int NASetNoteChannelVolume(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native int NAPlayNote(int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native int NAGetController(int paramInt1, int paramInt2, int paramInt3, int[] paramArrayOfInt);
/* */
/* */ private static native int NASetController(int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native int NAGetKnob(int paramInt1, int paramInt2, int paramInt3, int[] paramArrayOfInt);
/* */
/* */ private static native int NASetKnob(int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native int NAFindNoteChannelTone(int paramInt1, int paramInt2, byte[] paramArrayOfByte, int[] paramArrayOfInt);
/* */
/* */ private static native int NASetAtomicInstrument(int paramInt1, int paramInt2, int paramInt3, int paramInt4);
/* */
/* */ private static native int NASetInstrumentNumber(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native int NAGetNoteRequest(int paramInt1, int paramInt2, byte[] paramArrayOfByte);
/* */
/* */ private static native int NAPickEditInstrument(int paramInt1, int paramInt2, byte[] paramArrayOfByte, int paramInt3, int paramInt4, int paramInt5, int paramInt6);
/* */
/* */ private static native int NASendMIDI(int paramInt1, int paramInt2, byte[] paramArrayOfByte);
/* */
/* */ private static native int NASetNoteChannelSoundLocalization(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native int NASetNoteChannelBalance(int paramInt1, int paramInt2, int paramInt3);
/* */
/* */ private static native int NAGetRegisteredMusicDevice(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int[] paramArrayOfInt);
/* */ }
/* Location: Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name: quicktime.std.music.NoteChannel
* JD-Core Version: 0.6.2
*/