Package quicktime.sound

Source Code of quicktime.sound.SndChannel

/*     */ package quicktime.sound;
/*     */
/*     */ import quicktime.QTException;
/*     */ import quicktime.QTObject;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.std.clocks.Clock;
/*     */ import quicktime.std.movies.media.LevelMeterInfo;
/*     */ import quicktime.std.movies.media.MediaEQSpectrumBands;
/*     */ import quicktime.util.QTUtils;
/*     */
/*     */ public final class SndChannel extends QTObject
/*     */ {
/*  23 */   private static boolean apriori = QTSession.apriori();
/*     */   private static SoundRunner tempUPP;
/* 102 */   private boolean quietNow = false;
/*     */   private byte[] scratchArray;
/*     */   private SoundRunner sndUPP;
/*     */
/*     */   public SndChannel()
/*     */     throws QTException
/*     */   {
/*  32 */     this(5, 192);
/*     */   }
/*     */
/*     */   public SndChannel(int paramInt1, int paramInt2)
/*     */     throws QTException
/*     */   {
/*  43 */     super(allocate((short)paramInt1, paramInt2));
/*     */   }
/*     */
/*     */   public SndChannel(SoundCallBack paramSoundCallBack)
/*     */     throws QTException
/*     */   {
/*  56 */     this(5, 192, paramSoundCallBack);
/*     */   }
/*     */
/*     */   public SndChannel(int paramInt1, int paramInt2, SoundCallBack paramSoundCallBack)
/*     */     throws QTException
/*     */   {
/*  69 */     super(allocate((short)paramInt1, paramInt2, paramSoundCallBack));
/*  70 */     if (paramSoundCallBack != null) {
/*  71 */       this.sndUPP = tempUPP;
/*  72 */       this.sndUPP.setSndChannel(this);
/*     */     }
/*  74 */     tempUPP = null;
/*     */   }
/*     */
/*     */   private static int allocate(short paramShort, int paramInt, SoundCallBack paramSoundCallBack) throws QTException {
/*  78 */     int[] arrayOfInt = { 0 };
/*     */
/*  80 */     if (paramSoundCallBack != null) {
/*  81 */       tempUPP = new SoundRunner(paramSoundCallBack);
/*  82 */       SoundException.checkError(SndNewChannel(arrayOfInt, paramShort, paramInt, tempUPP.getClosure()));
/*     */     }
/*     */     else
/*     */     {
/*  86 */       SoundException.checkError(SndNewChannel(arrayOfInt, paramShort, paramInt, 0));
/*     */     }
/*     */
/*  91 */     return arrayOfInt[0];
/*     */   }
/*     */
/*     */   private static int allocate(short paramShort, int paramInt) throws SoundException {
/*  95 */     int[] arrayOfInt = { 0 };
/*  96 */     SoundException.checkError(SndNewChannel(arrayOfInt, paramShort, paramInt, 0));
/*     */
/*  99 */     return arrayOfInt[0];
/*     */   }
/*     */
/*     */   protected void _dispose()
/*     */     throws QTException
/*     */   {
/* 108 */     if (this.sndUPP != null) {
/* 109 */       this.sndUPP.cleanup();
/* 110 */       this.sndUPP = null;
/*     */     }
/*     */   }
/*     */
/*     */   public boolean isQuietNow() {
/* 115 */     return this.quietNow;
/*     */   }
/*     */
/*     */   public void setQuietNow(boolean paramBoolean)
/*     */   {
/* 126 */     this.quietNow = paramBoolean;
/*     */   }
/*     */
/*     */   public void play(SndHandle paramSndHandle)
/*     */     throws SoundException
/*     */   {
/* 136 */     SoundException.checkError(SndPlay(_ID(), QTObject.ID(paramSndHandle), (byte)1));
/*     */   }
/*     */
/*     */   public boolean isFinished()
/*     */     throws SoundException
/*     */   {
/* 148 */     if (this.scratchArray == null)
/* 149 */       this.scratchArray = new byte[24];
/* 150 */     int i = SndChannelStatus(_ID(), (short)24, this.scratchArray);
/* 151 */     SoundException.checkError(i);
/* 152 */     return (this.scratchArray[12] == 0) && (this.scratchArray[14] == 0);
/*     */   }
/*     */
/*     */   public boolean isPaused()
/*     */     throws SoundException
/*     */   {
/* 161 */     if (this.scratchArray == null)
/* 162 */       this.scratchArray = new byte[24];
/* 163 */     int i = SndChannelStatus(_ID(), (short)24, this.scratchArray);
/* 164 */     SoundException.checkError(i);
/* 165 */     return this.scratchArray[14] != 0;
/*     */   }
/*     */
/*     */   public SCStatus status()
/*     */     throws SoundException
/*     */   {
/* 175 */     SCStatus localSCStatus = new SCStatus();
/* 176 */     int i = SndChannelStatus(_ID(), (short)24, localSCStatus.getBytes());
/* 177 */     SoundException.checkError(i);
/* 178 */     return localSCStatus;
/*     */   }
/*     */
/*     */   public void doCommand(SndCommand paramSndCommand)
/*     */     throws SoundException
/*     */   {
/* 187 */     doCommand(paramSndCommand, true);
/*     */   }
/*     */
/*     */   public void doCommand(SndCommand paramSndCommand, boolean paramBoolean)
/*     */     throws SoundException
/*     */   {
/* 197 */     SoundException.checkError(SndDoCommand(_ID(), QTObject.ID(paramSndCommand), (byte)(paramBoolean ? 1 : 0)));
/*     */   }
/*     */
/*     */   public void doImmediate(SndCommand paramSndCommand)
/*     */     throws SoundException
/*     */   {
/* 208 */     SoundException.checkError(SndDoImmediate(_ID(), QTObject.ID(paramSndCommand)));
/*     */   }
/*     */
/*     */   public boolean getLevelMeterOnOff()
/*     */     throws SoundException
/*     */   {
/* 219 */     byte[] arrayOfByte = { 0 };
/* 220 */     SoundException.checkError(SndGetInfo(_ID(), 1819108724, arrayOfByte));
/*     */
/* 223 */     return arrayOfByte[0] != 0;
/*     */   }
/*     */
/*     */   public void setLevelMeterOnOff(boolean paramBoolean)
/*     */     throws SoundException
/*     */   {
/* 232 */     SoundException.checkError(SndSetInfo(_ID(), 1819108724, (byte)(paramBoolean ? 1 : 0)));
/*     */   }
/*     */
/*     */   public void enableClock(boolean paramBoolean)
/*     */     throws SoundException
/*     */   {
/* 243 */     SoundException.checkError(SndSetInfo(_ID(), 1935895659, (byte)(paramBoolean ? 1 : 0)));
/*     */   }
/*     */
/*     */   public Clock getClock()
/*     */     throws SoundException
/*     */   {
/* 254 */     return Clock.fromSndChannel(this);
/*     */   }
/*     */
/*     */   public LevelMeterInfo getActiveLevels()
/*     */     throws SoundException
/*     */   {
/* 262 */     LevelMeterInfo localLevelMeterInfo = new LevelMeterInfo();
/* 263 */     int i = SndGetInfo(_ID(), 1819107683, localLevelMeterInfo.getBytes());
/* 264 */     return localLevelMeterInfo;
/*     */   }
/*     */
/*     */   public MediaEQSpectrumBands getEQSpectrumBands(int paramInt)
/*     */     throws SoundException
/*     */   {
/* 274 */     MediaEQSpectrumBands localMediaEQSpectrumBands = new MediaEQSpectrumBands(paramInt);
/* 275 */     SoundException.checkError(SndGetInfo(_ID(), 1701933922, localMediaEQSpectrumBands.getBytes()));
/*     */
/* 278 */     return localMediaEQSpectrumBands;
/*     */   }
/*     */
/*     */   public void setEQSpectrumBands(MediaEQSpectrumBands paramMediaEQSpectrumBands)
/*     */     throws SoundException
/*     */   {
/* 289 */     SoundException.checkError(SndSetInfo(_ID(), 1701933922, paramMediaEQSpectrumBands.getBytes()));
/*     */   }
/*     */
/*     */   public int[] getEQSpectrumLevels(int paramInt)
/*     */     throws SoundException
/*     */   {
/* 300 */     byte[] arrayOfByte = new byte[paramInt];
/* 301 */     SoundException.checkError(SndGetInfo(_ID(), 1701932150, arrayOfByte));
/*     */
/* 305 */     int[] arrayOfInt = new int[paramInt];
/* 306 */     for (int i = 0; i < arrayOfInt.length; i++) {
/* 307 */       arrayOfInt[i] = QTUtils.UByte2Int(arrayOfByte[i]);
/*     */     }
/* 309 */     return arrayOfInt;
/*     */   }
/*     */
/*     */   public boolean getEQToneControlOnOff()
/*     */     throws SoundException
/*     */   {
/* 318 */     byte[] arrayOfByte = { 0 };
/* 319 */     SoundException.checkError(SndGetInfo(_ID(), 1701934179, arrayOfByte));
/*     */
/* 322 */     return arrayOfByte[0] != 0;
/*     */   }
/*     */
/*     */   public void setEQToneControlOnOff(boolean paramBoolean)
/*     */     throws SoundException
/*     */   {
/* 331 */     byte[] arrayOfByte = { 0 };
/* 332 */     SoundException.checkError(SndSetInfo(_ID(), 1701934179, (byte)(paramBoolean ? 1 : 0)));
/*     */   }
/*     */
/*     */   public void setEQToneControlGain(int paramInt1, int paramInt2)
/*     */     throws SoundException
/*     */   {
/* 345 */     int i = QTUtils.X2ShortFix(paramInt1);
/* 346 */     int j = QTUtils.X2ShortFix(paramInt2);
/* 347 */     int k = j << 16 | i & 0xFFFF;
/* 348 */     SoundException.checkError(SndSetInfo(_ID(), 1701934183, k));
/*     */   }
/*     */
/*     */   public int[] getEQToneControlGain()
/*     */     throws SoundException
/*     */   {
/* 360 */     int[] arrayOfInt = new int[2];
/* 361 */     SoundException.checkError(SndGetInfo(_ID(), 1701934183, arrayOfInt));
/*     */
/* 364 */     int i = arrayOfInt[0];
/* 365 */     arrayOfInt[0] = (i | 0xFFFF);
/* 366 */     arrayOfInt[1] = (i >>> 16);
/* 367 */     return arrayOfInt;
/*     */   }
/*     */
/*     */   private static native short SndNewChannel(int[] paramArrayOfInt, short paramShort, int paramInt1, int paramInt2);
/*     */
/*     */   private static native short SndPlay(int paramInt1, int paramInt2, byte paramByte);
/*     */
/*     */   private static native short SndChannelStatus(int paramInt, short paramShort, byte[] paramArrayOfByte);
/*     */
/*     */   private static native short SndDoCommand(int paramInt1, int paramInt2, byte paramByte);
/*     */
/*     */   private static native short SndDoImmediate(int paramInt1, int paramInt2);
/*     */
/*     */   private static native short SndSetInfo(int paramInt1, int paramInt2, byte paramByte);
/*     */
/*     */   private static native short SndSetInfo(int paramInt1, int paramInt2, byte[] paramArrayOfByte);
/*     */
/*     */   private static native short SndSetInfo(int paramInt1, int paramInt2, int paramInt3);
/*     */
/*     */   private static native short SndGetInfo(int paramInt1, int paramInt2, byte[] paramArrayOfByte);
/*     */
/*     */   private static native short SndGetInfo(int paramInt1, int paramInt2, int[] paramArrayOfInt);
/*     */ }

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

Related Classes of quicktime.sound.SndChannel

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.