![]() |
Mixxx
|
00001 /*************************************************************************** 00002 controlttrotary.cpp - description 00003 ------------------- 00004 copyright : (C) 2002 by Tue and Ken Haste Andersen 00005 email : 00006 ***************************************************************************/ 00007 00008 /*************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 00017 #include "controlttrotary.h" 00018 00019 /* -------- ------------------------------------------------------ 00020 Purpose: Creates a new rotary encoder 00021 Input: key 00022 -------- ------------------------------------------------------ */ 00023 ControlTTRotary::ControlTTRotary(ConfigKey key) : ControlObject(key) 00024 { 00025 } 00026 00027 double ControlTTRotary::getValueFromWidget(double dValue) 00028 { 00029 // Non-linear scaling 00030 double temp = (((dValue-64.)*(dValue-64.))/64.); 00031 if ((dValue-64.)<0) 00032 temp = -temp; 00033 00034 //qDebug() << "tt rotary in " << dValue << ", out " << temp; 00035 00036 return temp; //dValue-64.; 00037 } 00038 00039 double ControlTTRotary::getValueToWidget(double dValue) 00040 { 00041 return dValue*200.+64.; 00042 } 00043 00044 void ControlTTRotary::setValueFromMidi(MidiCategory, double v) 00045 { 00046 m_dValue = v; 00047 emit(valueChanged(m_dValue)); 00048 } 00049