Package quicktime.std.music

Source Code of quicktime.std.music.ToneDescription

/*     */ package quicktime.std.music;
/*     */
/*     */ import com.apple.mrj.macos.carbon.CarbonAccess;
/*     */ import com.apple.mrj.macos.carbon.CarbonEventClient;
/*     */ import java.io.IOException;
/*     */ import java.io.ObjectInputStream;
/*     */ import java.io.ObjectOutputStream;
/*     */ import quicktime.QTException;
/*     */ import quicktime.QTObject;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.jdirect.QTNative;
/*     */ import quicktime.std.StdQTException;
/*     */ import quicktime.util.EndianOrder;
/*     */ import quicktime.util.QTByteObject;
/*     */ import quicktime.util.QTUtils;
/*     */ import quicktime.util.UtilException;
/*     */
/*     */ public final class ToneDescription extends QTByteObject
/*     */   implements Cloneable
/*     */ {
/*  29 */   private static boolean apriori = QTSession.apriori();
/*     */   public static final int kNativeSize = 76;
/*     */   static final long serialVersionUID = 2107309866399025424L;
/* 213 */   int res = 0;
/*     */
/*     */   public ToneDescription()
/*     */   {
/*  44 */     super(76);
/*     */   }
/*     */
/*     */   public ToneDescription(int paramInt)
/*     */     throws QTException
/*     */   {
/*  54 */     this(NoteAllocator.getDefault(), paramInt);
/*     */   }
/*     */
/*     */   public ToneDescription(NoteAllocator paramNoteAllocator, int paramInt)
/*     */     throws StdQTException
/*     */   {
/*  65 */     this();
/*  66 */     stuff(paramNoteAllocator, paramInt);
/*     */   }
/*     */
/*     */   private ToneDescription(byte[] paramArrayOfByte)
/*     */   {
/*  71 */     super(paramArrayOfByte);
/*     */   }
/*     */
/*     */   private void readObject(ObjectInputStream paramObjectInputStream)
/*     */     throws IOException
/*     */   {
/*  79 */     this.bytes = new byte[76];
/*     */
/*  81 */     paramObjectInputStream.read(getBytes());
/*     */   }
/*     */
/*     */   private void writeObject(ObjectOutputStream paramObjectOutputStream)
/*     */     throws IOException
/*     */   {
/*  88 */     paramObjectOutputStream.write(getBytes());
/*     */   }
/*     */
/*     */   public final int getSynthesizerType()
/*     */   {
/*  98 */     return EndianOrder.flipBigEndianToNative32(getIntAt(0));
/*     */   }
/*     */
/*     */   public final void setSynthesizerType(int paramInt)
/*     */   {
/* 106 */     setIntAt(0, EndianOrder.flipNativeToBigEndian32(paramInt));
/*     */   }
/*     */
/*     */   public final String getSynthesizerName()
/*     */     throws UtilException
/*     */   {
/* 113 */     return getPStringAt(4);
/*     */   }
/*     */
/*     */   public final void setSynthesizerName(String paramString)
/*     */     throws UtilException
/*     */   {
/* 119 */     setPStringAt(4, 31, paramString);
/*     */   }
/*     */
/*     */   public final String getInstrumentName() throws UtilException
/*     */   {
/* 124 */     return getPStringAt(36);
/*     */   }
/*     */
/*     */   public final void setInstrumentName(String paramString)
/*     */     throws UtilException
/*     */   {
/* 130 */     setPStringAt(36, 31, paramString);
/*     */   }
/*     */
/*     */   public final int getInstrumentNumber()
/*     */   {
/* 137 */     return EndianOrder.flipBigEndianToNative32(getIntAt(68));
/*     */   }
/*     */
/*     */   public final void setInstrumentNumber(int paramInt)
/*     */   {
/* 145 */     setIntAt(68, EndianOrder.flipNativeToBigEndian32(paramInt));
/*     */   }
/*     */
/*     */   public final int getGMNumber()
/*     */   {
/* 153 */     return EndianOrder.flipBigEndianToNative32(getIntAt(72));
/*     */   }
/*     */
/*     */   public final void setGMNumber(int paramInt)
/*     */   {
/* 161 */     setIntAt(72, EndianOrder.flipNativeToBigEndian32(paramInt));
/*     */   }
/*     */
/*     */   public final void stuff(NoteAllocator paramNoteAllocator, int paramInt)
/*     */     throws StdQTException
/*     */   {
/* 172 */     StdQTException.checkError(NAStuffToneDescription(QTObject.ID(paramNoteAllocator), paramInt, getBytes()));
/*     */   }
/*     */
/*     */   public final void pickInstrument(NoteAllocator paramNoteAllocator, String paramString, int paramInt)
/*     */     throws StdQTException
/*     */   {
/* 186 */     int i = 0;
/* 187 */     NoteAllocator localNoteAllocator = paramNoteAllocator;
/* 188 */     String str = paramString;
/* 189 */     int j = paramInt;
/*     */
/* 191 */     if (QTSession.isCurrentOS(4)) {
/* 192 */       i = ((Integer)CarbonAccess.invokeCarbonEventClient(new CarbonEventClient() { int res1;
/*     */         private final NoteAllocator val$f_na;
/*     */         private final String val$f_prompt;
/*     */         private final int val$f_flags;
/*     */
/* 196 */         public Object invoke() { int i = 0;
/* 197 */           synchronized (QTNative.globalsLock) {
/* 198 */             i = ToneDescription.NAPickInstrument(QTObject.ID(this.val$f_na), 0, QTUtils.String2PString(this.val$f_prompt, 255), ToneDescription.this.getBytes(), this.val$f_flags, 0, 0, 0);
/*     */           }
/*     */
/* 201 */           return new Integer(i);
/*     */         }
/*     */       })).intValue();
/*     */
/* 204 */       StdQTException.checkError(i);
/*     */     } else {
/* 206 */       synchronized (QTNative.globalsLock) {
/* 207 */         i = NAPickInstrument(QTObject.ID(paramNoteAllocator), 0, QTUtils.String2PString(paramString, 255), getBytes(), paramInt, 0, 0, 0);
/*     */       }
/*     */
/* 210 */       StdQTException.checkError(i);
/*     */     }
/*     */   }
/*     */
/*     */   public String toString()
/*     */   {
/* 216 */     String str = "";
/*     */     try {
/* 218 */       str = getInstrumentName();
/*     */     } catch (UtilException localUtilException) {
/*     */     }
/* 221 */     return getClass().getName() + "[synthType=" + QTUtils.fromOSType(getSynthesizerType()) + ",instNum=" + Integer.toString(getInstrumentNumber()) + ",gmNum=" + Integer.toString(getGMNumber()) + ",instName=" + str + "]";
/*     */   }
/*     */
/*     */   public Object clone()
/*     */   {
/* 230 */     return new ToneDescription(getBytes());
/*     */   }
/*     */
/*     */   private static native int NAStuffToneDescription(int paramInt1, int paramInt2, byte[] paramArrayOfByte);
/*     */
/*     */   private static native int NAPickInstrument(int paramInt1, int paramInt2, byte[] paramArrayOfByte1, byte[] paramArrayOfByte2, int paramInt3, int paramInt4, int paramInt5, int paramInt6);
/*     */
/*     */   private static native int GetMainEventLoop();
/*     */ }

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

Related Classes of quicktime.std.music.ToneDescription

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.