Exemplo n.º 1
0
 internal static TargetDataLine access_102(Microphone microphone, TargetDataLine result)
 {
     microphone.audioLine = result;
     return(result);
 }
Exemplo n.º 2
0
            public override void run()
            {
                this.totalSamplesRead = 0L;
                Microphone.access_200(this.this_0).info("started recording");
                if (Microphone.access_300(this.this_0))
                {
                    Microphone.access_402(this.this_0, new Utterance("Microphone", Microphone.access_500(this.this_0).getFormat()));
                }
                Microphone.access_700(this.this_0).add(new DataStartSignal(Microphone.access_600(this.this_0)));
                Microphone.access_800(this.this_0).info("DataStartSignal added");
                IOException ex2;

                try
                {
                    Microphone.access_100(this.this_0).start();
                    while (!this.done)
                    {
                        Data data = this.readData(Microphone.access_400(this.this_0));
                        if (data == null)
                        {
                            this.done = true;
                            break;
                        }
                        Microphone.access_700(this.this_0).add(data);
                    }
                    Microphone.access_100(this.this_0).flush();
                    if (Microphone.access_900(this.this_0))
                    {
                        Microphone.access_500(this.this_0).close();
                        Microphone.access_100(this.this_0).close();
                        java.lang.System.err.println("set to null");
                        Microphone.access_102(this.this_0, null);
                    }
                }
                catch (IOException ex)
                {
                    ex2 = ex;
                    goto IL_138;
                }
                goto IL_173;
IL_138:
                IOException ex3 = ex2;

                Microphone.access_1000(this.this_0).warning(new StringBuilder().append("IO Exception ").append(Throwable.instancehelper_getMessage(ex3)).toString());
                Throwable.instancehelper_printStackTrace(ex3);
IL_173:
                long duration = ByteCodeHelper.d2l((double)this.totalSamplesRead / (double)Microphone.access_500(this.this_0).getFormat().getSampleRate() * 1000.0);

                Microphone.access_700(this.this_0).add(new DataEndSignal(duration));
                Microphone.access_1100(this.this_0).info("DataEndSignal ended");
                Microphone.access_1200(this.this_0).info("stopped recording");
                lock (this.@lock)
                {
                    Object.instancehelper_notify(this.@lock);
                }
            }
Exemplo n.º 3
0
 internal static bool access_900(Microphone microphone)
 {
     return(microphone.closeBetweenUtterances);
 }
Exemplo n.º 4
0
 public RecordingThread(Microphone microphone, string text) : base(text)
 {
     this_0     = microphone;
     this.@lock = new System.Object();
 }
Exemplo n.º 5
0
 internal static Utterance access_400(Microphone microphone)
 {
     return(microphone.currentUtterance);
 }
Exemplo n.º 6
0
            private Data readData(Utterance utterance)
            {
                byte[] array             = new byte[Microphone.access_1400(this.this_0)];
                int    channels          = Microphone.access_500(this.this_0).getFormat().getChannels();
                long   num               = this.totalSamplesRead;
                long   num2              = (long)channels;
                long   firstSampleNumber = (num2 != -1L) ? (num / num2) : (-num);
                int    num3              = Microphone.access_500(this.this_0).read(array, 0, array.Length);

                if (!this.started)
                {
                    lock (this)
                    {
                        this.started = true;
                        System.Threading.Thread.MemoryBarrier();
                        Object.instancehelper_notifyAll(this);
                    }
                }
                if (Microphone.access_1500(this.this_0).isLoggable(Level.FINE))
                {
                    Microphone.access_1600(this.this_0).info(new StringBuilder().append("Read ").append(num3).append(" bytes from audio stream.").toString());
                }
                if (num3 <= 0)
                {
                    return(null);
                }
                int  num4 = Microphone.access_500(this.this_0).getFormat().getSampleSizeInBits() / 8;
                long num5 = this.totalSamplesRead;
                int  num6 = num3;
                int  num7 = num4;

                this.totalSamplesRead = num5 + (long)((num7 != -1) ? (num6 / num7) : (-(long)num6));
                if (num3 != Microphone.access_1400(this.this_0))
                {
                    bool flag = num3 != 0;
                    int  num8 = num4;
                    if (num8 != -1 && (flag ? 1 : 0) % num8 != 0)
                    {
                        string text = "Incomplete sample read.";

                        throw new Error(text);
                    }
                    array = Arrays.copyOf(array, num3);
                }
                if (Microphone.access_300(this.this_0))
                {
                    utterance.add(array);
                }
                double[] array2;
                if (Microphone.access_1700(this.this_0))
                {
                    array2 = DataUtil.bytesToValues(array, 0, array.Length, num4, Microphone.access_1800(this.this_0));
                }
                else
                {
                    array2 = DataUtil.littleEndianBytesToValues(array, 0, array.Length, num4, Microphone.access_1800(this.this_0));
                }
                if (channels > 1)
                {
                    array2 = Microphone.access_1900(this.this_0, array2, channels);
                }
                return(new DoubleData(array2, ByteCodeHelper.f2i(Microphone.access_500(this.this_0).getFormat().getSampleRate()), firstSampleNumber));
            }
Exemplo n.º 7
0
 internal static BlockingQueue access_700(Microphone microphone)
 {
     return(microphone.audioList);
 }
Exemplo n.º 8
0
 internal static bool access_1800(Microphone microphone)
 {
     return(microphone.signed);
 }
Exemplo n.º 9
0
 internal static AudioInputStream access_500(Microphone microphone)
 {
     return(microphone.audioStream);
 }
Exemplo n.º 10
0
 internal static Utterance access_402(Microphone microphone, Utterance result)
 {
     microphone.currentUtterance = result;
     return(result);
 }
Exemplo n.º 11
0
 internal static bool access_300(Microphone microphone)
 {
     return(microphone.keepDataReference);
 }
Exemplo n.º 12
0
 internal static TargetDataLine access_100(Microphone microphone)
 {
     return(microphone.audioLine);
 }
Exemplo n.º 13
0
 internal static double[] access_1900(Microphone microphone, double[] array, int num)
 {
     return(microphone.convertStereoToMono(array, num));
 }
Exemplo n.º 14
0
 internal static Logger access_1300(Microphone microphone)
 {
     return(microphone.logger);
 }
Exemplo n.º 15
0
 internal static int access_600(Microphone microphone)
 {
     return(microphone.sampleRate);
 }
Exemplo n.º 16
0
 internal static int access_1400(Microphone microphone)
 {
     return(microphone.frameSizeInBytes);
 }
Exemplo n.º 17
0
 internal static bool access_1700(Microphone microphone)
 {
     return(microphone.bigEndian);
 }