| Hi,
I'm looking in depth at the graph callbacks, and it seems to me they
should be working somewhat differently.
If I make a simple program (see zip attachment) that uses the API and
registers all the graphing callbacks:
csoundSetIsGraphable(csound, true);
csoundSetMakeGraphCallback(csound, &makeGraphCallback);
csoundSetDrawGraphCallback(csound, &drawGraphCallback);
csoundSetKillGraphCallback(csound, &killGraphCallback);
csoundSetExitGraphCallback(csound, &exitGraphCallback);
void makeGraphCallback(CSOUND *csound, WINDAT *windat, const char *name)
{
fprintf(stdout, "makeGraphCallback windat = %li\n", (long)windat);
}
void drawGraphCallback(CSOUND *csound, WINDAT *windat)
{
fprintf(stdout, "drawGraphCallback windat = %li\n", (long)windat);
}
void killGraphCallback(CSOUND *csound, WINDAT *windat)
{
fprintf(stdout, "killGraphCallback windat = %li\n", (long)windat);
}
int exitGraphCallback(CSOUND *csound)
{
fprintf(stdout, "exitGraphCallback\n");
}
When I run this csd:
sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1
instr 1
index init 0
rep:
tabw_i 0, index, 1
loop_lt index, 1, 1000, rep
endin
f 1 0 1024 10 1
f 2 0 1024 10 1 1 1
f 1 10 2048 10 1
i 1 5 1
i 1 15 1
e 30
I get the following:
SECTION 1:
ftable 1:
makeGraphCallback windat = -1073751876
drawGraphCallback windat = -1073751876
ftable 2:
makeGraphCallback windat = -1073751876
drawGraphCallback windat = -1073751876
B 0.000 .. 5.000 T 5.001 TT 5.001 M: 0.00000 0.00000
new alloc for instr 1:
B 5.000 .. 10.000 T 9.999 TT 9.999 M: 0.00000 0.00000
WARNING: replacing previous ftable 1
ftable 1:
makeGraphCallback windat = -1073751876
drawGraphCallback windat = -1073751876
B 10.000 .. 15.000 T 15.000 TT 15.000 M: 0.00000 0.00000
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score. overall amps: 0.00000 0.00000
overall samples out of range: 0 0
0 errors in performance
Elapsed time at end of performance: real: 30.216s, CPU: 0.480s
1292 4096-byte soundblks of shorts written to dac
exitGraphCallback
I personally would expect Csound to create new WINDAT structures for
each ftable, so that a graph can easily update its data just from the
windat pointers, this will also allow a graphing application to know
when an ftable is reused or it is a new one.
Also note that the killGraph callback seems never to be used...
The mechanism seems to be working correctly for graphs generated from
dispfft or display opcodes.
What do you think?
Cheers,
Andrés
|