Fixed MIDI music in OpenTTD
This commit is contained in:
@@ -548,6 +548,7 @@ void pre_resample(MidSong *song, MidSample *sp)
|
||||
sint32 incr, ofs, newlen, count;
|
||||
sint16 *newdata, *dest, *src = (sint16 *) sp->data;
|
||||
sint16 v1, v2, v3, v4, *vptr;
|
||||
/*
|
||||
#ifdef DEBUG_CHATTER
|
||||
static const char note_name[12][3] =
|
||||
{
|
||||
@@ -555,9 +556,11 @@ void pre_resample(MidSong *song, MidSample *sp)
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
DEBUG_MSG(" * pre-resampling for note %d (%s%d)\n",
|
||||
sp->note_to_use,
|
||||
note_name[sp->note_to_use % 12], (sp->note_to_use & 0x7F) / 12);
|
||||
*/
|
||||
|
||||
a = ((double) (sp->sample_rate) * freq_table[(int) (sp->note_to_use)]) /
|
||||
((double) (sp->root_freq) * song->rate);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "timidity.h"
|
||||
#include "timidity_internal.h"
|
||||
@@ -90,7 +91,11 @@ static int read_config_file(char *name)
|
||||
}
|
||||
|
||||
if (!(fp=open_file(name)))
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "libTimidity: read_config_file(%s) failure", name);
|
||||
return -1;
|
||||
}
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "libTimidity: read_config_file(%s) opened config success", name);
|
||||
|
||||
while (__fgets(tmp, sizeof(tmp), fp))
|
||||
{
|
||||
@@ -391,6 +396,9 @@ static int read_config_file(char *name)
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "libTimidity: read_config_file(%s) success", name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -422,8 +430,7 @@ int mid_init(char *config_file)
|
||||
#ifdef WIN32
|
||||
add_to_pathlist("\\TIMIDITY");
|
||||
#else
|
||||
add_to_pathlist("/usr/local/lib/timidity");
|
||||
add_to_pathlist("/etc");
|
||||
add_to_pathlist("timidity");
|
||||
#endif
|
||||
|
||||
mid_init_no_config();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef TIMIDITY_INTERNAL_H
|
||||
#define TIMIDITY_INTERNAL_H
|
||||
|
||||
#include <android/log.h>
|
||||
#include "timidity.h"
|
||||
|
||||
#if defined(__i386__) || defined(__ia64__) || defined(WIN32) || \
|
||||
@@ -49,11 +50,8 @@
|
||||
#define SWAPLE32(x) XCHG_LONG(x)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_MSG(...) fprintf(stderr, __VA_ARGS__)
|
||||
#else
|
||||
//#define DEBUG_MSG(...) __android_log_print(ANDROID_LOG_INFO, "libSDL", __VA_ARGS__)
|
||||
#define DEBUG_MSG(...)
|
||||
#endif
|
||||
|
||||
|
||||
#define MID_VIBRATO_SAMPLE_INCREMENTS 32
|
||||
|
||||
Reference in New Issue
Block a user