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

Re: [sc-users] Using Refresh




Also I have tried using a text filed but the same problem occurs.

I think that's a better idea than using buttons to display number of channels.

But is this what you're after?:

b2.states_(f.numChannels-1);

I didn't try it, but it should work.

Also, I think you should take all unnecessary code out of the
CocoaDialog.getPaths, so consider defining the b2 button
somewhere else. (and the SoundFileView as well)

You shouldn't need refresh at all in this case.


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;};
                                     ));
                                )};