[vlc-devel] Custom Equalizer Presets - work in progress

Jet Dog jetdog330 at hotmail.com
Sat May 16 01:50:11 CEST 2009

Hello all,

I'm a bit of a n00b here, but I've been working on a patch to allow for =custom equalizer presets=.  It is not complete yet, but I am very keen on input from some of you.

At present, I have devised a way to replace the built in presets in a thread-safe manner.

Some things I have added:
Presets now have a mutex, allowing for only one read/write at a time.Presets are loaded from the configuration file, safely, even though the equalizer module may have not loaded yet.  I accomplish this with the functions within equalizer_presets.h header file.A new config var has been added, called "equalizer-presets", with a fairly complicated syntax.  You can paste the following into your vlcrc under [equalizer] if you wish to test this:

# string (Equalizer presets values)
equalizer-presets=My Preset::14.0:1 2 3 4 5 6 7 8 9 10

You will notice that loading with this string causes "Flat" to get overloaded with the above (except the name) - and that the list will not react for any of the other elements, because they will not exist :)

Note: The additional ':' is meant for identifying whether a preset is a default preset override - in which case we can accompany the language changes/regional options for the user automatically.  MY intention is to be able to add things like "bass" into there, so that the preset initializer/loader will be able to replace that with the translated version for "bass".  This will also allow users to use the first location (i.e. "My Preset") with built-in names ("bass") without getting unintentionally translated.

There is presently no way to change an equalizer preset's name (more on that).
There is presently no function to save equalizer presets to the configuration file.There is presently no function to add equalizer presets.There is presently no function to remove equalizer presets.There has been no attempt to add these changes to the macosx interface - I will deal with that once we get the rest working smoother.

As per the equalizer preset naming: Presently the way equalizer preset names are stored, their names are kept separate from their values/amps/bands.  This is primarily because it aided putting static equalizer presets into the configuration data - which require an array of strings. ( see change_string_list() )

Because of the way that change_string_list( preset_list, preset_list_text, 0 ) requires that no more strings can be added, nor can strings be shortened/lengthened, I am at a bit of a loss as to how I can make the preferences dialog accept a dynamic drop-down of presets that were added or modified during this session.

It is easy to change the values that would be associated with this list:
preset_list_text[i] corresponds with eqz_preset_10b[i]
^ ^ string ^ ^                            ^ ^ values ^ ^ 

The equalizer dialog itself in extended_panels.cpp can easily be told to use a different list (i.e. with our custom, dynamic names) but this doesn't escape the problem of having the preferences dialog load and stay with whatever is within preset_list_text .  As I see it, these lists cannot be changed during runtime in a thread safe manner.

I am also having trouble getting the functions in equalizer_presets.h into their own separate .c file (possibly equalizer.c), so that they can be called externally from parts like extended_modules.cpp in qt4's c++ code.  df__ and j-b have helped extensively on irc already, unfortunately we can't seem to get past this problem.
Again, any input appreciated!  I'm stubborn and will do this with or without help! xD

Dave Andrews

Internet explorer 8 lets you browse the web faster.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090515/93b84241/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: equalizer-presets.patch
Type: application/octet-stream
Size: 20215 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090515/93b84241/attachment.obj>

More information about the vlc-devel mailing list