Quantcast

Odd non-deterministic behavior getting synth info in command-line mode

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Odd non-deterministic behavior getting synth info in command-line mode

Ghopper21
Hi everyone --

I'm running into an odd problem trying to export Mixer info as a command-line process in a customized version of MuseScore I'm using to create data for a music visualization project. (I asked this question on IRC earlier this afternoon; asking again here in case it gets missed there.)

What my code does is get a pointer to the Fluid synth, and use fluid->get_num_channels() and fluid->get_channel_preset(int) to get the mixer info. This works as expected, giving the list of presets shown in the Mixer window.

However, it doesn't work as expected when running in command-line mode (which I need to process a large number of scores). What I do command-line mode is first make sure to load the synthesizer state into the synth, via synti->setState(score->synthesizerState()). (The scores have the loaded soundfonts saves in the score.)

Given the synth state is loaded from the score, the above calls to fluid->get_num_channels() and fluid->get_channel_preset(int) should work as they do in GUI mode. And indeed they do... sometimes.

I'm seeing non-deterministic behavior. Sometimes I get the preset info from fluid as expected, other times I get 0 as the number of presets. Same scores, different behavior across multiple runs.

So I'm suspecting some kind of race condition.

NOTE: I do remove the noSeq = true statement in musescore.cpp to make sure the synth is still created in batch mode -- normally it isn't.

My question: any tips or thoughts on what could be causing this non-deterministic batch mode behavior? Possible race conditions? Something to do with the initialization of fluid?

Thanks, Ien

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
ABL
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Odd non-deterministic behavior getting synth info in command-line mode

ABL
Hi.
Have you tried to run the executable under a memory check tool like, for example, Valgrind, AddressSanitizer, Dr. Memory (or whatever you prefer more)?
If there is an unitialized variable being used or a memory corruption, such a tool could help in pinning down the problem.

Ciao,
ABL
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Odd non-deterministic behavior getting synth info in command-line mode

Ghopper21
Hi ABL -

Thanks for the tip. I haven't done this and am not familiar with those tools -- will check them out.

Meanwhile, two further notes:

1. I realized I references fluid->get_num_channels() which is an addition by me -- it simply returned channel.size()

2. I have found a brute-force workaround to the problem -- sleep for 3 seconds before accessing the channel info -- this fixes the problem reliably as far as I can tell, again suggesting there is some kind of race condition.

--Ien

On Fri, May 6, 2016 at 8:44 AM, ABL <[hidden email]> wrote:
Hi.
Have you tried to run the executable under a memory check tool like, for
example, Valgrind, AddressSanitizer, Dr. Memory (or whatever you prefer
more)?
If there is an unitialized variable being used or a memory corruption, such
a tool could help in pinning down the problem.

Ciao,
ABL




--
View this message in context: http://dev-list.musescore.org/Odd-non-deterministic-behavior-getting-synth-info-in-command-line-mode-tp7579895p7579897.html
Sent from the MuseScore Developer mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Loading...