Package quicktime.sound

Source Code of quicktime.sound.SPB

/*     */ package quicktime.sound;
/*     */
/*     */ import quicktime.QTException;
/*     */ import quicktime.QTObject;
/*     */ import quicktime.QTRuntimeException;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.jdirect.QTNative;
/*     */ import quicktime.util.QTByteObject;
/*     */ import quicktime.util.QTPointer;
/*     */ import quicktime.util.QTPointerRef;
/*     */
/*     */ public final class SPB extends QTByteObject
/*     */ {
/*  14 */   private static boolean apriori = QTSession.apriori();
/*     */   public static final int kNativeSize = 38;
/*     */   private SPBDevice device;
/*     */   private QTPointerRef buffer;
/*     */   private SoundRunner runner;
/*     */   private QTPointer realObject;
/* 281 */   private short[] recordingStatus = { 0 };
/* 282 */   private short[] meterLevelValue = { 0 };
/* 283 */   private int[] totalSamplesToRecordVal = { 0 };
/* 284 */   private int[] numberOfSamplesRecordedVal = { 0 };
/* 285 */   private int[] totalMsecsToRecordVal = { 0 };
/* 286 */   private int[] numberOfMsecsRecordedVal = { 0 };
/*     */
/*     */   public SPB(SPBDevice paramSPBDevice, int paramInt1, int paramInt2, QTPointerRef paramQTPointerRef)
/*     */   {
/*  41 */     super(38);
/*     */     try {
/*  43 */       this.realObject = new QTPointer(38, true);
/*     */     } catch (QTException localQTException) {
/*  45 */       throw new QTRuntimeException(localQTException);
/*     */     }
/*  47 */     setIntAt(0, QTObject.ID(paramSPBDevice));
/*  48 */     setIntInPointer(QTObject.ID(this.realObject), 0, QTObject.ID(paramSPBDevice));
/*     */
/*  50 */     setIntAt(12, paramQTPointerRef.getSize());
/*  51 */     setIntInPointer(QTObject.ID(this.realObject), 12, paramQTPointerRef.getSize());
/*     */
/*  53 */     this.device = paramSPBDevice;
/*  54 */     setCount(paramInt1);
/*  55 */     setMilliseconds(paramInt2);
/*  56 */     setBuffer(paramQTPointerRef);
/*     */   }
/*     */
/*     */   public void setCompletionProc(SICompletion paramSICompletion)
/*     */   {
/*  67 */     if (this.runner != null)
/*  68 */       this.runner.cleanup();
/*  69 */     if (paramSICompletion == null) {
/*  70 */       setIntAt(20, 0);
/*  71 */       setIntInPointer(QTObject.ID(this.realObject), 20, 0);
/*  72 */       this.runner = null;
/*     */     } else {
/*  74 */       this.runner = new SoundRunner(this, paramSICompletion);
/*  75 */       int i = this.runner.getClosure();
/*     */
/*  78 */       SetSICompletionProc(QTObject.ID(this.realObject), i, 0);
/*     */     }
/*     */   }
/*     */
/*     */   public void removeCompletionProc() {
/*  83 */     setCompletionProc(null);
/*     */   }
/*     */
/*     */   public int getCount()
/*     */   {
/*  90 */     return getIntFromPointer(QTObject.ID(this.realObject), 4);
/*     */   }
/*     */
/*     */   public void setCount(int paramInt)
/*     */   {
/*  97 */     setIntAt(4, paramInt);
/*  98 */     setIntInPointer(QTObject.ID(this.realObject), 4, paramInt);
/*     */   }
/*     */
/*     */   public int getBufferLength()
/*     */   {
/* 105 */     return getIntFromPointer(QTObject.ID(this.realObject), 12);
/*     */   }
/*     */
/*     */   public int getMilliseconds()
/*     */   {
/* 111 */     return getIntFromPointer(QTObject.ID(this.realObject), 8);
/*     */   }
/*     */
/*     */   public void setMilliseconds(int paramInt)
/*     */   {
/* 118 */     setIntAt(8, paramInt);
/* 119 */     setIntInPointer(QTObject.ID(this.realObject), 8, paramInt);
/*     */   }
/*     */
/*     */   public SPBDevice getDevice()
/*     */   {
/* 127 */     return this.device;
/*     */   }
/*     */
/*     */   public void setBuffer(QTPointerRef paramQTPointerRef)
/*     */   {
/* 135 */     setIntAt(16, QTObject.ID(paramQTPointerRef));
/* 136 */     setIntInPointer(QTObject.ID(this.realObject), 16, QTObject.ID(paramQTPointerRef));
/* 137 */     setIntAt(12, paramQTPointerRef.getSize());
/* 138 */     setIntInPointer(QTObject.ID(this.realObject), 12, paramQTPointerRef.getSize());
/* 139 */     this.buffer = paramQTPointerRef;
/*     */   }
/*     */
/*     */   public QTPointerRef getBuffer()
/*     */   {
/* 147 */     return this.buffer;
/*     */   }
/*     */
/*     */   public short getError()
/*     */   {
/* 156 */     return getShortFromPointer(QTObject.ID(this.realObject), 32);
/*     */   }
/*     */
/*     */   public void record(boolean paramBoolean)
/*     */     throws SoundException
/*     */   {
/* 171 */     int i = 0;
/* 172 */     byte b = (byte)(paramBoolean ? 1 : 0);
/*     */
/* 174 */     setShortAt(32, (short)0);
/* 175 */     setShortInPointer(QTObject.ID(this.realObject), 32, (short)0);
/* 176 */     synchronized (QTNative.globalsLock) {
/* 177 */       i = SPBRecord(QTObject.ID(this.realObject), b);
/*     */     }
/* 179 */     SoundException.checkError(i);
/*     */   }
/*     */
/*     */   public void pauseRecording()
/*     */     throws SoundException
/*     */   {
/* 187 */     SoundException.checkError(SPBPauseRecording(getIntFromPointer(QTObject.ID(this.realObject), 0)));
/*     */   }
/*     */
/*     */   public void resumeRecording()
/*     */     throws SoundException
/*     */   {
/* 197 */     SoundException.checkError(SPBResumeRecording(getIntFromPointer(QTObject.ID(this.realObject), 0)));
/*     */   }
/*     */
/*     */   public void stopRecording()
/*     */     throws SoundException
/*     */   {
/* 209 */     SoundException.checkError(SPBStopRecording(getIntFromPointer(QTObject.ID(this.realObject), 0)));
/*     */   }
/*     */
/*     */   public boolean isRecording()
/*     */     throws SoundException
/*     */   {
/* 223 */     getRecordingStatus();
/* 224 */     if (this.recordingStatus[0] > 0) return true;
/* 225 */     if (this.recordingStatus[0] == 0) return false;
/* 226 */     throw new SoundException(this.recordingStatus[0]);
/*     */   }
/*     */
/*     */   public short meterLevel()
/*     */     throws SoundException
/*     */   {
/* 236 */     getRecordingStatus();
/* 237 */     return this.meterLevelValue[0];
/*     */   }
/*     */
/*     */   public int totalSamplesToRecord()
/*     */     throws SoundException
/*     */   {
/* 246 */     getRecordingStatus();
/* 247 */     return this.totalSamplesToRecordVal[0];
/*     */   }
/*     */
/*     */   public int numberOfSamplesRecorded()
/*     */     throws SoundException
/*     */   {
/* 256 */     getRecordingStatus();
/* 257 */     return this.numberOfSamplesRecordedVal[0];
/*     */   }
/*     */
/*     */   public int totalMsecsToRecord()
/*     */     throws SoundException
/*     */   {
/* 266 */     getRecordingStatus();
/* 267 */     return this.totalMsecsToRecordVal[0];
/*     */   }
/*     */
/*     */   public int numberOfMsecsRecorded()
/*     */     throws SoundException
/*     */   {
/* 276 */     getRecordingStatus();
/* 277 */     return this.numberOfMsecsRecordedVal[0];
/*     */   }
/*     */
/*     */   private final void getRecordingStatus()
/*     */     throws SoundException
/*     */   {
/* 289 */     int i = SPBGetRecordingStatus(getIntFromPointer(QTObject.ID(this.realObject), 0), this.recordingStatus, this.meterLevelValue, this.totalSamplesToRecordVal, this.numberOfSamplesRecordedVal, this.totalMsecsToRecordVal, this.numberOfMsecsRecordedVal);
/*     */
/* 298 */     SoundException.checkError(i);
/*     */   }
/*     */
/*     */   private static native void SetSICompletionProc(int paramInt1, int paramInt2, int paramInt3);
/*     */
/*     */   private static native short getShortFromPointer(int paramInt1, int paramInt2);
/*     */
/*     */   private static native int getIntFromPointer(int paramInt1, int paramInt2);
/*     */
/*     */   private static native void setIntInPointer(int paramInt1, int paramInt2, int paramInt3);
/*     */
/*     */   private static native void setShortInPointer(int paramInt1, int paramInt2, short paramShort);
/*     */
/*     */   private static native short SPBRecord(int paramInt, byte paramByte);
/*     */
/*     */   private static native short SPBPauseRecording(int paramInt);
/*     */
/*     */   private static native short SPBResumeRecording(int paramInt);
/*     */
/*     */   private static native short SPBStopRecording(int paramInt);
/*     */
/*     */   private static native short SPBGetRecordingStatus(int paramInt, short[] paramArrayOfShort1, short[] paramArrayOfShort2, int[] paramArrayOfInt1, int[] paramArrayOfInt2, int[] paramArrayOfInt3, int[] paramArrayOfInt4);
/*     */ }

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

Related Classes of quicktime.sound.SPB

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.