mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-01 08:31:37 +00:00
- made CW project work for this CVS file hierarchy
- adapted readme file - fixed path for file loading wih message 'load'
This commit is contained in:
parent
047e0ebdfa
commit
fa9a80d27e
3 changed files with 77 additions and 108 deletions
|
@ -3,11 +3,7 @@ Well, this is fluidsynth~ for Max/MSP...
|
|||
Take a look here:
|
||||
http://www.ircam.fr/equipes/temps-reel/maxmsp/fluidsynth.html
|
||||
|
||||
In order to build the fluidmax.mcp CodeWarrior (8) project you want to
|
||||
check out the FluidSynth source tree into a directory on the same level
|
||||
than (parallel to) this directory.
|
||||
|
||||
The following lines have to be added to the fluidsynth_priv.h file:
|
||||
In order to build the fluidmax.mcp CodeWarrior (8) project the following lines have to be added to the fluidsynth_priv.h file:
|
||||
|
||||
/* begin fluidsynth_priv.h */
|
||||
#if defined(__POWERPC__) && !(defined(__APPLE__) && defined(__MACH__))
|
||||
|
@ -15,29 +11,20 @@ The following lines have to be added to the fluidsynth_priv.h file:
|
|||
#endif
|
||||
/* end fluidsynth_priv.h */
|
||||
|
||||
The fluidsynth directory in this directory contains only a version.h
|
||||
which is just added for the case that the version.h file in the
|
||||
fluidsynth checkout is not (auto-)"maked" or generated otherwise.
|
||||
The fluidsynth directory in this directory contains only a version.h which is just added for the case that the version.h file in the fluidsynth checkout is not (auto-)"maked" or generated otherwise.
|
||||
|
||||
For now the file fluid_sys.c is not included to the CW project.
|
||||
Instead there (here) is a file called fluidmax_fakefuns.c implementing
|
||||
some necessary functions.
|
||||
For now the file fluid_sys.c is not included to the CW project. Instead there (here) is a file called fluidmax_fakefuns.c implementing some necessary functions.
|
||||
|
||||
Using fluid_sys.c with the macro MACOS 9 defined almost works.
|
||||
Its only the prototype of the function NewTimerProc() causing a
|
||||
compilation error (no prototype) and didn't find any good include
|
||||
to fix this...
|
||||
Using fluid_sys.c with the macro MACOS 9 defined almost works. Its only the prototype of the function NewTimerProc() causing a compilation error (no prototype) and I didn't find any good include to fix this...
|
||||
|
||||
The following three functions used in fluid_settings are missing:
|
||||
fluid_shell_settings()
|
||||
fluid_audio_driver_settings()
|
||||
fluid_midi_driver_settings()
|
||||
|
||||
|
||||
KNOWN BUGS:
|
||||
- Unloading SoungFonts doesn't work (would probably be fixed if using the MACOS 9 macro)
|
||||
|
||||
|
||||
TODO
|
||||
- get rid of fluidmax_fakefuns.c
|
||||
- implement log function properly
|
||||
|
|
|
@ -48,7 +48,7 @@ int fluid_synth_program_select2(fluid_synth_t* synth,
|
|||
unsigned int preset_num);
|
||||
|
||||
|
||||
#define VERSION "02/2004 (3)"
|
||||
#define VERSION "02/2004 (4)"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -105,6 +105,41 @@ fluidmax_dsp(fluidmax_t *self, t_signal **sp, short *count)
|
|||
* load utlilities
|
||||
*
|
||||
*/
|
||||
static char *
|
||||
fluidmax_translate_fullpath(char *maxpath, char *fullpath)
|
||||
{
|
||||
int i;
|
||||
|
||||
strcpy(fullpath, "/Volumes/");
|
||||
|
||||
for(i=0; maxpath[i] != ':'; i++)
|
||||
fullpath[i + 9] = maxpath[i];
|
||||
|
||||
/* skip ':' */
|
||||
i++;
|
||||
|
||||
strcpy(fullpath + i + 8, maxpath + i);
|
||||
|
||||
return fullpath;
|
||||
}
|
||||
|
||||
static const char *
|
||||
fluidmax_strip_path(const char *fullpath)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=strlen(fullpath)-1; i>=0; i--)
|
||||
{
|
||||
if(fullpath[i] == '/')
|
||||
break;
|
||||
}
|
||||
|
||||
if(i != 0)
|
||||
i++;
|
||||
|
||||
return fullpath + i;
|
||||
}
|
||||
|
||||
static void
|
||||
fluidmax_do_load(t_object *o, Symbol *s, short ac, Atom *at)
|
||||
{
|
||||
|
@ -116,43 +151,23 @@ fluidmax_do_load(t_object *o, Symbol *s, short ac, Atom *at)
|
|||
|
||||
if(fluid_synth_sfload(self->synth, filename, 0) >= 0)
|
||||
{
|
||||
post("fluidsynth~: loaded soundfont: %s", filename);
|
||||
post("fluidsynth~: loaded soundfont '%s'", fluidmax_strip_path(filename));
|
||||
|
||||
fluid_synth_program_reset(self->synth);
|
||||
|
||||
outlet_bang(self->outlet);
|
||||
}
|
||||
else
|
||||
error("fluidsynth~: cannot load soundfont from file: %s", filename);
|
||||
error("fluidsynth~: cannot load soundfont from file '%s'", filename);
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
fluidmax_translate_fullpath(char *fullpath)
|
||||
{
|
||||
char last = '/';
|
||||
int i;
|
||||
|
||||
for(i=0; fullpath[i] != '\0'; i++)
|
||||
{
|
||||
char c = fullpath[i];
|
||||
|
||||
fullpath[i] = last;
|
||||
|
||||
if(c == ':')
|
||||
break;
|
||||
|
||||
last = c;
|
||||
}
|
||||
|
||||
return fullpath;
|
||||
}
|
||||
|
||||
static void
|
||||
fluidmax_load_with_dialog(t_object *o, t_symbol *s, short argc, t_atom *argv)
|
||||
{
|
||||
char filename[256];
|
||||
char fullname[1024];
|
||||
char maxpath[1024];
|
||||
char fullpath[1024];
|
||||
long type;
|
||||
short path;
|
||||
|
||||
|
@ -161,11 +176,11 @@ fluidmax_load_with_dialog(t_object *o, t_symbol *s, short argc, t_atom *argv)
|
|||
if(open_dialog(filename, &path, &type, 0, 0))
|
||||
return;
|
||||
|
||||
if(path_topotentialname(path, filename, fullname, 0) == 0)
|
||||
if(path_topotentialname(path, filename, maxpath, 0) == 0)
|
||||
{
|
||||
ftmax_atom_t a;
|
||||
|
||||
ftmax_set_symbol(&a, ftmax_new_symbol(fluidmax_translate_fullpath(fullname)));
|
||||
ftmax_set_symbol(&a, ftmax_new_symbol(fluidmax_translate_fullpath(maxpath, fullpath)));
|
||||
fluidmax_do_load(o, NULL, 1, &a);
|
||||
}
|
||||
}
|
||||
|
@ -193,18 +208,19 @@ fluidmax_load(t_object *o, Symbol *s, short ac, Atom *at)
|
|||
fluidmax_do_load(o, NULL, ac, at);
|
||||
else
|
||||
{
|
||||
char fullname[1024];
|
||||
char maxpath[1024];
|
||||
char fullpath[1024];
|
||||
short path;
|
||||
long type;
|
||||
ftmax_atom_t a;
|
||||
|
||||
if(locatefile_extended(string, &path, &type, 0, 0) || path_topotentialname(path, string, fullname, 0) != 0)
|
||||
if(locatefile_extended(string, &path, &type, 0, 0) || path_topotentialname(path, string, maxpath, 0) != 0)
|
||||
{
|
||||
error("fluidmax~: cannot find file '%s'", string);
|
||||
error("fluidsynth~: cannot find file '%s'", string);
|
||||
return;
|
||||
}
|
||||
|
||||
ftmax_set_symbol(&a, ftmax_new_symbol(fluidmax_translate_fullpath(fullname)));
|
||||
ftmax_set_symbol(&a, ftmax_new_symbol(fluidmax_translate_fullpath(maxpath, fullpath)));
|
||||
fluidmax_do_load(o, NULL, 1, &a);
|
||||
}
|
||||
}
|
||||
|
@ -478,67 +494,35 @@ fluidmax_select(t_object *o, Symbol *s, short ac, Atom *at)
|
|||
unsigned int preset = 0;
|
||||
int channel = 1;
|
||||
|
||||
if (ac == 0)
|
||||
switch(ac)
|
||||
{
|
||||
return; // Someone is wasting our time
|
||||
}
|
||||
default:
|
||||
case 4:
|
||||
if(ftmax_is_number(at + 3))
|
||||
channel = ftmax_get_number_int(at + 3);
|
||||
|
||||
if(channel < 1)
|
||||
channel = 1;
|
||||
else if(channel > fluid_synth_count_midi_channels(self->synth))
|
||||
channel = fluid_synth_count_midi_channels(self->synth);
|
||||
|
||||
case 3:
|
||||
if(ftmax_is_number(at + 2))
|
||||
preset = ftmax_get_number_int(at + 2);
|
||||
|
||||
case 2:
|
||||
if(ftmax_is_number(at + 1))
|
||||
bank = ftmax_get_number_int(at + 1);
|
||||
|
||||
case 1:
|
||||
if(ftmax_is_number(at))
|
||||
{
|
||||
switch(ac)
|
||||
{
|
||||
default:
|
||||
case 4:
|
||||
if(ftmax_is_number(at + 3))
|
||||
channel = ftmax_get_number_int(at + 3);
|
||||
|
||||
if(channel < 1)
|
||||
channel = 1;
|
||||
else if(channel > fluid_synth_count_midi_channels(self->synth))
|
||||
channel = fluid_synth_count_midi_channels(self->synth);
|
||||
|
||||
case 3:
|
||||
if(ftmax_is_number(at + 2))
|
||||
preset = ftmax_get_number_int(at + 2);
|
||||
case 2:
|
||||
if(ftmax_is_number(at + 1))
|
||||
bank = ftmax_get_number_int(at + 1);
|
||||
case 1:
|
||||
fluid_synth_program_select(self->synth, channel - 1, ftmax_get_number_int(at), bank, preset);
|
||||
else if(ftmax_is_symbol(at))
|
||||
fluid_synth_program_select2(self->synth, channel - 1, ftmax_symbol_name(ftmax_get_symbol(at)), bank, preset);
|
||||
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
} else if(ftmax_is_symbol(at)) {
|
||||
|
||||
ftmax_symbol_t tmp = ftmax_get_symbol(at);
|
||||
char *name = (char *)ftmax_symbol_name(tmp);
|
||||
|
||||
// FIXME: this is silly code duplication
|
||||
switch(ac)
|
||||
{
|
||||
default:
|
||||
case 4:
|
||||
if(ftmax_is_number(at + 3))
|
||||
channel = ftmax_get_number_int(at + 3);
|
||||
|
||||
if(channel < 1)
|
||||
channel = 1;
|
||||
else if(channel > fluid_synth_count_midi_channels(self->synth))
|
||||
channel = fluid_synth_count_midi_channels(self->synth);
|
||||
|
||||
case 3:
|
||||
if(ftmax_is_number(at + 2))
|
||||
preset = ftmax_get_number_int(at + 2);
|
||||
case 2:
|
||||
if(ftmax_is_number(at + 1))
|
||||
bank = ftmax_get_number_int(at + 1);
|
||||
case 1:
|
||||
fluid_synth_program_select2(self->synth, channel - 1, name, bank, preset);
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -841,8 +825,6 @@ fluidmax_new(Symbol *s, short ac, Atom *at)
|
|||
int polyphony = 256;
|
||||
int midi_channels = 16;
|
||||
|
||||
post("fluidsynth~: DEBUG VERSION [PH]");
|
||||
|
||||
self->outlet = outlet_new(self, "bang");
|
||||
|
||||
dsp_setup((t_pxobject *)self, 0);
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue