hi list,
i've started learning C a few weeks ago. At the moment, i'm trying to write a waveform editor for pd, and up till now, i'm at a point where i'd need some advice from more experienced developers concerning my code.
The code is mainly based on B. Bogarts „popup“, the hslider- and the garray objects.
Here are my questions:
1. I'd like to output the selection start/end points as milliseconds. How can i get the samplerate of a soundfile? Right now, i'm simply using pd's system-samplerate for samples-to-milliseconds conversion .
2. When i change the appearance of the mouse cursor over a tk-item using <Enter> and <Leave>, how can i get back to use the normal pd mouse cursors after leaving again? (it stays in the appearance i use in the <Leave> command)
I think i have to make the <Leave> command use the current pd-mouse- state somehow.
3. What do i need to concern about when writing gui-objects for Graph- on-Parent use? At the present state, pd crashes when i try to open a subpatcher including my object as GOP (Memory Access Violation).
Also i'd be very grateful if anyone could have a look at the code and tell me, where it can be optimized, cause i'm not quite sure if i didn't express some parts pretty complicated.
source is here-> http://rcjackson.members.wekay.at/download/
Thanks for your help
Robert
here's a helpfile:
#N canvas 130 89 1024 524 10;
#X obj 710 239 soundfiler;
#X obj 241 218 waver sepp;
#X floatatom 241 409 5 0 0 0 - - -;
#X floatatom 534 408 5 0 0 0 - - -;
#X text 597 408 ms;
#X msg 241 152 mode $1;
#X msg 154 63 1;
#X msg 258 66 2;
#X msg 301 66 3;
#X floatatom 387 161 5 0 0 0 - - -;
#X floatatom 534 166 5 0 0 0 - - -;
#X obj 619 189 table foo;
#X obj 618 213 table bar;
#X msg 21 152 set foo;
#X msg 102 154 set bar;
#X obj 710 157 openpanel;
#X obj 710 121 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X msg 710 188 read -resize $1 foo;
#X msg 864 189 read -resize $1 bar;
#X obj 862 133 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 864 162 openpanel;
#X text 330 67 zoom;
#X text 252 45 select;
#X text 114 13 move selection;
#X text 112 27 (shift-drag changes loop size);
#X text 362 141 selection start;
#X text 498 143 selection end;
#X text 125 409 selection start;
#X text 431 408 selection end;
#X text 283 407 ms;
#X connect 1 0 2 0;
#X connect 1 1 3 0;
#X connect 5 0 1 0;
#X connect 6 0 5 0;
#X connect 7 0 5 0;
#X connect 8 0 5 0;
#X connect 9 0 1 1;
#X connect 10 0 1 2;
#X connect 13 0 1 0;
#X connect 14 0 1 0;
#X connect 15 0 17 0;
#X connect 16 0 15 0;
#X connect 17 0 0 0;
#X connect 18 0 0 0;
#X connect 19 0 20 0;
#X connect 20 0 18 0;