Fixed the timing in the MIDI playback. Improved documentation in sfont.h.

Removed unused is_number() in fluidsynth.c
This commit is contained in:
Peter Hanappe 2004-03-22 10:28:19 +00:00
parent b43bf8bbc1
commit e541eb9d28
6 changed files with 932 additions and 907 deletions

View file

@ -1,3 +1,19 @@
2004-03-22 Peter Hanappe <peter@hanappe.com>
* src/fluid_midi.c (fluid_player_callback): Fixed the timing in
the MIDI playback. The current MIDI tick in every timer callback
was calculated as an increment to the previous number of
ticks. This introduces a growing error due to rounding errors and
timer variations. The current tick is now calculated according to
the absolute time at the beginning of the file. (Beginners error
...)
* doc/FluidSynth-LADSPA.pdf: Added Markus' LADSPA design document.
* doc/xtrafluid.txt: Added Antoine's Xtra API documentation.
* doc/midi_time.txt: Added a memo on midi timing.
2004-03-19 Peter Hanappe <peter@hanappe.com>
* src/fluid_midishare.c: Applied Stephane Letz patch: MidiShare is

View file

@ -47,6 +47,24 @@ JG:
- Remove dependency of settings on audio driver and other (see
fluid_settings_init())
- MIDI tempo
fluidsynth: real 2m23.312s
timidity: real 2m04.304s
- Validation tests
- Validate reverb
- Validate chorus
- Documentation
- Web site
- Linux + Win + MacOS X + fluid~ + fluidsynth~ + old distributions
- Documentation and announcement Virtools and Director
- Component for MacOS X (Core Audio?)
- Component for DirectMusic
- Multi-channel output
- DirectSound 3D and EAX
Synthesis related
-----------------

View file

@ -36,10 +36,10 @@ extern "C" {
* with callback functions): fluid_sfloader_t, fluid_sfont_t, and
* fluid_preset_t.
*
* To add a new SoundFont loader to the synthesizer, you call
* To add a new SoundFont loader to the synthesizer, call
* fluid_synth_add_sfloader() and pass a pointer to an
* fluid_sfloader_t structure. The important callback function in
* this structure os "load", which should try to load a file and
* this structure is "load", which should try to load a file and
* returns a fluid_sfont_t structure, or NULL if it fails.
*
* The fluid_sfont_t structure contains a callback to obtain the
@ -72,8 +72,15 @@ extern "C" {
*/
struct _fluid_sfloader_t {
/** Private data */
void* data;
/** The free must free the memory allocated for the loader in
* addition to any private data. It should return 0 if no error
* occured, non-zero otherwise.*/
int (*free)(fluid_sfloader_t* loader);
/** Load a file. Returns NULL if an error occured. */
fluid_sfont_t* (*load)(fluid_sfloader_t* loader, const char* filename);
};
@ -91,8 +98,14 @@ struct _fluid_sfont_t {
the samples could not be freed because they are still in use. */
int (*free)(fluid_sfont_t* sfont);
/** Return the name of the sfont */
char* (*get_name)(fluid_sfont_t* sfont);
/** Return the preset with the specified bank and preset number. All
* the fields, including the 'sfont' field, should * be filled
* in. If the preset cannot be found, the function returns NULL. */
fluid_preset_t* (*get_preset)(fluid_sfont_t* sfont, unsigned int bank, unsigned int prenum);
void (*iteration_start)(fluid_sfont_t* sfont);
/* return 0 when no more presets are available, 1 otherwise */
@ -114,7 +127,7 @@ struct _fluid_preset_t {
int (*get_banknum)(fluid_preset_t* preset);
int (*get_num)(fluid_preset_t* preset);
/** handle a noteon event. */
/** handle a noteon event. Returns 0 if no error occured. */
int (*noteon)(fluid_preset_t* preset, fluid_synth_t* synth, int chan, int key, int vel);
/** Implement this function if the preset needs to be notified about
@ -142,7 +155,7 @@ struct _fluid_sample_t
short* data;
/** The amplitude, that will lower the level of the sample's loop to
the noise floor Needed for note turnoff optimization, will be
the noise floor. Needed for note turnoff optimization, will be
filled out automatically */
/* Set this to zero, when submitting a new sample. */
int amplitude_that_reaches_noise_floor_is_valid;

File diff suppressed because it is too large Load diff

View file

@ -243,8 +243,7 @@ struct _fluid_player_t {
fluid_list_t* playlist;
char* current_file;
char send_program_change; /* should we ignore the program changes? */
int ticks_passed; /* number of midi ticks that have passed */
int msec_passed; /* number of milliseconds that have passed */
int start_msec; /* the start of the file */
int miditempo; /* as indicated by MIDI SetTempo: n 24th of a usec per midi-clock. bravo! */
double deltatime; /* milliseconds per midi tick. depends on set-tempo */
unsigned int division;

View file

@ -92,20 +92,6 @@ extern int optind, opterr, optopt;
#endif
/* is_number
*
* don't shoot me
*/
int is_number(char *a)
{
for (; *a != 0; a++) {
if (((*a < '0') || (*a > '9')) && (*a != '-') && (*a != '+') && (*a != '.')) {
return 0;
}
}
return 1;
}
/* process_o_cmd_line_option
*
* Purpose: