Mercurial > audlegacy-plugins
comparison src/console/Ym2612_Emu.cxx @ 341:986f098da058 trunk
[svn] - merge in blargg's changes
author | nenolod |
---|---|
date | Thu, 07 Dec 2006 15:20:41 -0800 |
parents | fb513e10174e |
children |
comparison
equal
deleted
inserted
replaced
340:9e5a7158fa80 | 341:986f098da058 |
---|---|
1 // Game_Music_Emu 0.5.1. http://www.slack.net/~ant/ | 1 // Game_Music_Emu 0.5.2. http://www.slack.net/~ant/ |
2 | 2 |
3 // Based on Gens 2.10 ym2612.c | 3 // Based on Gens 2.10 ym2612.c |
4 | 4 |
5 #include "Ym2612_Emu.h" | 5 #include "Ym2612_Emu.h" |
6 | 6 |
739 for(i = 0; i < 15; i++) | 739 for(i = 0; i < 15; i++) |
740 { | 740 { |
741 double x = i * 3; // 3 and not 6 (Mickey Mania first music for test) | 741 double x = i * 3; // 3 and not 6 (Mickey Mania first music for test) |
742 x /= ENV_STEP; | 742 x /= ENV_STEP; |
743 | 743 |
744 int j = (int) x; | 744 g.SL_TAB [i] = ((int) x << ENV_LBITS) + ENV_DECAY; |
745 j <<= ENV_LBITS; | |
746 | |
747 g.SL_TAB [i] = j + ENV_DECAY; | |
748 } | 745 } |
749 | 746 |
750 g.SL_TAB [15] = ((ENV_LENGHT - 1) << ENV_LBITS) + ENV_DECAY; // special case : volume off | 747 g.SL_TAB [15] = ((ENV_LENGHT - 1) << ENV_LBITS) + ENV_DECAY; // special case : volume off |
751 | 748 |
752 // Tableau Frequency Step | 749 // Tableau Frequency Step |
802 for(i = 0; i < 4; i++) | 799 for(i = 0; i < 4; i++) |
803 { | 800 { |
804 for (int j = 0; j < 32; j++) | 801 for (int j = 0; j < 32; j++) |
805 { | 802 { |
806 #if ((SIN_LBITS + SIN_HBITS - 21) < 0) | 803 #if ((SIN_LBITS + SIN_HBITS - 21) < 0) |
807 double x = (double) DT_DEF_TAB [(i << 5) + j] * Frequence / (double) (1 << (21 - SIN_LBITS - SIN_HBITS)); | 804 double y = (double) DT_DEF_TAB [(i << 5) + j] * Frequence / (double) (1 << (21 - SIN_LBITS - SIN_HBITS)); |
808 #else | 805 #else |
809 double x = (double) DT_DEF_TAB [(i << 5) + j] * Frequence * (double) (1 << (SIN_LBITS + SIN_HBITS - 21)); | 806 double y = (double) DT_DEF_TAB [(i << 5) + j] * Frequence * (double) (1 << (SIN_LBITS + SIN_HBITS - 21)); |
810 #endif | 807 #endif |
811 | 808 |
812 g.DT_TAB [i + 0] [j] = (int) x; | 809 g.DT_TAB [i + 0] [j] = (int) y; |
813 g.DT_TAB [i + 4] [j] = (int) -x; | 810 g.DT_TAB [i + 4] [j] = (int) -y; |
814 } | 811 } |
815 } | 812 } |
816 | 813 |
817 // Tableau LFO | 814 // Tableau LFO |
818 g.LFO_INC_TAB [0] = (unsigned int) (3.98 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / sample_rate); | 815 g.LFO_INC_TAB [0] = (unsigned int) (3.98 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / sample_rate); |