Possible issue with sfx: Bass tones sounds high #438

This commit is contained in:
BADIM-PC\Vadim 2017-12-27 16:34:59 +03:00
parent 8daa4c7f38
commit 2bb479031e
1 changed files with 3 additions and 4 deletions

View File

@ -38,7 +38,6 @@
#define MAX_PERIOD_VALUE 4096 #define MAX_PERIOD_VALUE 4096
#define BASE_NOTE_FREQ 440.0 #define BASE_NOTE_FREQ 440.0
#define BASE_NOTE_POS 49.0 #define BASE_NOTE_POS 49.0
#define ENVELOPE_FREQ_SCALE 2
#define NOTES_PER_MUNUTE (TIC_FRAMERATE / NOTES_PER_BEET * 60) #define NOTES_PER_MUNUTE (TIC_FRAMERATE / NOTES_PER_BEET * 60)
#define min(a,b) ((a) < (b) ? (a) : (b)) #define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b)) #define max(a,b) ((a) > (b) ? (a) : (b))
@ -103,7 +102,7 @@ static inline s32 freq2period(double freq)
{ {
if(freq == 0.0) return MAX_PERIOD_VALUE; if(freq == 0.0) return MAX_PERIOD_VALUE;
enum {Rate = CLOCKRATE * ENVELOPE_FREQ_SCALE / ENVELOPE_VALUES}; enum {Rate = CLOCKRATE / ENVELOPE_VALUES};
s32 period = round((double)Rate / freq - 1.0); s32 period = round((double)Rate / freq - 1.0);
if(period < MIN_PERIOD_VALUE) return MIN_PERIOD_VALUE; if(period < MIN_PERIOD_VALUE) return MIN_PERIOD_VALUE;
@ -121,7 +120,7 @@ static inline s32 getAmp(const tic_sound_register* reg, s32 amp)
static void runEnvelope(blip_buffer_t* blip, tic_sound_register* reg, tic_sound_register_data* data, s32 end_time ) static void runEnvelope(blip_buffer_t* blip, tic_sound_register* reg, tic_sound_register_data* data, s32 end_time )
{ {
s32 period = freq2period(reg->freq * ENVELOPE_FREQ_SCALE); s32 period = freq2period(reg->freq);
for ( ; data->time < end_time; data->time += period ) for ( ; data->time < end_time; data->time += period )
{ {