3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
|
* Copyright (C) 2005 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
36 |
ASM_X86_MMX_SSE |
ASM_X86_MMX_SSE |
37 |
}; |
}; |
38 |
|
|
39 |
|
/** @brief Real Time Math Base Class |
40 |
|
* |
41 |
|
* Math functions for real time operation. This base class contains all |
42 |
|
* non-template methods. |
43 |
|
*/ |
44 |
class RTMathBase { |
class RTMathBase { |
45 |
public: |
public: |
46 |
/** |
/** |
61 |
* (assuming equal tempered scale of course, divided into 12 |
* (assuming equal tempered scale of course, divided into 12 |
62 |
* semitones per octave and 100 cents per semitone). |
* semitones per octave and 100 cents per semitone). |
63 |
* |
* |
64 |
* Note: MAX_PITCH (defined in global.h) has to be defined to an |
* Note: CONFIG_MAX_PITCH (defined in config.h) has to be defined to an |
65 |
* appropriate value, otherwise the behavior of this function is |
* appropriate value, otherwise the behavior of this function is |
66 |
* undefined, but most probably if MAX_PITCH is too small, the |
* undefined, but most probably if CONFIG_MAX_PITCH is too small, the |
67 |
* application will crash due to segmentation fault here. |
* application will crash due to segmentation fault here. |
68 |
* |
* |
69 |
* @param cents - pitch value in cents (+1200 cents means +1 octave) |
* @param cents - pitch value in cents (+1200 cents means +1 octave) |
76 |
} |
} |
77 |
|
|
78 |
private: |
private: |
79 |
static float CentsToFreqTable[MAX_PITCH * 1200 * 2 + 1]; |
static float CentsToFreqTable[CONFIG_MAX_PITCH * 1200 * 2 + 1]; |
80 |
static float* pCentsToFreqTable; |
static float* pCentsToFreqTable; |
81 |
|
|
82 |
static float* InitCentsToFreqTable(); |
static float* InitCentsToFreqTable(); |
83 |
}; |
}; |
84 |
|
|
85 |
/** Real Time Math |
/** @brief Real Time Math |
86 |
* |
* |
87 |
* Math functions for real time operation. |
* This is a template which provides customized methods for the desired low |
88 |
|
* level implementation. The ASM_X86_MMX_SSE implementation of each method |
89 |
|
* for example doesn't use 387 FPU instruction. This is needed for MMX |
90 |
|
* algorithms which do not allow mixed MMX and 387 instructions. |
91 |
*/ |
*/ |
92 |
template<implementation_t IMPL = CPP> |
template<implementation_t IMPL = CPP> |
93 |
class __RTMath : public RTMathBase { |
class __RTMath : public RTMathBase { |