Added -Wno-unused-parameter because its annoying to have warning for unused parameters.

Removed many unused variables.
Added a new macro fluid_profile_ref_var() for defining a profiling reference variable, to get rid of unused variable warnings when profiling is disabled.
Removed unused functions fluid_oss_get_caps and fluid_oss_get_sample_formats.
This commit is contained in:
Josh Green 2009-10-07 05:20:55 +00:00
parent 799f01a2dc
commit 422924ee45
16 changed files with 24 additions and 140 deletions

View file

@ -145,10 +145,10 @@ AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
ENABLE_DEBUG=$enableval)
if test "$ENABLE_DEBUG" = "yes"; then
CFLAGS="${CFLAGS} ${FCCFLAGS} -g -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes"
CFLAGS="${CFLAGS} ${FCCFLAGS} -g -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused-parameter"
AC_DEFINE(DEBUG, 1, [Define to activate debugging message])
else
CFLAGS="${CFLAGS} ${FCCFLAGS} -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Winline"
CFLAGS="${CFLAGS} ${FCCFLAGS} -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Winline -Wno-unused-parameter"
AC_DEFINE(DEBUG, 0, [Define to activate debugging message])
fi

View file

@ -511,8 +511,7 @@ static void* fluid_alsa_audio_run_s16(void* d)
float* right;
short* buf;
float* handle[2];
int i, k, n, buffer_size, offset;
float s;
int n, buffer_size, offset;
buffer_size = dev->buffer_size;
@ -1134,7 +1133,6 @@ fluid_alsa_seq_run(void* d)
snd_seq_event_t *seq_ev;
fluid_midi_event_t evt;
fluid_alsa_seq_driver_t* dev = (fluid_alsa_seq_driver_t*) d;
int channel;
/* make sure the other threads can cancel this thread any time */
if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL)) {

View file

@ -65,7 +65,6 @@ void fluid_file_audio_driver_settings(fluid_settings_t* settings)
{
#if LIBSNDFILE_SUPPORT
const char **names, **np;
int i;
#endif
#if LIBSNDFILE_SUPPORT
@ -101,7 +100,6 @@ new_fluid_file_audio_driver(fluid_settings_t* settings,
fluid_synth_t* synth)
{
fluid_file_audio_driver_t* dev;
int err;
int msec;
dev = FLUID_NEW(fluid_file_audio_driver_t);

View file

@ -130,7 +130,7 @@ int
fluid_dsp_float_interpolate_none (fluid_voice_t *voice)
{
fluid_phase_t dsp_phase = voice->phase;
fluid_phase_t dsp_phase_incr, end_phase;
fluid_phase_t dsp_phase_incr;
short int *dsp_data = voice->sample->data;
fluid_real_t *dsp_buf = voice->dsp_buf;
fluid_real_t dsp_amp = voice->amp;
@ -193,7 +193,7 @@ int
fluid_dsp_float_interpolate_linear (fluid_voice_t *voice)
{
fluid_phase_t dsp_phase = voice->phase;
fluid_phase_t dsp_phase_incr, end_phase;
fluid_phase_t dsp_phase_incr;
short int *dsp_data = voice->sample->data;
fluid_real_t *dsp_buf = voice->dsp_buf;
fluid_real_t dsp_amp = voice->amp;
@ -284,7 +284,7 @@ int
fluid_dsp_float_interpolate_4th_order (fluid_voice_t *voice)
{
fluid_phase_t dsp_phase = voice->phase;
fluid_phase_t dsp_phase_incr, end_phase;
fluid_phase_t dsp_phase_incr;
short int *dsp_data = voice->sample->data;
fluid_real_t *dsp_buf = voice->dsp_buf;
fluid_real_t dsp_amp = voice->amp;
@ -436,7 +436,7 @@ int
fluid_dsp_float_interpolate_7th_order (fluid_voice_t *voice)
{
fluid_phase_t dsp_phase = voice->phase;
fluid_phase_t dsp_phase_incr, end_phase;
fluid_phase_t dsp_phase_incr;
short int *dsp_data = voice->sample->data;
fluid_real_t *dsp_buf = voice->dsp_buf;
fluid_real_t dsp_amp = voice->amp;

View file

@ -148,7 +148,7 @@ fluid_event_queue_get_outptr (fluid_event_queue_t *queue)
FLUID_INLINE void
fluid_event_queue_next_outptr (fluid_event_queue_t *queue)
{
fluid_atomic_int_dec_and_test (&queue->count);
fluid_atomic_int_add (&queue->count, -1);
if (++queue->out == queue->totalcount)
queue->out = 0;

View file

@ -109,7 +109,7 @@ fluid_audio_driver_t*
new_fluid_jack_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t func, void* data) {
fluid_jack_audio_driver_t* dev = NULL;
char name[64];
int i, audio_count, fx_count;
int i;
/* for looking up ports */
const char ** jack_ports;
char* client_name;
@ -281,7 +281,6 @@ int
delete_fluid_jack_audio_driver(fluid_audio_driver_t* p)
{
fluid_jack_audio_driver_t* dev = (fluid_jack_audio_driver_t*) p;
int i;
if (dev == NULL) {
return 0;
@ -363,7 +362,7 @@ fluid_jack_audio_driver_srate(jack_nframes_t nframes, void *arg)
void
fluid_jack_audio_driver_shutdown(void *arg)
{
fluid_jack_audio_driver_t* dev = (fluid_jack_audio_driver_t*) arg;
// fluid_jack_audio_driver_t* dev = (fluid_jack_audio_driver_t*) arg;
FLUID_LOG(FLUID_ERR, "Help! Lost the connection to the JACK server");
/* exit (1); */
}
@ -384,7 +383,6 @@ new_fluid_jack_midi_driver (fluid_settings_t *settings,
fluid_jack_midi_driver_t* dev;
char *client_name;
char name[64];
int err;
/* not much use doing anything */
if (handler == NULL)
@ -466,7 +464,6 @@ int
delete_fluid_jack_midi_driver(fluid_midi_driver_t *p)
{
fluid_jack_midi_driver_t* dev;
int err;
dev = (fluid_jack_midi_driver_t *)p;

View file

@ -39,7 +39,6 @@ fluid_midi_router_t*
new_fluid_midi_router(fluid_settings_t* settings, handle_midi_event_func_t handler, void* event_handler_data)
{
fluid_midi_router_t* router=NULL;
fluid_midi_router_rule_t* rule=NULL;
/* create the router */
router = FLUID_NEW(fluid_midi_router_t); if (router == NULL){
@ -275,7 +274,6 @@ int
fluid_midi_router_handle_midi_event(void* data, fluid_midi_event_t* event)
{
fluid_midi_router_t* router=(fluid_midi_router_t*)data;
fluid_synth_t* synth = router->synth;
fluid_midi_router_rule_t* rule=NULL;
fluid_midi_router_rule_t* next_rule=NULL;
int event_has_par2=0; /* Flag, indicates that current event needs two parameters */

View file

@ -76,9 +76,7 @@ typedef struct {
int delete_fluid_oss_audio_driver(fluid_audio_driver_t* p);
/* local utilities */
static int fluid_oss_get_caps(fluid_oss_audio_driver_t* dev);
static int fluid_oss_set_queue_size(fluid_oss_audio_driver_t* dev, int ss, int ch, int qs, int bs);
static int fluid_oss_get_sample_formats(fluid_oss_audio_driver_t* dev);
static void* fluid_oss_audio_run(void* d);
static void* fluid_oss_audio_run2(void* d);
@ -469,87 +467,6 @@ delete_fluid_oss_audio_driver(fluid_audio_driver_t* p)
return FLUID_OK;
}
/*
* fluid_oss_get_sample_formats
*/
int
fluid_oss_get_sample_formats(fluid_oss_audio_driver_t* dev)
{
int mask;
unsigned short U16 = 1;
unsigned char* U8 = (unsigned char*) &U16;
dev->formats = 0;
dev->bigendian = 0;
if (ioctl(dev->dspfd, SNDCTL_DSP_GETFMTS, &mask) == -1) {
return -1;
}
dev->formats = mask;
if (U8[1] == 1) {
FLUID_LOG(FLUID_DBG, "Machine is big endian.");
dev->bigendian = 1;
}
if (U8[0] == 1) {
FLUID_LOG(FLUID_DBG, "Machine is little endian.");
dev->bigendian = 0;
}
FLUID_LOG(FLUID_DBG, "The sound device supports the following audio formats:");
if (mask & AFMT_U8) { FLUID_LOG(FLUID_DBG, " U8"); }
if (mask & AFMT_S8) { FLUID_LOG(FLUID_DBG, " S8"); }
if (mask & AFMT_U16_LE) { FLUID_LOG(FLUID_DBG, " U16LE"); }
if (mask & AFMT_U16_BE) { FLUID_LOG(FLUID_DBG, " U16BE"); }
if (mask & AFMT_S16_LE) { FLUID_LOG(FLUID_DBG, " S16LE"); }
if (mask & AFMT_S16_BE) { FLUID_LOG(FLUID_DBG, " S16BE"); }
if (mask & AFMT_MU_LAW) { FLUID_LOG(FLUID_DBG, " mu-law"); }
if (mask & AFMT_A_LAW) { FLUID_LOG(FLUID_DBG, " a-law"); }
if (mask & AFMT_IMA_ADPCM) { FLUID_LOG(FLUID_DBG, " ima-adpcm"); }
if (mask & AFMT_MPEG) { FLUID_LOG(FLUID_DBG, " mpeg"); }
return 0;
}
/**
* fluid_oss_get_caps
*
* Get the audio capacities of the sound card.
*/
int
fluid_oss_get_caps(fluid_oss_audio_driver_t* dev)
{
int caps;
dev->caps = 0;
if (ioctl(dev->dspfd, SNDCTL_DSP_GETCAPS, &caps) < 0) {
return -1;
}
dev->caps = caps;
FLUID_LOG(FLUID_DBG, "The sound device has the following capabilities:");
if (caps & DSP_CAP_DUPLEX) {
FLUID_LOG(FLUID_DBG, " Duplex: simultaneous playing and recording possible") ;
} else {
FLUID_LOG(FLUID_DBG, " Duplex: simultaneous playing and recording not possible");
}
if (caps & DSP_CAP_REALTIME) {
FLUID_LOG(FLUID_DBG, " Real-time: precise reporting of output pointer possible");
} else {
FLUID_LOG(FLUID_DBG, " Real-time: precise reporting of output pointer not possible");
}
if (caps & DSP_CAP_BATCH) {
FLUID_LOG(FLUID_DBG, " Batch: local storage for recording and/or playback");
} else {
FLUID_LOG(FLUID_DBG, " Batch: no local storage for recording and/or playback");
}
if (caps & DSP_CAP_TRIGGER) {
FLUID_LOG(FLUID_DBG, " Trigger: triggering of recording/playback possible");
} else {
FLUID_LOG(FLUID_DBG, " Trigger: triggering of recording/playback not possible");
}
if (caps & DSP_CAP_MMAP) {
FLUID_LOG(FLUID_DBG, " Mmap: direct access to the hardware level buffer possible");
} else {
FLUID_LOG(FLUID_DBG, " Mmap: direct access to the hardware level buffer not possible");
}
return 0;
}
/**
* fluid_oss_set_queue_size
*
@ -639,9 +556,7 @@ fluid_oss_audio_run2(void* d)
float* left = dev->buffers[0];
float* right = dev->buffers[1];
int buffer_size = dev->buffer_size;
int len = dev->buffer_size;
int dither_index = 0;
int i, k;
FLUID_LOG(FLUID_DBG, "Audio thread running");

View file

@ -91,7 +91,7 @@ new_fluid_pulse_audio_driver2(fluid_settings_t* settings,
pthread_attr_t attr;
int sched = SCHED_FIFO;
struct sched_param priority;
int i, err, dir = 0;
int err;
dev = FLUID_NEW(fluid_pulse_audio_driver_t);
if (dev == NULL) {
@ -234,7 +234,6 @@ int delete_fluid_pulse_audio_driver(fluid_audio_driver_t* p)
static void* fluid_pulse_audio_run(void* d)
{
fluid_pulse_audio_driver_t* dev = (fluid_pulse_audio_driver_t*) d;
fluid_synth_t *synth = (fluid_synth_t *)(dev->data);
float *buf;
int buffer_size;
int err;

View file

@ -569,8 +569,6 @@ void _fluid_free_evt_queue(fluid_evt_entry** first, fluid_evt_entry** last);
short
_fluid_seq_queue_init(fluid_sequencer_t* seq, int maxEvents)
{
int i;
seq->heap = _fluid_evt_heap_init(maxEvents);
if (seq->heap == NULL) {
fluid_log(FLUID_PANIC, "sequencer: Out of memory\n");

View file

@ -379,7 +379,6 @@ fluid_settings_set(fluid_settings_t* settings, char* name, void* value)
fluid_setting_node_t *node;
char* tokens[MAX_SETTINGS_TOKENS];
char buf[MAX_SETTINGS_LABEL+1];
int ntokens;
int n, num;
char *dupname;
@ -1287,7 +1286,6 @@ fluid_settings_foreach_option_alpha (fluid_settings_t* settings, char* name, voi
fluid_setting_node_t *node;
fluid_str_setting_t *setting;
fluid_list_t *p, *newlist = NULL;
char* option;
fluid_return_if_fail (settings != NULL);
fluid_return_if_fail (name != NULL);

View file

@ -239,7 +239,6 @@ void fluid_synth_settings(fluid_settings_t* settings)
fluid_settings_add_option(settings, "synth.midi-mode", "normal");
fluid_settings_add_option(settings, "synth.midi-mode", "gm");
fluid_settings_add_option(settings, "synth.midi-mode", "gs");
fluid_settings_add_option(settings, "synth.midi-mode", "xg");
}
/*
@ -1427,7 +1426,7 @@ fluid_synth_cc_real (fluid_synth_t* synth, int channum, int num, int value,
int noqueue)
{
fluid_channel_t* chan = synth->channel[channum];
int banknum, nrpn_select, nrpn_active = 0;
int nrpn_select, nrpn_active = 0;
int rpn_msb = 0, rpn_lsb = 0;
/* nrpn_active, rpn_msb and rpn_lsb may get used multiple times, read them
@ -2255,7 +2254,6 @@ fluid_synth_find_preset(fluid_synth_t* synth, unsigned int banknum,
fluid_preset_t *preset = NULL;
fluid_sfont_info_t *sfont_info;
fluid_list_t *list;
int ofs;
fluid_rec_mutex_lock (synth->mutex); /* ++ lock sfont list, bank offset list and sfont */
@ -2461,8 +2459,6 @@ fluid_synth_program_select2(fluid_synth_t* synth, int chan, char* sfont_name,
{
fluid_preset_t* preset = NULL;
fluid_channel_t* channel;
fluid_sfont_t* sfont = NULL;
int offset;
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (chan >= 0 && chan < synth->midi_channels, FLUID_FAILED);
@ -2899,13 +2895,13 @@ fluid_synth_write_s16(fluid_synth_t* synth, int len,
signed short* right_out = (signed short*) rout;
fluid_real_t* left_in = synth->left_buf[0];
fluid_real_t* right_in = synth->right_buf[0];
double prof_ref = fluid_profile_ref();
fluid_real_t left_sample;
fluid_real_t right_sample;
double time = fluid_utime();
int di = synth->dither_index;
double prof_ref_on_block;
float cpu_load;
fluid_profile_ref_var (prof_ref);
/* make sure we're playing */
if (synth->state != FLUID_SYNTH_PLAYING) {
@ -2979,10 +2975,10 @@ fluid_synth_dither_s16(int *dither_index, int len, float* lin, float* rin,
int i, j, k;
signed short* left_out = (signed short*) lout;
signed short* right_out = (signed short*) rout;
double prof_ref = fluid_profile_ref();
fluid_real_t left_sample;
fluid_real_t right_sample;
int di = *dither_index;
fluid_profile_ref_var (prof_ref);
for (i = 0, j = loff, k = roff; i < len; i++, j += lincr, k += rincr) {
@ -3021,9 +3017,8 @@ fluid_synth_one_block(fluid_synth_t* synth, int do_not_mix_fx_to_out)
fluid_real_t* reverb_buf;
fluid_real_t* chorus_buf;
int byte_size = FLUID_BUFSIZE * sizeof(fluid_real_t);
double prof_ref = fluid_profile_ref();
double prof_ref_voice;
int count;
fluid_profile_ref_var (prof_ref);
/* Assign ID of synthesis thread, if not already set */
if (synth->synth_thread_id == FLUID_THREAD_ID_NULL)
@ -3152,11 +3147,11 @@ got_voice: /* We got a voice to process */
{
/* call all playing synthesis processes */
for (i = 0; i < synth->polyphony; i++) {
fluid_profile_ref_var (prof_ref_voice);
voice = synth->voice[i];
if (!_PLAYING(voice)) continue;
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',
@ -3177,7 +3172,7 @@ got_voice: /* We got a voice to process */
fluid_voice_write (voice, local_voice_buf);
fluid_voice_mix (voice, left_buf, right_buf, reverb_buf, chorus_buf);
fluid_profile(FLUID_PROF_ONE_BLOCK_VOICE, prof_ref_voice);
fluid_profile (FLUID_PROF_ONE_BLOCK_VOICE, prof_ref_voice);
}
}
@ -5575,8 +5570,6 @@ int
fluid_synth_start(fluid_synth_t* synth, unsigned int id, fluid_preset_t* preset,
int audio_chan, int midi_chan, int key, int vel)
{
fluid_channel_t* channel;
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (preset != NULL, FLUID_FAILED);
fluid_return_val_if_fail (midi_chan >= 0 && midi_chan < synth->midi_channels, FLUID_FAILED);

View file

@ -699,7 +699,6 @@ new_fluid_timer(int msec, fluid_timer_callback_t callback, void* data,
{
pthread_attr_t *attr = NULL;
pthread_attr_t rt_attr;
int sched = SCHED_FIFO;
struct sched_param priority;
int err;
@ -871,7 +870,6 @@ void fluid_profiling_print(void)
printf("fluid_profiling_print\n");
FLUID_LOG(FLUID_INFO, "Estimated CPU frequency: %.0f MHz", fluid_cpu_frequency);
FLUID_LOG(FLUID_INFO, "Estimated times: min/avg/max (micro seconds)");
for (i = 0; i < FLUID_PROF_LAST; i++) {

View file

@ -289,6 +289,10 @@ extern fluid_profile_data_t fluid_profile_data[];
/** Macro to obtain a time refence used for the profiling */
#define fluid_profile_ref() fluid_utime()
/** Macro to create a variable and assign the current reference time for profiling.
* So we don't get unused variable warnings when profiling is disabled. */
#define fluid_profile_ref_var(name) double name = fluid_utime()
/** Macro to calculate the min/avg/max. Needs a time refence and a
profile number. */
#define fluid_profile(_num,_ref) { \
@ -307,6 +311,7 @@ extern fluid_profile_data_t fluid_profile_data[];
/* No profiling */
#define fluid_profiling_print()
#define fluid_profile_ref() 0
#define fluid_profile_ref_var(name)
#define fluid_profile(_num,_ref)
#endif

View file

@ -245,11 +245,8 @@ fluid_real_t fluid_voice_gen_value(fluid_voice_t* voice, int num)
int
fluid_voice_write (fluid_voice_t* voice, fluid_real_t *dsp_buf)
{
unsigned int i;
fluid_real_t incr;
fluid_real_t fres;
fluid_real_t target_amp; /* target amplitude */
int dsp_interp_method = voice->interp_method;
fluid_env_data_t* env_data;
fluid_real_t x;
int count = 0;
@ -665,7 +662,6 @@ fluid_voice_filter (fluid_voice_t *voice)
fluid_real_t dsp_centernode;
int count = voice->dsp_buf_count;
int dsp_i;
float v;
/* filter (implement the voice filter according to SoundFont standard) */
@ -845,8 +841,6 @@ fluid_voice_calculate_gen_pitch(fluid_voice_t* voice)
static int
fluid_voice_calculate_runtime_synthesis_parameters(fluid_voice_t* voice)
{
fluid_real_t x;
fluid_real_t q_db;
int i;
int list_of_generators_to_initialize[35] = {

View file

@ -53,13 +53,6 @@
#define WITH_MIDI 1
#endif
/* default audio fragment count (if none specified) */
#ifdef WIN32
#define DEFAULT_FRAG_COUNT 32
#else
#define DEFAULT_FRAG_COUNT 16
#endif
void print_usage(void);
void print_help(void);
void print_welcome(void);
@ -231,7 +224,7 @@ int main(int argc, char** argv)
fluid_settings_t* settings;
int arg1 = 1;
char buf[512];
int c, i, fragcount = DEFAULT_FRAG_COUNT;
int c, i;
int interactive = 1;
int midi_in = 1;
fluid_player_t* player = NULL;