⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qvalue.gel

📁 用dsp解压mp3程序的算法
💻 GEL
字号:

// Qvalue
// ======
//
// Q values are used when a fixed-point variable
// represents a floating-point value. The Q represents the bit
// location where the decimal point is placed.
//
// This file provides a series of functions that are useful for
// entering Q-values into the watch window. For example, if you
// have a variable n, and you want to use a Q value of 2, you would
// enter Q2(n) into the watch window, where n is the variable.
//
// You can also create a generic Q() function that allows you to enter
// in the Q value as a parameter. This one is useful in scripts,
// but currently cannot be added to the watch window, due to the fact
// that the watch window will only accept GEL functions with 1
// parameter.

Q(int value, int Q) {
int variable = (int)value; // converts to a signed integer
return (float)(variable/(pow(2,Q)));
}
Q1(int value) {
return Q(value, 1);}
Q2(int value) {
return Q(value, 2);}
Q3(int value) {
return Q(value, 3);}
Q4(int value) {
return Q(value, 4);}
Q5(int value) {
return Q(value, 5);}
Q6(int value) {
return Q(value, 6);}
Q7(int value) {
return Q(value, 7);}
Q8(int value) {
return Q(value, 8);}
Q9(int value) {
return Q(value, 9);}
Q10(int value) {
return Q(value, 10);}
Q11(int value) {
return Q(value, 11);}
Q12(int value) {
return Q(value, 12);}
Q13(int value) {
return Q(value, 13);}
Q14(int value) {
return Q(value, 14);}
Q15(int value) {
return Q(value, 15);}
Q16(int value) {
return Q(value, 16);}
Q17(int value) {
return Q(value, 17);}
Q18(int value) {
return Q(value, 18);}
Q19(int value) {
return Q(value, 19);}
Q20(int value) {
return Q(value, 20);}
Q21(int value) {
return Q(value, 21);}
Q22(int value) {
return Q(value, 22);}
Q23(int value) {
return Q(value, 23);}
Q24(int value) {
return Q(value, 24);}
Q25(int value) {
return Q(value, 25);}
Q26(int value) {
return Q(value, 26);}
Q27(int value) {
return Q(value, 27);}
Q28(int value) {
return Q(value, 28);}
Q29(int value) {
return Q(value, 29);}
Q30(int value) {
return Q(value, 30);}
Q31(int value) {
return Q(value, 31);}



// pow()
// =====
//
// This function is used to calculate exponents. It takes 2 parameters
// base and exp, and returns base to the power of exp.
// This function only works for whole positive numbers.
// C prototype: double pow(double base, double exp);


pow(double base, double exp) { // used double to match Microsoft standard
double answer = 1;// initialize
int i; // counter for loop
for (i = 1; i<=exp; i++) // multiple answer by base exp times
answer = answer * base;
return answer; // return value stored in answer
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -