fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] Enable/disable logging at configure time


From: Carlo Bramini
Subject: Re: [fluid-dev] Enable/disable logging at configure time
Date: Sun, 29 Oct 2017 21:07:55 +0100 (CET)

Hello,

I also noticed that, about this aspect, there are some other interesting poins:
- dithering: there is a rand_table[][] inside fluid_synth.c, that it is 384KB 
of static memory. if somebody would like to recover some space, this may be a 
good tip.

- In fluid_conv.c there are these tables:

fluid_real_t fluid_ct2hz_tab[FLUID_CENTS_HZ_SIZE];
fluid_real_t fluid_cb2amp_tab[FLUID_CB_AMP_SIZE];
fluid_real_t fluid_atten2amp_tab[FLUID_ATTEN_AMP_SIZE];
fluid_real_t fluid_concave_tab[128];
fluid_real_t fluid_convex_tab[128];
fluid_real_t fluid_pan_tab[FLUID_PAN_SIZE];

All these could be static const objects, at least in theory.
Here on my PC, I grabbed a piece of code from this file and I made a little 
program for generating these tables, but the luxury would be that cmake creates 
this program at configure time and it generates them, if this space saving is 
wanted by the user. In my opinion, this line:

https://github.com/FluidSynth/fluidsynth/blob/master/src/utils/fluid_conv.c#L83

seems to be useless to me, perhaps it could be removed.

About the FLUID_LOG(), I was preparing something to be evaluated, but I noticed 
that:
1) in few points of some sources, the code is calling directly fluid_log() 
function instead of FLUID_LOG macro. I do not know if it is wanted or not.
2) it exists a function called fluid_error() that actually returns the last 
textual message written inside fluid_errbuf[]. Removing those prints, it will 
also remove this feature. This is probably not a thing to be wanted.
3) GCC 6 complained with hundred of warnings of "code without effect". 
Evidently, it does not like it and it reports it to the user. I could resolve 
this thing by making the macro FLUID_LOG() with variable arguments. But this 
feature is not supported in C90, so MSVC6 won't work. I could also rewrite 
macro FLUID_LOG as:
#define FLUID_LOG(_args)  fluid_log _args
and use it as:
FLUID_LOG(("hello %d", myvar));
with the parameters of fluid_log() closed in a single macro argument, but after 
doing some work I realized that there are too much prints and too much work. I 
think I will keep it as it is for now and I will retry if I will be out of 
flash memory space.

Sincerely.



> Il 29 ottobre 2017 alle 14.04 Marcus Weseloh <address@hidden> ha scritto:
> 
> Hi Carlo,
> 
> 2017-10-29 11:58 GMT+01:00 Carlo Bramini <address@hidden>:
> 
> > It saves some memory if someone wants (about 12KB on an ARM Thumb2 
> > microcontroller) and it would be selectable by the user (logging will be 
> > activated by default).
> 
> Unrelated to your change request and you probably have seen it already... I 
> stumbled across this while trying to figure out the rvoice mixer rendering 
> data flow: FluidSynth allocates 8192 * sizeof(fluid_real_t) of memory for 
> each output buffer, so for a normal stereo setup with reverb and chorus and 
> double-precision floats that's 256k of memory. The size is hard-coded in 
> fluid_rvoice_mixer.h:
> 
> #define FLUID_MIXER_MAX_BUFFERS_DEFAULT (8192/FLUID_BUFSIZE) 
> 
> So if you know how many blocks you render at any one time, you can probably 
> change the 8192 to something *much* smaller (maybe even to FLUID_BUFSIZE), 
> reducing the memory footprint of FluidSynth quite a bit.
> 
> Cheers,
> 
>    Marcus
> 
> _______________________________________________
> fluid-dev mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/fluid-dev



reply via email to

[Prev in Thread] Current Thread [Next in Thread]