Csound Csound-dev Csound-tekno Search About

[CSOUND-DEV:3094] RE: CSound API with 4.23f07?

Date2003-09-16 14:33
From"gogins@pipeline.com"
Subject[CSOUND-DEV:3094] RE: CSound API with 4.23f07?
Please send me entire source files (as attachments), not patches, and I
will merge them with my sources in CVS. Or, if you plan to continue
developing with Csound, ask John Fitch, the administrator of the
SourceForge site, to make you a Csound developer (as I am) and then you can
commit these changes yourself. I would prefer that, actually.

I have no fix for the graphics because I did not want to deal with the
issues of incompatible windowing systems with the API. This facility may
well be different in csound5.



Original Message:
-----------------
From:  ramsdell@mitre.org (John D. Ramsdell)
Date: 16 Sep 2003 08:17:40 -0400
To: csound-dev@eartha.mills.edu, ramsdell@mitre.org
Subject: [CSOUND-DEV:3092] RE: CSound API with 4.23f07?


Michael,

Your advice appears to have solved my problem.  I carefully read the
makefile generated by Dev-C++ from csound.dev, and concluded the magic
trick is to use the -DSSOUND switch.

My current local copy of wxCSound links the GUI with CSound only
through the CSound API.  It compiles on both Linux using the usual set
of tools, and on Windows using MSYS and MinGW.  I immediately noticed
that the Windows version has a problem with displaying graphs, and who
knows what else might be wrong.  In any event, the Windows port is
once again progressing thanks to your help.

To make wxCSound work with the API, when building libcsound.a, I
specify

DEFS = -DSYS5 -DSSOUND -DWINDOWS -DHAVE_WX_WINDOWS -DSFIRCAM

after patching the sources as follows.

diff -urN csound-4.23f07/cs.h csound/cs.h
--- csound-4.23f07/cs.h	2003-09-02 12:50:42.000000000 -0400
+++ csound/cs.h	2003-09-16 06:42:16.000000000 -0400
@@ -817,7 +817,10 @@
 
 #include "text.h"
 
-#if defined CWIN
+#if defined HAVE_WX_WINDOWS
+  int csoundYield(void *csound);
+# define POLL_EVENTS() csoundYield(0)
+#elif defined CWIN
 #elif defined(mac_classic) || defined(SYMANTEC)
 # define POLL_EVENTS() STasks()
 # define __cdecl
@@ -839,6 +842,10 @@
 #define printf csoundMessage0
 extern void csoundMessage0(const char *, ...);
 extern void err_printf(char *, ...);
+#elif defined HAVE_WX_WINDOWS
+#define printf wxcsound_printf
+extern void wxcsound_printf(const char *, ...);
+extern void err_printf(char *, ...);
 #else
 #ifdef CWIN
 #include 
diff -urN csound-4.23f07/csound.c csound/csound.c
--- csound-4.23f07/csound.c	2003-09-02 12:50:42.000000000 -0400
+++ csound/csound.c	2003-09-16 06:42:16.000000000 -0400
@@ -611,6 +611,29 @@
     rtclose = rtclose__;
   }
 
+#if !defined RTAUDIO
+  void playopen_(int nchanls, int dsize, float sr, int scale)
+  {
+  }
+
+  void rtplay_(char *outBuf, int nbytes)
+  {
+  }
+
+  void recopen_(int nchanls, int dsize, float sr, int scale)
+  {
+  }
+
+  int rtrecord_(char *inBuf, int nbytes)
+  {
+    return 0;
+  }
+
+  void rtclose_(void)
+  {
+  }
+#endif
+
   /*
    * MIDI -- this code replaces the MIDIDevice.c file
    */
diff -urN csound-4.23f07/load_opcodes.c csound/load_opcodes.c
--- csound-4.23f07/load_opcodes.c	2003-09-02 12:50:43.000000000 -0400
+++ csound/load_opcodes.c	2003-09-16 06:42:16.000000000 -0400
@@ -156,5 +156,20 @@
 {
 	return 0;
 }
+
+#elif defined HAVE_WX_WINDOWS
+
+void *csoundOpenLibrary(const char *libraryPath)
+{
+	return 0;
+}
+void *csoundCloseLibrary(void *library)
+{
+   	return 0;
+}
+void *csoundGetLibrarySymbol(void *library, const char *procedureName)
+{
+	return 0;
+}
 #endif
 
