Package quicktime.std.music

Source Code of quicktime.std.music.MusicData

/*     */ package quicktime.std.music;
/*     */
/*     */ import quicktime.QTException;
/*     */ import quicktime.util.EndianOrder;
/*     */ import quicktime.util.QTHandle;
/*     */ import quicktime.util.UtilException;
/*     */
/*     */ public class MusicData extends QTHandle
/*     */ {
/*     */   public static final int kNoteRequestHeaderEventLength = 23;
/*     */
/*     */   public static int stuffGeneralEvent_Header(int paramInt1, int paramInt2)
/*     */   {
/*  52 */     int i = 0xF0000000 | paramInt1 << 16 | paramInt2 << 0;
/*     */
/*  55 */     return EndianOrder.flipNativeToBigEndian32(i);
/*     */   }
/*     */
/*     */   public static int stuffGeneralEvent_Footer(int paramInt1, int paramInt2)
/*     */   {
/*  67 */     int i = 0xC0000000 | paramInt1 << 16 | paramInt2 << 0;
/*     */
/*  70 */     return EndianOrder.flipNativeToBigEndian32(i);
/*     */   }
/*     */
/*     */   public static int stuffRestEvent(int paramInt)
/*     */   {
/*  79 */     int i = 0x0 | paramInt << 0;
/*  80 */     return EndianOrder.flipNativeToBigEndian32(i);
/*     */   }
/*     */
/*     */   public static int stuffNoteEvent(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
/*     */   {
/*  92 */     int i = 0x20000000 | paramInt1 << 24 | paramInt2 - 32 << 18 | paramInt3 - 0 << 11 | paramInt4 << 0;
/*     */
/*  97 */     return EndianOrder.flipNativeToBigEndian32(i);
/*     */   }
/*     */
/*     */   public static int stuffControlEvent(int paramInt1, int paramInt2, int paramInt3)
/*     */   {
/* 108 */     int i = 0x40000000 | paramInt1 << 24 | paramInt2 << 16 | (paramInt3 & qtma_MASK(16)) << 0;
/*     */
/* 112 */     return EndianOrder.flipNativeToBigEndian32(i);
/*     */   }
/*     */
/*     */   public static int stuffMarkerEvent(int paramInt1, int paramInt2)
/*     */   {
/* 122 */     int i = 0x60000000 | paramInt1 << 16 | paramInt2 << 0;
/*     */
/* 125 */     return EndianOrder.flipNativeToBigEndian32(i);
/*     */   }
/*     */
/*     */   public static long stuffXNoteEvent(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
/*     */   {
/* 138 */     long l1 = 0x90000000 | paramInt1 << 16 | paramInt2 << 0;
/*     */
/* 141 */     l1 = EndianOrder.flipNativeToBigEndian64(l1);
/*     */
/* 143 */     long l2 = 0x80000000 | paramInt4 << 0 | paramInt3 << 22;
/*     */
/* 146 */     l2 = EndianOrder.flipNativeToBigEndian64(l2);
/*     */
/* 148 */     l1 &= 4294967295L;
/* 149 */     l2 &= 4294967295L;
/*     */
/* 151 */     return l1 << 32 | l2;
/*     */   }
/*     */
/*     */   public static long stuffXControlEvent(int paramInt1, int paramInt2, int paramInt3)
/*     */   {
/* 163 */     long l1 = 0xA0000000 | paramInt1 << 16 | (paramInt3 & qtma_MASK(16)) << 0;
/*     */
/* 166 */     l1 = EndianOrder.flipNativeToBigEndian64(l1);
/* 167 */     long l2 = 0x80000000 | paramInt2 << 0;
/*     */
/* 169 */     l2 = EndianOrder.flipNativeToBigEndian64(l2);
/*     */
/* 171 */     l1 &= 4294967295L;
/* 172 */     l2 &= 4294967295L;
/*     */
/* 174 */     return l1 << 32 | l2;
/*     */   }
/*     */
/*     */   public static long stuffXKnobEvent(int paramInt1, int paramInt2, int paramInt3)
/*     */   {
/* 186 */     long l1 = 0xB0000000 | paramInt1 << 16 | paramInt3 >> 16 << 0;
/*     */
/* 189 */     l1 = EndianOrder.flipNativeToBigEndian64(l1);
/* 190 */     long l2 = 0x80000000 | paramInt2 << 16 | (paramInt3 & 0xFFFF) << 0;
/*     */
/* 193 */     l2 = EndianOrder.flipNativeToBigEndian64(l2);
/*     */
/* 195 */     l1 &= 4294967295L;
/* 196 */     l2 &= 4294967295L;
/*     */
/* 198 */     return l1 << 32 | l2;
/*     */   }
/*     */
/*     */   public static int eventType(int paramInt)
/*     */   {
/* 208 */     return qtma_EXT(paramInt, 29, 3) > 3 ? qtma_EXT(paramInt, 28, 4) : qtma_EXT(paramInt, 29, 3);
/*     */   }
/*     */
/*     */   public static int part(int paramInt)
/*     */   {
/* 219 */     return qtma_EXT(paramInt, 24, 5);
/*     */   }
/*     */
/*     */   public static int xPart(long paramLong)
/*     */   {
/* 229 */     long l = paramLong >>> 32;
/* 230 */     return qtma_EXT((int)l, 16, 12);
/*     */   }
/*     */
/*     */   public static int restDuration(int paramInt)
/*     */   {
/* 240 */     return qtma_EXT(paramInt, 0, 24);
/*     */   }
/*     */
/*     */   public static int notePitch(int paramInt)
/*     */   {
/* 250 */     return qtma_EXT(paramInt, 18, 6) + 32;
/*     */   }
/*     */
/*     */   public static int noteVelocity(int paramInt)
/*     */   {
/* 260 */     return qtma_EXT(paramInt, 11, 7) + 0;
/*     */   }
/*     */
/*     */   public static int noteDuration(int paramInt)
/*     */   {
/* 270 */     return qtma_EXT(paramInt, 0, 11);
/*     */   }
/*     */
/*     */   public static int xNotePitch(long paramLong)
/*     */   {
/* 280 */     long l = paramLong >>> 32;
/* 281 */     return qtma_EXT((int)l, 0, 16);
/*     */   }
/*     */
/*     */   public static int xNoteVelocity(long paramLong)
/*     */   {
/* 291 */     return qtma_EXT((int)paramLong, 22, 7);
/*     */   }
/*     */
/*     */   public static int xNoteDuration(long paramLong)
/*     */   {
/* 301 */     return qtma_EXT((int)paramLong, 0, 22);
/*     */   }
/*     */
/*     */   public static int controlController(int paramInt)
/*     */   {
/* 311 */     return qtma_EXT(paramInt, 16, 8);
/*     */   }
/*     */
/*     */   public static int controlValue(int paramInt)
/*     */   {
/* 321 */     return qtma_EXT(paramInt, 0, 16);
/*     */   }
/*     */
/*     */   public static int xControlController(long paramLong)
/*     */   {
/* 331 */     return qtma_EXT((int)paramLong, 0, 16);
/*     */   }
/*     */
/*     */   public static int xControlValue(long paramLong)
/*     */   {
/* 341 */     long l = paramLong >>> 32;
/* 342 */     return qtma_EXT((int)l, 0, 16);
/*     */   }
/*     */
/*     */   public static int markerSubtype(int paramInt)
/*     */   {
/* 352 */     return qtma_EXT(paramInt, 16, 8);
/*     */   }
/*     */
/*     */   public static int markerValue(int paramInt)
/*     */   {
/* 362 */     return qtma_EXT(paramInt, 0, 16);
/*     */   }
/*     */
/*     */   public static int xKnobValue(long paramLong)
/*     */   {
/* 372 */     int i = (int)(paramLong >>> 32);
/* 373 */     int j = (int)paramLong;
/* 374 */     return qtma_EXT(i, 0, 16) << 16 | qtma_EXT(j, 0, 16);
/*     */   }
/*     */
/*     */   public static int xKnobID(long paramLong)
/*     */   {
/* 385 */     return qtma_EXT((int)paramLong, 16, 14);
/*     */   }
/*     */
/*     */   public static int generalSubtype_Footer(int paramInt)
/*     */   {
/* 395 */     return qtma_EXT(paramInt, 16, 14);
/*     */   }
/*     */
/*     */   public static int generalLength(int paramInt)
/*     */   {
/* 406 */     return qtma_EXT(paramInt, 0, 16);
/*     */   }
/*     */
/*     */   private static int qtma_MASK(int paramInt)
/*     */   {
/* 411 */     return (1 << paramInt) - 1;
/*     */   }
/*     */   private static int qtma_EXT(int paramInt1, int paramInt2, int paramInt3) {
/* 414 */     return EndianOrder.flipBigEndianToNative32(paramInt1) >>> paramInt2 & qtma_MASK(paramInt3);
/*     */   }
/*     */
/*     */   public MusicData(int paramInt)
/*     */     throws QTException
/*     */   {
/* 424 */     super(paramInt, true);
/*     */
/* 426 */     setIntAt(paramInt - 4, EndianOrder.flipNativeToBigEndian32(1610612736));
/*     */   }
/*     */
/*     */   public void setSize(int paramInt)
/*     */     throws UtilException
/*     */   {
/* 436 */     super.setSize(paramInt);
/* 437 */     setIntAt(paramInt - 4, EndianOrder.flipNativeToBigEndian32(1610612736));
/*     */   }
/*     */
/*     */   public int getMusicEvent(int paramInt)
/*     */     throws QTException
/*     */   {
/* 448 */     if (paramInt * 4 >= getSize() - 4)
/* 449 */       throw new QTException(-50);
/* 450 */     return getIntAt(paramInt * 4);
/*     */   }
/*     */
/*     */   public void setMusicEvent(int paramInt1, int paramInt2)
/*     */     throws QTException
/*     */   {
/* 465 */     if (paramInt1 * 4 >= getSize())
/* 466 */       throw new QTException(-50);
/* 467 */     if ((paramInt1 * 4 == getSize() - 4) &&
/* 468 */       (paramInt2 != EndianOrder.flipNativeToBigEndian32(1610612736))) {
/* 469 */       throw new QTException(-50);
/*     */     }
/* 471 */     setIntAt(paramInt1 * 4, paramInt2);
/*     */   }
/*     */
/*     */   public long getXMusicEvent(int paramInt)
/*     */     throws QTException
/*     */   {
/* 483 */     if (paramInt * 4 >= getSize() - 8)
/* 484 */       throw new QTException(-50);
/* 485 */     return getLongAt(paramInt * 4);
/*     */   }
/*     */
/*     */   public void setXMusicEvent(int paramInt, long paramLong)
/*     */     throws QTException
/*     */   {
/* 497 */     if (paramInt * 4 >= getSize() - 8)
/* 498 */       throw new QTException(-50);
/* 499 */     setLongAt(paramInt * 4, paramLong);
/*     */   }
/*     */
/*     */   public void setNoteRequest(int paramInt1, int paramInt2, NoteRequest paramNoteRequest)
/*     */     throws QTException
/*     */   {
/* 529 */     if (paramInt1 * 4 >= getSize() - 92) {
/* 530 */       throw new QTException(-50);
/*     */     }
/*     */
/* 533 */     setIntAt(paramInt1 * 4, stuffGeneralEvent_Header(paramInt2, 23));
/* 534 */     copyFromArray(paramInt1 * 4 + 4, paramNoteRequest.getBytes(), 0, paramNoteRequest.getSize());
/*     */
/* 537 */     setIntAt(paramInt1 * 4 + 4 + paramNoteRequest.getSize(), stuffGeneralEvent_Footer(1, 23));
/*     */   }
/*     */
/*     */   public NoteRequest getNoteRequest(int paramInt)
/*     */     throws QTException
/*     */   {
/* 553 */     if (paramInt * 4 >= getSize() - 92) {
/* 554 */       throw new QTException(-50);
/*     */     }
/* 556 */     int i = getIntAt(paramInt * 4 + 84);
/*     */
/* 558 */     if (generalSubtype_Footer(i) != 1) {
/* 559 */       throw new QTException(-50);
/*     */     }
/* 561 */     NoteRequest localNoteRequest = new NoteRequest();
/* 562 */     copyToArray(paramInt * 4, localNoteRequest.getBytes(), 0, localNoteRequest.getSize());
/* 563 */     return localNoteRequest;
/*     */   }
/*     */
/*     */   public void setAtomicInstrument(int paramInt1, int paramInt2, AtomicInstrument paramAtomicInstrument)
/*     */     throws QTException
/*     */   {
/* 591 */     int i = paramAtomicInstrument.getSize() / 4;
/* 592 */     if (paramAtomicInstrument.getSize() % 4 != 0) {
/* 593 */       i++;
/*     */     }
/* 595 */     int j = i + 2;
/* 596 */     if (paramInt1 * 4 >= getSize() - j * 4) {
/* 597 */       throw new QTException(-50);
/*     */     }
/* 599 */     setIntAt(paramInt1 * 4, stuffGeneralEvent_Header(paramInt2, j));
/* 600 */     copyFromHandle(paramInt1 * 4 + 4, paramAtomicInstrument, 0, paramAtomicInstrument.getSize());
/* 601 */     setIntAt(paramInt1 * 4 + 4 + i * 4, stuffGeneralEvent_Footer(6, j));
/*     */   }
/*     */
/*     */   public AtomicInstrument getAtomicInstrument(int paramInt)
/*     */     throws QTException
/*     */   {
/* 616 */     if (paramInt * 4 > getSize() - 4) {
/* 617 */       throw new QTException(-50);
/*     */     }
/*     */
/* 620 */     int i = getIntAt(paramInt * 4 - 4);
/*     */
/* 623 */     int j = generalLength(i) * 4;
/*     */
/* 626 */     if (paramInt * 4 - 4 + j > getSize()) {
/* 627 */       throw new QTException(-50);
/*     */     }
/*     */
/* 630 */     int k = getIntAt(paramInt * 4 - 4 + j - 4);
/*     */
/* 633 */     if (generalSubtype_Footer(k) != 6) {
/* 634 */       throw new QTException(-50);
/*     */     }
/*     */
/* 637 */     int m = makeAndCopyHandle(paramInt * 4, j - 8);
/* 638 */     return new AtomicInstrument(m, null);
/*     */   }
/*     */ }

/* Location:           Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name:     quicktime.std.music.MusicData
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of quicktime.std.music.MusicData

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.