static TACommandVerdict pow10f_cmd(TAThread thread,TAInputStream stream) { float x, res; // Prepare x = readFloat(&stream); errno = 0; START_TARGET_OPERATION(thread); // Execute res = pow10f(x); END_TARGET_OPERATION(thread); // Response writeFloat(thread, res); writeInt(thread, errno); sendResponse(thread); return taDefaultVerdict; }
void Hrtf::idt_iit(const v3f &position, float &idt_offset, float &angle_gr, float &left_to_right_amp) { float head_r = 0.093f; float angle = (float)(M_PI_2 - atan2f(position.y, position.x)); angle_gr = angle * 180 / float(M_PI); while (angle_gr < 0) angle_gr += 360; //LOG_DEBUG(("relative position = (%g,%g,%g), angle = %g (%g)", position.x, position.y, position.z, angle, angle_gr)); float idt_angle = fmodf(angle, 2 * (float)M_PI); if (idt_angle < 0) idt_angle += 2 * (float)M_PI; if (idt_angle >= float(M_PI_2) && idt_angle < (float)M_PI) { idt_angle = float(M_PI) - idt_angle; } else if (idt_angle >= float(M_PI) && idt_angle < 3 * float(M_PI_2)) { idt_angle = (float)M_PI - idt_angle; } else if (idt_angle >= 3 * (float)M_PI_2) { idt_angle -= (float)M_PI * 2; } //LOG_DEBUG(("idt_angle = %g (%d)", idt_angle, (int)(idt_angle * 180 / M_PI))); idt_offset = - head_r * (idt_angle + sin(idt_angle)) / 344; left_to_right_amp = pow10f(-sin(idt_angle)); //LOG_DEBUG(("idt_offset %g, left_to_right_amp: %g", idt_offset, left_to_right_amp)); }
uint16_t doFrequencySlider(TouchSlider * const aTheTouchedSlider, uint16_t aValue) { float tValue = aValue; tValue = tValue / (FREQ_SLIDER_MAX_VALUE / 3); // gives 0-3 sFrequency = pow10f(tValue); ComputePeriodAndSetTimer(false); return aValue; }
static bool cb_set_gain (RobWidget* handle, void *data) { MF2UI* ui = (MF2UI*) (data); const float val = robtk_dial_get_value(ui->gain); if (rintf(ui->pgain) != rintf(val)) { ui->pgain = val; ui->update_annotations = true; queue_draw(ui->m2); } #ifdef __USE_GNU const float thresh = pow10f(.05 * (MIN_CUTOFF - val)); #else const float thresh = powf(10, .05 * (MIN_CUTOFF - val)); #endif ui->db_thresh = thresh * thresh; if (ui->disable_signals) return TRUE; if (robtk_cbtn_get_active(ui->btn_norm)) return TRUE; ui->write(ui->controller, MF_GAIN, sizeof(float), 0, (const void*) &val); return TRUE; }