Commit 9819d02c authored by Gregor Pintar's avatar Gregor Pintar

Additional resistors added to low/high pass filter, warning when opening...

Additional resistors added to low/high pass filter, warning when opening project created with newer version, formatting fixed on "SPL at 2.83V/1m (dB)" field
parent 39649acf
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>SpeakerSim</groupId>
<artifactId>SpeakerSim</artifactId>
<version>2019-04-02</version>
<version>2019-04-04</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
......
resources/HighPassFilter.png

4.44 KB | W: | H:

resources/HighPassFilter.png

5.37 KB | W: | H:

resources/HighPassFilter.png
resources/HighPassFilter.png
resources/HighPassFilter.png
resources/HighPassFilter.png
  • 2-up
  • Swipe
  • Onion skin
resources/LowPassFilter.png

4.23 KB | W: | H:

resources/LowPassFilter.png

5.38 KB | W: | H:

resources/LowPassFilter.png
resources/LowPassFilter.png
resources/LowPassFilter.png
resources/LowPassFilter.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -1159,7 +1159,7 @@
<Component class="javax.swing.JFormattedTextField" name="SPL_2_83VField">
<Properties>
<Property name="formatterFactory" type="javax.swing.JFormattedTextField$AbstractFormatterFactory" editor="org.netbeans.modules.form.editors.AbstractFormatterFactoryEditor">
<Format format="#0" subtype="-1" type="0"/>
<Format format="#.###" subtype="-1" type="0"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Reference sound pressure level at 2.83V/1m"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
......
......@@ -1451,7 +1451,7 @@ public class DriverWindow extends javax.swing.JDialog
gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END;
propertiesPanel.add(lblZMA, gridBagConstraints);
SPL_2_83VField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
SPL_2_83VField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#.###"))));
SPL_2_83VField.setToolTipText("Reference sound pressure level at 2.83V/1m");
SPL_2_83VField.setMinimumSize(new java.awt.Dimension(80, 19));
SPL_2_83VField.setPreferredSize(new java.awt.Dimension(80, 19));
......
......@@ -44,8 +44,6 @@ public class MainWindow extends javax.swing.JFrame
public MainWindow(String arg) throws IOException
{
setTitle("SpeakerSim (" + Project.currentVersion() + ")");
URL iconURL = getClass().getClassLoader().getResource("SpeakerSim.png");
setIconImage(new ImageIcon(iconURL).getImage());
......@@ -54,6 +52,8 @@ public class MainWindow extends javax.swing.JFrame
file = new File(arg);
project = new Project(file);
versionCheck();
setTitle("SpeakerSim - " + file.getName() + " (" + Project.currentVersion() + " Beta)");
}
else
......@@ -269,6 +269,14 @@ public class MainWindow extends javax.swing.JFrame
});
}
private void versionCheck()
{
if (project.Version.compareTo(Project.currentVersion()) > 0)
{
UI.warning("Project file was created with newer version. It may not work correctly!");
}
}
private IItem getSelectedItem()
{
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
......@@ -2120,11 +2128,12 @@ public class MainWindow extends javax.swing.JFrame
if (fc.showOpenDialog(this) == FileSelector.APPROVE_OPTION)
{
file = fc.getSelectedFile();
setTitle("SpeakerSim - " + file.getName() + " (" + Project.currentVersion() + ")");
project = new Project(file);
versionCheck();
load();
setTitle("SpeakerSim - " + file.getName() + " (" + Project.currentVersion() + ")");
}
}
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -28,7 +28,6 @@ import javax.swing.filechooser.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.*;
import java.text.*;
public final class UI
{
......@@ -218,6 +217,11 @@ public final class UI
}
}
public static void warning(String message)
{
JOptionPane.showMessageDialog(null, message, "Warning", JOptionPane.WARNING_MESSAGE);
}
public static void error(String message)
{
JOptionPane.showMessageDialog(null, message, "Error", JOptionPane.ERROR_MESSAGE);
......
......@@ -27,10 +27,12 @@ public abstract class PassFilter extends Filter
public double C1;
public double C2;
public double RC1;
public double RC2;
public double L1;
public double L2;
public double R1;
public double R2;
public double RL1;
public double RL2;
public final static String[] TYPES =
{
......@@ -88,22 +90,22 @@ public abstract class PassFilter extends Filter
protected Complex zC1(double f)
{
return Fnc.zC(C1, f);
return Fnc.zC(C1, f).add(RC1);
}
protected Complex zC2(double f)
{
return Fnc.zC(C2, f);
return Fnc.zC(C2, f).add(RC2);
}
protected Complex zL1(double f)
{
return Fnc.zL(L1, f).add(R1);
return Fnc.zL(L1, f).add(RL1);
}
protected Complex zL2(double f)
{
return Fnc.zL(L2, f).add(R2);
return Fnc.zL(L2, f).add(RL2);
}
public PassFilter()
......@@ -128,8 +130,11 @@ public abstract class PassFilter extends Filter
L2 = JSON.getDouble(jsonObj, "L2");
}
R1 = JSON.getDouble(jsonObj, "R1");
R2 = JSON.getDouble(jsonObj, "R2");
RC1 = JSON.getDouble(jsonObj, "RC1");
RC2 = JSON.getDouble(jsonObj, "RC2");
RL1 = JSON.getDouble(jsonObj, "RL1", JSON.getDouble(jsonObj, "R1"));
RL2 = JSON.getDouble(jsonObj, "RL2", JSON.getDouble(jsonObj, "R2"));
super.fromJSON(json);
}
......@@ -240,8 +245,11 @@ public abstract class PassFilter extends Filter
JSON.add(json, "L2", L2);
}
JSON.add(json, "R1", R1);
JSON.add(json, "R2", R2);
JSON.add(json, "RC1", RC1);
JSON.add(json, "RC2", RC2);
JSON.add(json, "RL1", RL1);
JSON.add(json, "RL2", RL2);
json.add("Children", Item.childrenToJSON(children));
return json;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment