# Hi,
# I'm trying to make an oscilloscope using FLTK, because the display
opcode works only on X11.
# I successfully made a very simple (sinusoidal waveform calculating)
plug-in opcode looking at the documentation: ugur2.c For this one, I
have only one question. When I compiled it and made it a .so file and
called its opcode from Csound etc. it said that "incompatible opcode"
I understand that this is because of MYFLT is default a float and my
Csound version is double. I added a line in the ugur2.c file "#define
MYFLT double" to handle the situation, it works but I get always a
warning which says MYFLT was defined twice. (It is defined in
csound.h) How can I say to compiler that MYFLT is double without
defining it twice.
# I do not know the cause of my second question. I added some FLTK
code for creating an FLTK window, which is the first example in
the FLTK documentation. (same file with additional code from FTLK
example: ugur4.cpp) But I do not know whether I made it correct.
# The file compiled without errors. I copied the .so file under
plugins64 folder but Csound gave this warning:
WARNING: could not open library '/usr/lib/csound/plugins64/ugur4.so'
(/usr/lib/csound/plugins64/ugur4.so: undefined symbol: _Znwj)
# What may be the reason of this warning?
# My system is Ubuntustudio 8.04 and csound 5.08 double version.
# Thanks in advance!
-ugur guney-
Send bugs reports to this list.
To unsubscribe, send email
sympa@... with body "unsubscribe csound"
[ugur2.c]
#include "csound/csdl.h"
#include <math.h>
#define MYFLT double
typedef struct _newsaw {
OPDS h;
MYFLT *asaw;/* output pointer */
MYFLT *ifreq; /* input pointers */
long time;
} newsaw;
int newsaw_init(CSOUND *csound, newsaw *p){
p->time = 0;
return OK;
}
int newsaw_process(CSOUND *csound, newsaw *p){
int i;
int n = csound->ksmps;
MYFLT *out = p->asaw;
MYFLT freq = *p->ifreq;
for(i=0; i<n; i++) {
out[i] = sin(2*3.1415*freq*(p->time)/44100.0);
p->time = p->time+1;
}
return OK;
}
static OENTRY localops[] = {
{"newsaw", sizeof(newsaw), 5, "a", "i", (SUBR)newsaw_init, NULL, (SUBR)newsaw_process}
};
LINKAGE
[ugur4.cpp]
#include "csound/csdl.h"
#include <math.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
#define MYFLT double
typedef struct _newsaw {
OPDS h;
MYFLT *asin;/* output pointer */
MYFLT *ifreq; /* input pointers */
long time;
} newsin;
int newsin_init(CSOUND *csound, newsin *p){
Fl_Window *window = new Fl_Window(300,180);
Fl_Box *box = new Fl_Box(20,40,260,100,"Hello, World!");
box->box(FL_UP_BOX);
box->labelsize(36);
box->labelfont(FL_BOLD+FL_ITALIC);
box->labeltype(FL_SHADOW_LABEL);
window->end();
window->show();
Fl::run();
p->time = 0;
return OK;
}
int newsin_process(CSOUND *csound, newsin *p){
int i;
int n = csound->ksmps;
MYFLT *out = p->asin;
MYFLT freq = *p->ifreq;
for(i=0; i<n; i++) {
out[i] = sin(2*3.1415*freq*(p->time)/44100.0);
p->time = p->time+1;
}
return OK;
}
static OENTRY localops[] = {
{"newsin", sizeof(newsin), 5, "a", "i", (SUBR)newsin_init, NULL, (SUBR)newsin_process}
};
LINKAGE