[vlc-commits] commit: fluidsynth: parse SysEx messages ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sat Apr 17 10:35:58 CEST 2010


vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Apr 16 21:49:44 2010 +0300| [238e0a2240f1703b7bb1ce355486d340e5005048] | committer: Rémi Denis-Courmont 

fluidsynth: parse SysEx messages
(cherry picked from commit 05fbe17a5bd6094781077ebf82708f41eefbe678)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=238e0a2240f1703b7bb1ce355486d340e5005048
---

 modules/codec/fluidsynth.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/modules/codec/fluidsynth.c b/modules/codec/fluidsynth.c
index 352c701..31719d0 100644
--- a/modules/codec/fluidsynth.c
+++ b/modules/codec/fluidsynth.c
@@ -186,11 +186,29 @@ static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
     if (p_block->i_buffer < 1)
         goto drop;
 
+    uint8_t event = p_block->p_buffer[0];
     uint8_t channel = p_block->p_buffer[0] & 0xf;
+    event &= 0xF0;
+
+    if (event == 0xF0)
+        switch (channel)
+        {
+            case 0:
+                if (p_block->p_buffer[p_block->i_buffer - 1] != 0xF7)
+                {
+            case 7:
+                    msg_Warn (p_dec, "fragmented SysEx not implemented");
+                    goto drop;
+                }
+                fluid_synth_sysex (p_sys->synth, (char *)p_block->p_buffer + 1,
+                                   p_block->i_buffer - 2, NULL, NULL, NULL, 0);
+                break;
+        }
+
     uint8_t p1 = (p_block->i_buffer > 1) ? (p_block->p_buffer[1] & 0x7f) : 0;
     uint8_t p2 = (p_block->i_buffer > 2) ? (p_block->p_buffer[2] & 0x7f) : 0;
 
-    switch (p_block->p_buffer[0] & 0xf0)
+    switch (event & 0xF0)
     {
         case 0x80:
             fluid_synth_noteoff (p_sys->synth, channel, p1);



More information about the vlc-commits mailing list