DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
src/mt32/Tables.h
00001 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
00002  * Copyright (C) 2011, 2012, 2013 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
00003  *
00004  *  This program is free software: you can redistribute it and/or modify
00005  *  it under the terms of the GNU Lesser General Public License as published by
00006  *  the Free Software Foundation, either version 2.1 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Lesser General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Lesser General Public License
00015  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef MT32EMU_TABLES_H
00019 #define MT32EMU_TABLES_H
00020 
00021 namespace MT32Emu {
00022 
00023 // Sample rate to use in mixing. With the progress of development, we've found way too many thing dependent.
00024 // In order to achieve further advance in emulation accuracy, sample rate made fixed throughout the emulator.
00025 // The output from the synth is supposed to be resampled to convert the sample rate.
00026 const unsigned int SAMPLE_RATE = 32000;
00027 
00028 const int MIDDLEC = 60;
00029 
00030 class Synth;
00031 
00032 class Tables {
00033 private:
00034         Tables();
00035         Tables(Tables &);
00036 
00037 public:
00038         static const Tables &getInstance();
00039 
00040         // Constant LUTs
00041 
00042         // CONFIRMED: This is used to convert several parameters to amp-modifying values in the TVA envelope:
00043         // - PatchTemp.outputLevel
00044         // - RhythmTemp.outlevel
00045         // - PartialParam.tva.level
00046         // - expression
00047         // It's used to determine how much to subtract from the amp envelope's target value
00048     Bit8u levelToAmpSubtraction[101] = {};
00049 
00050         // CONFIRMED: ...
00051         Bit8u envLogarithmicTime[256];
00052 
00053         // CONFIRMED: ...
00054         Bit8u masterVolToAmpSubtraction[101];
00055 
00056         // CONFIRMED:
00057     Bit8u pulseWidth100To255[101] = {};
00058 
00059     Bit16u exp9[512] = {};
00060         Bit16u logsin9[512];
00061 
00062         const Bit8u *resAmpDecayFactor;
00063 };
00064 
00065 }
00066 
00067 #endif