Chris@2: /* Performance Worm: Visualisation of Expressive Musical Performance Chris@2: Copyright (C) 2001, 2006 by Simon Dixon Chris@2: Chris@2: This program is free software; you can redistribute it and/or modify Chris@2: it under the terms of the GNU General Public License as published by Chris@2: the Free Software Foundation; either version 2 of the License, or Chris@2: (at your option) any later version. Chris@2: Chris@2: This program is distributed in the hope that it will be useful, Chris@2: but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@2: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@2: GNU General Public License for more details. Chris@2: Chris@2: You should have received a copy of the GNU General Public License along Chris@2: with this program (the file gpl.txt); if not, download it from Chris@2: http://www.gnu.org/licenses/gpl.txt or write to the Chris@2: Free Software Foundation, Inc., Chris@2: 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Chris@2: */ Chris@2: Chris@2: package at.ofai.music.worm; Chris@2: Chris@2: import at.ofai.music.util.Parameters; Chris@2: Chris@2: class WormSmoothDialog extends Parameters { Chris@2: Chris@2: static final long serialVersionUID = 0; Chris@2: Chris@2: public WormSmoothDialog (Worm w, WormFile wf) { Chris@2: super(w.theFrame, "Smoothing parameters"); Chris@2: setDouble("Before", 1); Chris@2: setDouble("After", 1); Chris@2: String[] labels = new String[]{"Tracks","Beats","Bars","Seconds"}; Chris@2: int[] levels = {WormFile.TRACK, WormFile.BEAT, WormFile.BAR, 0}; Chris@2: setChoice("Units", labels, 1); Chris@2: setVisible(true); Chris@2: try { Chris@2: double before = getDouble("Before"); Chris@2: double after = getDouble("After"); Chris@2: String smoothLevel = getChoice("Units"); Chris@2: int smoothIndex = 0; Chris@2: for (int i = 0; i < labels.length; i++) Chris@2: if (smoothLevel.equals(labels[i])) Chris@2: smoothIndex = i; Chris@2: if ((after > 0) && (before > 0)) Chris@2: wf.smooth(Worm.FULL_GAUSS, before, after, levels[smoothIndex]); Chris@2: else Chris@2: wf.smooth(Worm.NONE, 0, 0, 0); Chris@2: } catch (NumberFormatException e) {} Chris@2: } Chris@2: Chris@2: } // class WormSmoothDialog