Package com.portaudio.TestBasic

Examples of com.portaudio.TestBasic.SineOscillator


   */
  private void writeSineData( BlockingStream stream, int framesPerBuffer,
      int numFrames, int sampleRate )
  {
    float[] buffer = new float[framesPerBuffer * 2];
    SineOscillator osc1 = new SineOscillator( 200.0, sampleRate );
    SineOscillator osc2 = new SineOscillator( 300.0, sampleRate );
    int framesLeft = numFrames;
    while( framesLeft > 0 )
    {
      int index = 0;
      int framesToWrite = (framesLeft > framesPerBuffer) ? framesPerBuffer
          : framesLeft;
      for( int j = 0; j < framesToWrite; j++ )
      {
        buffer[index++] = (float) osc1.next();
        buffer[index++] = (float) osc2.next();
      }
      stream.write( buffer, framesToWrite );
      framesLeft -= framesToWrite;
    }
  }
View Full Code Here

TOP

Related Classes of com.portaudio.TestBasic.SineOscillator

Copyright © 2018 www.massapicom. 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.