mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 06:51:54 +00:00
Applied Stephane Letz patch: MidiShare is now connected to fluidsynth
by default so that received MIDI events directly trigger the synth
This commit is contained in:
parent
a360fdded7
commit
83ae11f873
8 changed files with 51 additions and 31 deletions
|
@ -17,3 +17,5 @@
|
|||
|
||||
/* define to support DARWIN */
|
||||
#define DARWIN
|
||||
|
||||
typedef int socklen_t
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#define VERSION "0.2.4"
|
||||
#define VERSION "1.0.x"
|
||||
|
||||
#define MACINTOSH
|
||||
|
||||
|
@ -33,3 +33,5 @@
|
|||
#define PORTAUDIO_SUPPORT 1
|
||||
#define __Types__
|
||||
*/
|
||||
|
||||
typedef int socklen_t
|
||||
|
|
|
@ -70,6 +70,7 @@ void fluid_core_audio_driver_settings(fluid_settings_t* settings);
|
|||
fluid_audio_driver_t* new_fluid_dsound_audio_driver(fluid_settings_t* settings,
|
||||
fluid_synth_t* synth);
|
||||
int delete_fluid_dsound_audio_driver(fluid_audio_driver_t* p);
|
||||
void fluid_dsound_audio_driver_settings(fluid_settings_t* settings);
|
||||
#endif
|
||||
|
||||
#if PORTAUDIO_SUPPORT
|
||||
|
@ -128,7 +129,7 @@ fluid_audriver_definition_t fluid_audio_drivers[] = {
|
|||
new_fluid_dsound_audio_driver,
|
||||
NULL,
|
||||
delete_fluid_dsound_audio_driver,
|
||||
NULL },
|
||||
fluid_dsound_audio_driver_settings },
|
||||
#endif
|
||||
#if PORTAUDIO_SUPPORT
|
||||
{ "portaudio",
|
||||
|
|
|
@ -62,6 +62,20 @@ typedef struct {
|
|||
DWORD frame_size;
|
||||
} fluid_dsound_audio_driver_t;
|
||||
|
||||
static BOOL
|
||||
fluid_dsound_enum_callback(LPGUID guid, LPCSTR description, LPCSTR module, LPVOID context)
|
||||
{
|
||||
fluid_settings_t* settings = (fluid_settings_t*) context;
|
||||
fluid_settings_add_option(settings, "audio.dsound.device", description);
|
||||
}
|
||||
|
||||
void fluid_dsound_audio_driver_settings(fluid_settings_t* settings)
|
||||
{
|
||||
fluid_settings_register_str(settings, "audio.dsound.device", "default", 0, NULL, NULL);
|
||||
fluid_settings_add_option(settings, "audio.dsound.device", "default");
|
||||
DirectSoundEnumerate((LPDSENUMCALLBACK) fluid_dsound_enum_callback, settings);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* new_fluid_dsound_audio_driver
|
||||
|
@ -377,7 +391,7 @@ int fluid_win32_create_window(void)
|
|||
myClass.hCursor = LoadCursor( NULL, IDC_ARROW );
|
||||
myClass.hIcon = NULL;
|
||||
myClass.lpszMenuName = (LPSTR) NULL;
|
||||
myClass.lpszClassName = (LPSTR) "FLUIDSynth";
|
||||
myClass.lpszClassName = (LPSTR) "FluidSynth";
|
||||
myClass.hbrBackground = (HBRUSH)(COLOR_WINDOW);
|
||||
myClass.hInstance = FLUID_HINSTANCE;
|
||||
myClass.style = CS_GLOBALCLASS;
|
||||
|
@ -387,7 +401,7 @@ int fluid_win32_create_window(void)
|
|||
if (!RegisterClass(&myClass)) {
|
||||
return -100;
|
||||
}
|
||||
fluid_wnd = CreateWindow((LPSTR) "FLUIDSynth", (LPSTR) "FLUIDSynth", WS_OVERLAPPEDWINDOW,
|
||||
fluid_wnd = CreateWindow((LPSTR) "FluidSynth", (LPSTR) "FluidSynth", WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 400, 300, (HWND) NULL, (HMENU) NULL,
|
||||
FLUID_HINSTANCE, (LPSTR) NULL);
|
||||
if (fluid_wnd == NULL) {
|
||||
|
@ -402,8 +416,7 @@ int fluid_win32_destroy_window(void)
|
|||
if (fluid_wnd != NULL) {
|
||||
DestroyWindow(fluid_wnd);
|
||||
fluid_wnd = NULL;
|
||||
|
||||
UnregisterClass((LPSTR) "FLUIDSynth",FLUID_HINSTANCE);
|
||||
UnregisterClass((LPSTR) "FluidSynth", FLUID_HINSTANCE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
* 21/12/01 : Add a compilation flag (MIDISHARE_DRIVER) for driver or application mode
|
||||
* 29/01/02 : Compilation on MacOSX, use a task for typeNote management
|
||||
* 03/06/03 : Adapdation for FluidSynth API
|
||||
* 18/03/04 : In appplication mode, connect MidiShare to the fluidsynth client (fluid_midishare_open_appl)
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -139,7 +140,6 @@ new_fluid_midishare_midi_driver(fluid_settings_t* settings,
|
|||
MidiSetFilter(dev->refnum, dev->filter);
|
||||
|
||||
dev->status = FLUID_MIDI_READY;
|
||||
|
||||
return (fluid_midi_driver_t*) dev;
|
||||
|
||||
error_recovery:
|
||||
|
@ -393,6 +393,7 @@ static int fluid_midishare_open_appl (fluid_midishare_midi_driver_t* dev)
|
|||
return 0;
|
||||
}
|
||||
MidiSetRcvAlarm(dev->refnum, fluid_midishare_midi_driver_receive);
|
||||
MidiConnect(0,dev->refnum,true);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1540,21 +1540,21 @@ fluid_synth_nwrite_float(fluid_synth_t* synth, int len,
|
|||
|
||||
/* Then, run one_block() and copy till we have 'len' samples */
|
||||
while (count < len) {
|
||||
fluid_synth_one_block(synth, 1);
|
||||
fluid_synth_one_block(synth, 1);
|
||||
|
||||
num = (FLUID_BUFSIZE > len - count)? len - count : FLUID_BUFSIZE;
|
||||
bytes = num * sizeof(float);
|
||||
num = (FLUID_BUFSIZE > len - count)? len - count : FLUID_BUFSIZE;
|
||||
bytes = num * sizeof(float);
|
||||
|
||||
for (i = 0; i < synth->audio_channels; i++) {
|
||||
FLUID_MEMCPY(left[i] + count, left_in[i], bytes);
|
||||
FLUID_MEMCPY(right[i] + count, right_in[i], bytes);
|
||||
}
|
||||
for (i = 0; i < synth->effects_channels; i++) {
|
||||
FLUID_MEMCPY(fx_left[i] + count, fx_left_in[i], bytes);
|
||||
FLUID_MEMCPY(fx_right[i] + count, fx_right_in[i], bytes);
|
||||
}
|
||||
for (i = 0; i < synth->audio_channels; i++) {
|
||||
FLUID_MEMCPY(left[i] + count, left_in[i], bytes);
|
||||
FLUID_MEMCPY(right[i] + count, right_in[i], bytes);
|
||||
}
|
||||
for (i = 0; i < synth->effects_channels; i++) {
|
||||
FLUID_MEMCPY(fx_left[i] + count, fx_left_in[i], bytes);
|
||||
FLUID_MEMCPY(fx_right[i] + count, fx_right_in[i], bytes);
|
||||
}
|
||||
|
||||
count += num;
|
||||
count += num;
|
||||
}
|
||||
|
||||
synth->cur = num;
|
||||
|
@ -1747,15 +1747,17 @@ fluid_synth_one_block(fluid_synth_t* synth, int do_not_mix_fx_to_out)
|
|||
if (_PLAYING(voice)) {
|
||||
double prof_ref_voice = fluid_profile_ref();
|
||||
|
||||
/* The output associated with a MIDI channel is wrapped around using the number of
|
||||
* audio groups as modulo divider.
|
||||
* This is typically the number of output channels on the 'sound card', as long as the
|
||||
* LADSPA Fx unit is not used. In case of LADSPA unit, think of it as subgroups on a mixer.
|
||||
/* The output associated with a MIDI channel is wrapped around
|
||||
* using the number of audio groups as modulo divider. This is
|
||||
* typically the number of output channels on the 'sound card',
|
||||
* as long as the LADSPA Fx unit is not used. In case of LADSPA
|
||||
* unit, think of it as subgroups on a mixer.
|
||||
*
|
||||
* For example: Assume that the number of groups is set to 2.
|
||||
* Then MIDI channel 1, 3, 5, 7 etc. go to output 1, channels 2, 4, 6, 8 etc to output 2.
|
||||
* Or assume 3 groups:
|
||||
* Then MIDI channels 1, 4, 7, 10 etc go to output 1; 2, 5, 8, 11 etc to output 2,
|
||||
* 3, 6, 9, 12 etc to output 3.
|
||||
* Then MIDI channel 1, 3, 5, 7 etc. go to output 1, channels 2,
|
||||
* 4, 6, 8 etc to output 2. Or assume 3 groups: Then MIDI
|
||||
* channels 1, 4, 7, 10 etc go to output 1; 2, 5, 8, 11 etc to
|
||||
* output 2, 3, 6, 9, 12 etc to output 3.
|
||||
*/
|
||||
auchan = fluid_channel_get_num(fluid_voice_get_channel(voice));
|
||||
auchan %= synth->audio_groups;
|
||||
|
|
|
@ -682,7 +682,6 @@ print_welcome()
|
|||
"under certain conditions; see the COPYING file for details.\n"
|
||||
"SoundFont(R) is a registered trademark of E-mu Systems, Inc.\n\n"
|
||||
"Type 'help' to get information on the shell commands.\n\n", FLUIDSYNTH_VERSION);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue