gap-dev-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gap-dev-discuss] Fixing Cynthiune Timidity Bundle


From: Sebastian Reitenbach
Subject: [Gap-dev-discuss] Fixing Cynthiune Timidity Bundle
Date: Sun, 13 May 2012 15:12:05 +0200
User-agent: SOGoMail 1.3.14

Hi,

I thought I test some more file types, and chose a MIDI file. 
First, I recognized, when having the Timidity bundles installed, 
but not timidity itself, Cynthiune will crash weirdly, when you try
to add a .mid file to the playlist.

Then I found it still crashing, looking at the Timidity.m, I found the 
path to timidity hardcoded to /usr/bin/timidity. But on OpenBSD, its
installed in /usr/local/bin. So changed that #define to not being
a full qualified path. That enabled me to add a .mid file to the 
playlist.

Then trying to play that .mid file, Cynthiune crashed again :(
Looking closer, I found the Timidity Bundle was trying to copy a buffer
of size 65535 into a smaller buffer of DEFAULT_BUFFER_SIZE.
Therefore #import <Cynthiune/Output.h> and use the DEFAULT_BUFFER_SIZE.

Now Cynthiune happily plays the .mid file for me on i386.

Since cynthiune crashes, when no timidity binary is found, do we 
maybe want to disable Timidity plugin by default?

Or, I know there is a method to find a binary in $PATH, which in turn
returns the full qualified file name. Maybe we could check in -init 
if the timidity binary can be found along the path, and if not, return nil
in -init?

Sebastian

Index: Timidity.m
===================================================================
RCS file: /sources/gap/gap/user-apps/Cynthiune/Bundles/Timidity/Timidity.m,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Timidity.m
--- Timidity.m  25 Mar 2012 07:48:23 -0000      1.1.1.1
+++ Timidity.m  13 May 2012 12:59:48 -0000
@@ -24,13 +24,14 @@
 
 #import <Cynthiune/CynthiuneBundle.h>
 #import <Cynthiune/Format.h>
+#import <Cynthiune/Output.h>
 #import <Cynthiune/utils.h>
 
 #import "Timidity.h"
 
 #define LOCALIZED(X) _b ([Timidity class], X)
 
-#define timidity "/usr/bin/timidity"
+#define timidity "timidity"
 #define rate 22050
 
 @implementation Timidity : NSObject
@@ -175,7 +176,7 @@
   NSData *bytes;
   int size;
 
-  bytes = [in readDataOfLength: 65536];
+  bytes = [in readDataOfLength: DEFAULT_BUFFER_SIZE];
   if (bytes)
     {
       size = [bytes length];



reply via email to

[Prev in Thread] Current Thread [Next in Thread]