diff -urN csound-4.23f07/main.c csound/main.c
--- csound-4.23f07/main.c	2003-09-02 12:50:43.000000000 -0400
+++ csound/main.c	2003-09-16 06:42:16.000000000 -0400
@@ -245,7 +245,7 @@
     }
 }
 
-void psignal(int sig, char *str)
+void psignal(int sig, const char *str)
 {
     err_printf( "%s: %s\n", str, signal_to_string(sig));
 }
diff -urN csound-4.23f07/mididevice.c csound/mididevice.c
--- csound-4.23f07/mididevice.c	2003-09-02 12:50:44.000000000 -0400
+++ csound/mididevice.c	2003-09-16 06:42:16.000000000 -0400
@@ -109,7 +109,7 @@
      static port_id gMidiInPort = B_ERROR;
 #elif defined(mac_classic)
 
-#elif !defined(DOSGCC) && !defined(__WATCOMC__)&& !defined(LATTICE) &&
!defined(WIN32) && !defined(SYMANTEC) && !defined(__EMX__)
+#elif !defined(DOSGCC) && !defined(__WATCOMC__)&& !defined(LATTICE) &&
!defined(WIN32) && !defined(SYMANTEC) && !defined(__EMX__) &&
!defined(HAVE_WX_WINDOWS)
 #    if defined(__MACH__)
 #      define USE_OLD_TTY 1
 #    endif
@@ -386,7 +386,7 @@
           }
       }
 # endif /* HAVE_BSD_SGTTY_H */
-#elif !defined(__BEOS__) && !defined(mac_classic)
+#elif !defined(__BEOS__) && !defined(mac_classic) &&
!defined(HAVE_WX_WINDOWS)
 # if !defined(DOSGCC) && !defined(__WATCOMC__) && !defined(LATTICE) &&
!defined(WIN32) && !defined(__EMX__)
       ioctl(rtfd, TIOCGETP, &tty);           /* for other machines      */
       tty.sg_ispeed = INBAUD;                /*   set baud rate         */

Does this seem reasonable?

John

PS.  By the way, here is a listing of the warnings generated by GCC.
Some of them appear to worth looking at.

sh-2.05b$ grep warning: /tmp/build.log
main.c:324: warning: argument `argc' might be clobbered by `longjmp' or
`vfork'
argdecode.c:727: warning: implicit declaration of function `dup'
argdecode.c:729: warning: implicit declaration of function `dup2'
musmon.c:235: warning: implicit declaration of function
`csoundIsExternalMidiEnabled'
musmon.c:237: warning: implicit declaration of function
`csoundExternalMidiOpen'
otran.c:844: warning: double format, float arg (arg 3)
oload.c:602: warning: `csetoffbas' might be used uninitialized in this
function
oload.c:606: warning: `chp' might be used uninitialized in this function
rdscor.c:71: warning: double format, float arg (arg 3)
hetro.c:551: warning: implicit declaration of function `write'
lpanal.c:615: warning: implicit declaration of function `write'
lpanal.c:776: warning: implicit declaration of function `close'
pvanal.c:272: warning: implicit declaration of function `write'
pvanal.c:289: warning: implicit declaration of function `close'
sndinfo.c:140: warning: implicit declaration of function `close'
sfheader.c:417: warning: implicit declaration of function `write'
sfheader.c:508: warning: implicit declaration of function `lseek'
soundin.c:150: warning: implicit declaration of function `read'
soundin.c:399: warning: implicit declaration of function `lseek'
soundin.c:414: warning: implicit declaration of function `close'
soundio.c:371: warning: `audwrt4' defined but not used
aiff.c:228: warning: implicit declaration of function `read'
wave.c:144: warning: implicit declaration of function `write'
wave.c:155: warning: implicit declaration of function `lseek'
wave.c:265: warning: implicit declaration of function `read'
memfiles.c:66: warning: implicit declaration of function `read'
memfiles.c:68: warning: implicit declaration of function `close'
auxfd.c:83: warning: implicit declaration of function `close'
dumpf.c:204: warning: implicit declaration of function `write'
dumpf.c:377: warning: implicit declaration of function `read'
dumpf.c:417: warning: implicit declaration of function `lseek'
dumpf.c:421: warning: double format, float arg (arg 3)
dumpf.c:438: warning: double format, float arg (arg 3)
cvanal.c:99: warning: double format, float arg (arg 3)
cvanal.c:112: warning: double format, float arg (arg 3)
cvanal.c:119: warning: double format, float arg (arg 3)
cvanal.c:158: warning: implicit declaration of function `write'
cvanal.c:167: warning: implicit declaration of function `close'
cvanal.c:279: warning: `PrintBuf' defined but not used
hrtferX.c:166: warning: unused variable `yr2'
hrtferX.c:166: warning: unused variable `yl2'
hrtferX.c:590: warning: unused variable `c1'
diskin.c:73: warning: implicit declaration of function `read'
diskin.c:239: warning: implicit declaration of function `close'
diskin.c:321: warning: implicit declaration of function `lseek'
diskin.c:1697: warning: implicit declaration of function `write'
aifc.c:150: warning: implicit declaration of function `write'
aifc.c:171: warning: implicit declaration of function `lseek'
aifc.c:219: warning: implicit declaration of function `read'
mxfft.c:186: warning: `k3' might be used uninitialized in this function
mxfft.c:193: warning: `c2' might be used uninitialized in this function
mxfft.c:193: warning: `c3' might be used uninitialized in this function
mxfft.c:196: warning: `s2' might be used uninitialized in this function
mxfft.c:196: warning: `s3' might be used uninitialized in this function
mxfft.c:29: warning: `rcsid' defined but not used
pvfileio.c:154: warning: implicit declaration of function `write'
pvfileio.c:285: warning: implicit declaration of function `read'
pvfileio.c:508: warning: implicit declaration of function `close'
pvfileio.c:853: warning: implicit declaration of function `lseek'
dnoise.c:306: warning: implicit declaration of function `dup'
dnoise.c:308: warning: implicit declaration of function `dup2'
dnoise.c:1185: warning: implicit declaration of function `close'
dnoise.c:1238: warning: implicit declaration of function `write'
dnoise.c:1243: warning: implicit declaration of function `lseek'
mididevice.c:486: warning: unused variable `n'
csound.c:140: warning: suggest parentheses around assignment used as truth
value
csound.c:155: warning: suggest parentheses around assignment used as truth
value
csound.c:171: warning: suggest parentheses around assignment used as truth
value
csound.c:214: warning: suggest parentheses around assignment used as truth
value
csound.c:211: warning: variable `done' might be clobbered by `longjmp' or
`vfork'
csound.c:733: warning: implicit declaration of function `MakeAscii'
csound.c:750: warning: implicit declaration of function `DrawAscii'
csound.c:767: warning: implicit declaration of function `KillAscii'
csound.c:876: warning: suggest parentheses around assignment used as truth
value
csound.c:879: warning: suggest parentheses around assignment used as truth
value
csound.c:888: warning: suggest parentheses around assignment used as truth
value
csound.c:891: warning: suggest parentheses around assignment used as truth
value
csound.c:201: warning: `_rtInputBufSize' defined but not used
csound.c:202: warning: `_rtInputBufIndex' defined but not used
dl_opcodes.c:51: warning: unused variable `size'
dl_opcodes.c:50: warning: unused variable `init'
dl_opcodes.c:48: warning: unused variable `error'
dl_opcodes.c:144: warning: label `next' defined but not used
dl_opcodes.c:74: warning: `opcodlst_n' might be used uninitialized in this
function
dl_opcodes.c:75: warning: `length' might be used uninitialized in this
function
dl_opcodes.c:75: warning: `olength' might be used uninitialized in this
function
makedb.c:104: warning: int format, long int arg (arg 3)
makedb.c:109: warning: int format, long int arg (arg 3)
makedb.c:109: warning: int format, long int arg (arg 4)
sh-2.05b$ 

"gogins@pipeline.com"  writes:

> Did you take a look at the csound.dev file in SourceForge CVS for csound?
> This is a Dev-C++ project file for a mingw build of the Csound API as a
> static library. The canonical makefile is not oriented in this direction
at
> all. You would need to download Dev-C++ to use this project file, from
> which Dev-C++ would generate the actual makefile.


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .