Code example for SourceDataLine

Methods: flushstopclose

0
            return; 
 
        tick.cancel();
        tick.purge();
 
        output.stop();
        output.flush();
        output.close();
        output = null;
    } 
 
    public void set_speed(double speed) {
        /* This engine is equipped with an automatic gear box that 
         * switches gears when the RPM becomes too high or too low.  */ 
        double new_speed = Math.abs(speed);
        double accel = new_speed - this.speed;
        this.speed = new_speed;
 
        if (accel > 0.05)
            accel = 0.05;