// Get the current speed.
jfloat Java_org_vinuxproject_sonic_Sonic_getSpeedNative(
    JNIEnv *env,
    jobject thiz,
    jlong sonicID)
{
    sonicStream stream = getInst(sonicID)->stream;
    LOGV("Reading speed");
    return sonicGetSpeed(stream);
}
 double get_rate() const
 {
   return (sonic_stream?sonicGetSpeed(sonic_stream):1);
 }