mediactrl.Load always gives False

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 313
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: mediactrl.Load always gives False

Post by New Pagodi » Thu Nov 14, 2019 11:55 pm

doublemax wrote:
Thu Nov 14, 2019 11:26 pm
I haven't tried it with soundfonts, but usually you can pass the same command line options to libvlc that you can pass to the VLC exe. (In the call to libvlc_new).

https://wiki.videolan.org/VLC_command-line_help

Code: Select all

--soundfont=<string>       SoundFont file
For some reason, that doesn't seem to work. What I did get to work, was calling config_PutPsz like so:

Code: Select all

config_PutPsz((vlc_object_t*)vlc_inst,"soundfont","path/to/soundfont.sf2");
However the libvlc headers seem to be a little unorganized and this leads to a little extra compilcation. config_PutPsz is defined in vlc_configuration.h which requires vlc_common.h. On linux or mac it should be sufficient to include those 2 headers.

Bu on windows there's a slight problem. Those headers refer to a poll function that only exists on unix style systems and isn't declared in any windows header. In the vlc sources, it appears they work around this by declaring the function for windows in the file vlc_fixups.h. But that file is not a part of the headers that are come with the libvlc sdk. Googling shows it's been pointed out at least a few times, but they don't seem to be interested in fixing it.

To get around this, I borrowed the declaration from vlc_fixups.h and pasted it into another file I named pollshim.h:

Code: Select all

#ifndef POLLSHIM_H_INCLUDED
#define POLLSHIM_H_INCLUDED

#ifdef __WXMSW__
struct pollfd;
int poll (struct pollfd *, unsigned, int);
#endif

#endif // POLLSHIM_H_INCLUDED
And then the includes that need to be added to use the config_PutPsz function need to be in exactly this order:

Code: Select all

#include "pollshim.h"
#include <vlc/plugins/vlc_common.h>
#include <vlc/plugins/vlc_configuration.h>
Super ugly, but it seems to work. Like I said, I think this is probably a better cross platform solution since this way the user isn't at the mercy of which media types to OS decides to support.

jon.warbrick
In need of some credit
In need of some credit
Posts: 6
Joined: Mon Nov 04, 2019 11:01 am

Re: mediactrl.Load always gives False

Post by jon.warbrick » Fri Nov 15, 2019 9:29 am

Thanks for the VLC suggestion, I hadn't thought of that. Another possibility is FluidSynth. As you say, both also require sourcing and configuring a suitable SoundFront file. I expect I'll go down one of those routes, though the loss of native MIDI support in wxWidgets on Macos would be a shame.

Post Reply