If you prefer memcmp(), or strncmp(), you can do it. The main part is done,
I'm not sure I have time to mess around more with it. I'm not sure if these
byteArrays would be used over and over multiple times to deserve a pre-defined
variable for each.
It's a first try for the volume calculation. With the default being 0.2, the
scale is already way-off to start with. If someone finds a better way to
calculate master-volume, go right ahead. I only want/need a way to adjust it,
as long as it's in there, everyone can use it however they want.
Jimmy
--- On Wed, 2/16/11, David Henningsson di...@ubuntu.com wrote:
From: David Henningsson di...@ubuntu.com
Subject: Re: [fluid-dev] Code patch for GM, GS, XG system-reset SysEx's,
and MasterVolume SysEx
To: jimmy wg20...@yahoo.com
Cc: fluid-dev@nongnu.org
Date: Wednesday, February 16, 2011, 5:39 AM
Hmm, seems this patch went through
unnoticed?
Well, I don't mind a maximum gain of 10, it seems like a
mistake if it's
5 in some places and 10 in others.
About master volume sysex, I'm a little hesitant if the
scale is right.
What's the default master volume according to the spec?
That should map
against our default volume of 0.2. There is also no reason
to ignore LSB.
About the GS/XG/GM sysex (what about GM2 reset, btw?) I
think the code
would look nicer if you did a memcmp() instead of matching
each
individual byte.
What do you think?
// David
On 2011-02-10 23:08, jimmy wrote:
Attached is a patch for 4 SysEx messages. This
allow Fluidsynth to automatically switch between GM, GS, XG
mode on the fly, without having to restart, that is.
Often a reset sysex is sent at beginning of a midi file,
but not always.
Sys-Ex reset messages:
myweb.tiscali.co.uk/mikesmusic/my_technical_articles2.html#sysex
1. GM Reset (understood by
every GM-compatible instrument)
Sys-Ex String: F0 7E 7F 09 01
F7
2. Roland GS Reset (Understood
by all Roland GS instruments)
Sys-Ex String: F0 41 10 42 12
40 00 7F 00 41 F7
3. Yamaha XG reset (Understood
by all Yamaha XG instruments)
Sys-Ex String: F0 43 10 4C 00
00 7E 00 F7
About master volume:
home.roadrunner.com/~jgglatt/tech/midispec/mastrvol.htm
Master Volume
SysEx: 0xF0 0x7F 0x7F 0x04 0x01 0xLL 0xMM
0xF7
where (0xLL=LSB, 0xMM=MSB), where 7F 7F is maximum
volume.
My patch ignores LSB (LSB=0), simply takes the MSB
(7-bit, max value 127) devide by 12.70 to get the range of
[0.0 - 10.0].
-
In adding SysEx handler for master volume adjustment
(gain in Fluidsynth), I found a few inconsitencies
regarding gain:
-g, --gain
Set the master gain [0 gain 10, default
= 0.2]
which sets fluidsynth settings of:
synth.gain FLOAT
[min=0.000, max=10.000, def=0.200] REALTIME
Master synthesizer gain.
While the fluidsynth command shell and manual page
have:
gain value
Set the master gain (0 gain 5)
but the shell-command handler fluid_handle_gain()
doesn't try to scale it in anyway to 10.0. Any reason
for that? Or, it's just an oversight (in previous
changes).
In this patch, I go ahead and change all references
regarding maximum gain from 5 to 10. Let me know if
those need to be left alone.
Jimmy
___
fluid-dev mailing list
fluid-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/fluid-dev
___
fluid-dev mailing list
fluid-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/fluid-dev