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:
|
Take a look here:
|
||||||
http://www.ircam.fr/equipes/temps-reel/maxmsp/fluidsynth.html
|
http://www.ircam.fr/equipes/temps-reel/maxmsp/fluidsynth.html
|
||||||
|
|
||||||
In order to build the fluidmax.mcp CodeWarrior (8) project you want to
|
In order to build the fluidmax.mcp CodeWarrior (8) project the following lines have to be added to the fluidsynth_priv.h file:
|
||||||
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:
|
|
||||||
|
|
||||||
/* begin fluidsynth_priv.h */
|
/* begin fluidsynth_priv.h */
|
||||||
#if defined(__POWERPC__) && !(defined(__APPLE__) && defined(__MACH__))
|
#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
|
#endif
|
||||||
/* end fluidsynth_priv.h */
|
/* end fluidsynth_priv.h */
|
||||||
|
|
||||||
The fluidsynth directory in this directory contains only a version.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.
|
||||||
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.
|
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.
|
||||||
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.
|
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...
|
||||||
Its only the prototype of the function NewTimerProc() causing a
|
|
||||||
compilation error (no prototype) and didn't find any good include
|
|
||||||
to fix this...
|
|
||||||
|
|
||||||
The following three functions used in fluid_settings are missing:
|
The following three functions used in fluid_settings are missing:
|
||||||
fluid_shell_settings()
|
fluid_shell_settings()
|
||||||
fluid_audio_driver_settings()
|
fluid_audio_driver_settings()
|
||||||
fluid_midi_driver_settings()
|
fluid_midi_driver_settings()
|
||||||
|
|
||||||
|
|
||||||
KNOWN BUGS:
|
KNOWN BUGS:
|
||||||
- Unloading SoungFonts doesn't work (would probably be fixed if using the MACOS 9 macro)
|
- Unloading SoungFonts doesn't work (would probably be fixed if using the MACOS 9 macro)
|
||||||
|
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
- get rid of fluidmax_fakefuns.c
|
- get rid of fluidmax_fakefuns.c
|
||||||
- implement log function properly
|
- implement log function properly
|
||||||
|
|
|
@ -48,7 +48,7 @@ int fluid_synth_program_select2(fluid_synth_t* synth,
|
||||||
unsigned int preset_num);
|
unsigned int preset_num);
|
||||||
|
|
||||||
|
|
||||||
#define VERSION "02/2004 (3)"
|
#define VERSION "02/2004 (4)"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -105,6 +105,41 @@ fluidmax_dsp(fluidmax_t *self, t_signal **sp, short *count)
|
||||||
* load utlilities
|
* 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
|
static void
|
||||||
fluidmax_do_load(t_object *o, Symbol *s, short ac, Atom *at)
|
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)
|
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);
|
fluid_synth_program_reset(self->synth);
|
||||||
|
|
||||||
outlet_bang(self->outlet);
|
outlet_bang(self->outlet);
|
||||||
}
|
}
|
||||||
else
|
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
|
static void
|
||||||
fluidmax_load_with_dialog(t_object *o, t_symbol *s, short argc, t_atom *argv)
|
fluidmax_load_with_dialog(t_object *o, t_symbol *s, short argc, t_atom *argv)
|
||||||
{
|
{
|
||||||
char filename[256];
|
char filename[256];
|
||||||
char fullname[1024];
|
char maxpath[1024];
|
||||||
|
char fullpath[1024];
|
||||||
long type;
|
long type;
|
||||||
short path;
|
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))
|
if(open_dialog(filename, &path, &type, 0, 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(path_topotentialname(path, filename, fullname, 0) == 0)
|
if(path_topotentialname(path, filename, maxpath, 0) == 0)
|
||||||
{
|
{
|
||||||
ftmax_atom_t a;
|
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);
|
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);
|
fluidmax_do_load(o, NULL, ac, at);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char fullname[1024];
|
char maxpath[1024];
|
||||||
|
char fullpath[1024];
|
||||||
short path;
|
short path;
|
||||||
long type;
|
long type;
|
||||||
ftmax_atom_t a;
|
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;
|
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);
|
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;
|
unsigned int preset = 0;
|
||||||
int channel = 1;
|
int channel = 1;
|
||||||
|
|
||||||
if (ac == 0)
|
switch(ac)
|
||||||
{
|
{
|
||||||
return; // Someone is wasting our time
|
default:
|
||||||
}
|
case 4:
|
||||||
|
if(ftmax_is_number(at + 3))
|
||||||
if(ftmax_is_number(at))
|
channel = ftmax_get_number_int(at + 3);
|
||||||
{
|
|
||||||
switch(ac)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
case 4:
|
|
||||||
if(ftmax_is_number(at + 3))
|
|
||||||
channel = ftmax_get_number_int(at + 3);
|
|
||||||
|
|
||||||
if(channel < 1)
|
if(channel < 1)
|
||||||
channel = 1;
|
channel = 1;
|
||||||
else if(channel > fluid_synth_count_midi_channels(self->synth))
|
else if(channel > fluid_synth_count_midi_channels(self->synth))
|
||||||
channel = fluid_synth_count_midi_channels(self->synth);
|
channel = fluid_synth_count_midi_channels(self->synth);
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if(ftmax_is_number(at + 2))
|
if(ftmax_is_number(at + 2))
|
||||||
preset = ftmax_get_number_int(at + 2);
|
preset = ftmax_get_number_int(at + 2);
|
||||||
case 2:
|
|
||||||
if(ftmax_is_number(at + 1))
|
case 2:
|
||||||
bank = ftmax_get_number_int(at + 1);
|
if(ftmax_is_number(at + 1))
|
||||||
case 1:
|
bank = ftmax_get_number_int(at + 1);
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
if(ftmax_is_number(at))
|
||||||
fluid_synth_program_select(self->synth, channel - 1, ftmax_get_number_int(at), bank, preset);
|
fluid_synth_program_select(self->synth, channel - 1, ftmax_get_number_int(at), bank, preset);
|
||||||
case 0:
|
else if(ftmax_is_symbol(at))
|
||||||
break;
|
fluid_synth_program_select2(self->synth, channel - 1, ftmax_symbol_name(ftmax_get_symbol(at)), bank, preset);
|
||||||
}
|
|
||||||
} else if(ftmax_is_symbol(at)) {
|
case 0:
|
||||||
|
break;
|
||||||
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
|
static void
|
||||||
|
@ -841,8 +825,6 @@ fluidmax_new(Symbol *s, short ac, Atom *at)
|
||||||
int polyphony = 256;
|
int polyphony = 256;
|
||||||
int midi_channels = 16;
|
int midi_channels = 16;
|
||||||
|
|
||||||
post("fluidsynth~: DEBUG VERSION [PH]");
|
|
||||||
|
|
||||||
self->outlet = outlet_new(self, "bang");
|
self->outlet = outlet_new(self, "bang");
|
||||||
|
|
||||||
dsp_setup((t_pxobject *)self, 0);
|
dsp_setup((t_pxobject *)self, 0);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue