aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/jsyn/swing/InstrumentBrowser.java13
-rw-r--r--src/com/jsyn/unitgen/FilterFourPoles.java2
-rw-r--r--src/com/jsyn/unitgen/SawtoothOscillatorDPW.java4
3 files changed, 9 insertions, 10 deletions
diff --git a/src/com/jsyn/swing/InstrumentBrowser.java b/src/com/jsyn/swing/InstrumentBrowser.java
index 70328bf..55575a3 100644
--- a/src/com/jsyn/swing/InstrumentBrowser.java
+++ b/src/com/jsyn/swing/InstrumentBrowser.java
@@ -39,7 +39,6 @@ import com.jsyn.util.VoiceDescription;
@SuppressWarnings("serial")
public class InstrumentBrowser extends JPanel {
private InstrumentLibrary library;
- private JList instrumentList;
private JScrollPane listScroller2;
private VoiceDescription voiceDescription;
private ArrayList<PresetSelectionListener> listeners = new ArrayList<PresetSelectionListener>();
@@ -49,7 +48,8 @@ public class InstrumentBrowser extends JPanel {
JPanel horizontalPanel = new JPanel();
horizontalPanel.setLayout(new GridLayout(1, 2));
- instrumentList = createList(library.getVoiceDescriptions());
+ final JList<VoiceDescription> instrumentList = new JList<VoiceDescription>(library.getVoiceDescriptions());
+ setupList(instrumentList);
instrumentList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
@@ -66,7 +66,7 @@ public class InstrumentBrowser extends JPanel {
listScroller1.setPreferredSize(new Dimension(250, 120));
add(listScroller1);
- showPresetList(0);
+ instrumentList.setSelectedIndex(0);
}
public void addPresetSelectionListener(PresetSelectionListener listener) {
@@ -88,7 +88,8 @@ public class InstrumentBrowser extends JPanel {
remove(listScroller2);
}
voiceDescription = library.getVoiceDescriptions()[n];
- final JList presetList = createList(voiceDescription.getPresetNames());
+ final JList<String> presetList = new JList<String>(voiceDescription.getPresetNames());
+ setupList(presetList);
presetList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
@@ -108,11 +109,9 @@ public class InstrumentBrowser extends JPanel {
validate();
}
- private JList createList(Object[] data) {
- JList list = new JList(data);
+ private void setupList(@SuppressWarnings("rawtypes") JList list) {
list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
list.setLayoutOrientation(JList.VERTICAL);
list.setVisibleRowCount(-1);
- return list;
}
}
diff --git a/src/com/jsyn/unitgen/FilterFourPoles.java b/src/com/jsyn/unitgen/FilterFourPoles.java
index 5ad6487..d4f80f4 100644
--- a/src/com/jsyn/unitgen/FilterFourPoles.java
+++ b/src/com/jsyn/unitgen/FilterFourPoles.java
@@ -34,7 +34,7 @@ public class FilterFourPoles extends TunableFilter {
public UnitInputPort Q;
public UnitInputPort gain;
- private static final double MINIMUM_FREQUENCY = 0.00001;
+ private static final double MINIMUM_FREQUENCY = 1.0; // blows up if near 0.01
private static final double MINIMUM_Q = 0.00001;
private double x1;
diff --git a/src/com/jsyn/unitgen/SawtoothOscillatorDPW.java b/src/com/jsyn/unitgen/SawtoothOscillatorDPW.java
index 92d36d8..6868c15 100644
--- a/src/com/jsyn/unitgen/SawtoothOscillatorDPW.java
+++ b/src/com/jsyn/unitgen/SawtoothOscillatorDPW.java
@@ -17,8 +17,8 @@
package com.jsyn.unitgen;
/**
- * Sawtooth DPW oscillator (a sawtooth with reduced aliasing). Based on a paper by Antti Huovilainen
- * and Vesa Valimaki:
+ * Sawtooth DPW oscillator (a sawtooth with reduced aliasing).
+ * Based on a paper by Antti Huovilainen and Vesa Valimaki:
* http://www.scribd.com/doc/33863143/New-Approaches-to-Digital-Subtractive-Synthesis
*
* @author Phil Burk and Lisa Tolentino (C) 2009 Mobileer Inc