コード例 #1
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));
            }
コード例 #2
0
 internal static Utterance access_402(Microphone microphone, Utterance result)
 {
     microphone.currentUtterance = result;
     return(result);
 }