Buffer containing audio and MIDI data in arrays.
Exemple #1
0
 void AnalyseOut(ProcessBuffer processItem)
 {
     foreach (AudioBuffer outBuffer in processItem.AudioOut) {
         if (outBuffer.Audio.Any (s => s != 0)) {
             NotEmptySamples++;
         }
     }
 }
Exemple #2
0
 void ProcessAudio(ProcessBuffer processingChunk)
 {
     int bufferCount = processingChunk.AudioIn.Length;
     if (bufferCount == 0) {
         return;
     }
     int bufferSize = processingChunk.AudioIn [0].BufferSize;
     int floatsCount = bufferCount * bufferSize;
     int bytesCount = floatsCount * sizeof(float);
     float[] interlacedSamples = BufferOperations.InterlaceAudio (processingChunk.AudioIn, bufferSize, bufferCount);
     byte[] waveInData = new byte[bytesCount];
     Buffer.BlockCopy (interlacedSamples, 0, waveInData, 0, bytesCount);
     if (DataAvailable != null) {
         DataAvailable (this, new WaveInEventArgs (waveInData, bytesCount));
     }
 }
Exemple #3
0
        void ProcessAudio(ProcessBuffer processingChunk)
        {
            if (_playbackState != PlaybackState.Playing) {
                return;
            }
            int bufferCount = processingChunk.AudioOut.Length;
            if (bufferCount == 0) {
                return;
            }
            int bufferSize = processingChunk.Frames;
            int floatsCount = bufferCount * bufferSize;
            int bytesCount = floatsCount * sizeof(float);
            byte[] fromWave = new byte[bytesCount];

            _waveStream.Read (fromWave, 0, bytesCount);

            float[] interlacedSamples = new float[floatsCount];
            Buffer.BlockCopy (fromWave, 0, interlacedSamples, 0, bytesCount);
            for (int i = 0; i < floatsCount; i++) {
                interlacedSamples [i] = interlacedSamples [i] * _volume;
            }
            BufferOperations.DeinterlaceAudio (interlacedSamples, processingChunk.AudioOut, bufferSize, bufferCount);
        }