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

[sc-users] Using Refresh



Hi everyone,

Im suffering from one of those niggly little GUI issues that 
keeps you from having your patch working exactly the way you'd like it,
so if anyone could help me out on this issue it'd be wonderful!
The problem is that I have a button with two states, 
if I load a soundfile that is mono this button displays "mono",
 "stereo" if I load stereo. The thing is that when I load a second 
soundfile it does not refresh and display th correct state. 
The button is only displayed when another 
button which opens a cocoa dialog screen loads a file, 
could there be an issue here with where I need to call refresh? 
Also I have tried using a text filed but the same problem occurs.
As well as this when I open a sound file its wavefrom gets displayed,
this does not refresh either.
 I know this might be quite a low-level question but any help would be 
great.
Here's how Im tryin it at the moment:

b.action = { if (b.value ==1,                            
                  (CocoaDialog.getPaths({arg paths;         
                      paths.do({arg b,;
                        Buffer.read(s,b,bufnum:0);
                       "No. Of Channels:".postln;
                        f = SoundFile.new;
                         f.openRead(b);
                          f.numChannels.postln;                                 
                       a = SCSoundFileView.new(w, Rect(100,280,345, 60));   
                         a.soundfile = f;
                           a.read(0, f.numFrames);
                             a.drawsWaveForm = true;
                       w.refresh;
                       b2 = SCButton(w,Rect(13.5,65,70,20));       
                         b2.font = Font("Courier", 14);
                          b2.states = [ 
                                                ["Mono",Color.red(0.62,1),Color.clear],
                                                ["Stereo",Color.red(0.62,1),Color.clear] 
                                               ];   
                               b11.valueAction = f.numChannels - 1;
                                  b2.refreshl
                                              });},
                              {"cancelled".postln;};
                                     ));
                                )};

thanks
Daithi