// title: Load and play samples from GUI (Qt GUI only) // author: rukano // description: // Pretty simple GUI (button per sample) for loading samples into buffers and playing them from GUI buttons. // !!! Needs Qt GUI !!! (VLayout) // code: var make; var dialog = Dialog.openPanel({ |list| make.(list) }, nil, true); var win = Window("Sample Player 3000").front; var samples = (); var buttons = (); make = { |paths| { paths.do{ |path| [\loaded, path.basename].postln; samples[path] = Buffer.read(Server.default, path); s.sync; buttons[path] = Button() .states_([[path.basename]]) .action_{ samples[path].play }; }; win.layout = VLayout(*buttons.asArray); win.onClose_{ samples.do{ |buf| buf.close; buf.free }; }; }.fork(AppClock); };