@@ -188,7 +188,7 @@ public void windowClosing(java.awt.event.WindowEvent e)
188
188
pack ();
189
189
setLocation (Helpers .getFrameCenteredLocation (this , getParent ()));
190
190
191
- fillWithInstrument ( null );
191
+ clearInstrument ( );
192
192
}
193
193
public void doClose ()
194
194
{
@@ -741,6 +741,7 @@ private JLabel getCheckDNALabel()
741
741
private JTextField getCheckDNA ()
742
742
{
743
743
if (checkDNA ==null )
744
+
744
745
{
745
746
checkDNA = new JTextField ();
746
747
checkDNA .setName ("checkDNA" );
@@ -1002,77 +1003,75 @@ private void clearInstrument()
1002
1003
getVolumeEnvelopePanel ().setEnvelope (null , EnvelopeType .volume );
1003
1004
getPanningEnvelopePanel ().setEnvelope (null , EnvelopeType .panning );
1004
1005
getPitchEnvelopePanel ().setEnvelope (null , EnvelopeType .pitch );
1006
+
1007
+ // after setting the new model, make the editor of the spinner un-editable
1008
+ ((DefaultEditor )getSelectInstrument ().getEditor ()).getTextField ().setEditable (false );
1005
1009
}
1006
1010
private void fillWithInstrument (Instrument newInstrument )
1007
1011
{
1008
- if (newInstrument ==null )
1012
+ getInstrumentName ().setText (newInstrument .name );
1013
+ getFileName ().setText (newInstrument .dosFileName );
1014
+
1015
+ getGlobalVolume ().setText (Integer .toString (newInstrument .globalVolume ));
1016
+ getFadeOutVolume ().setText (Integer .toString (newInstrument .volumeFadeOut ));
1017
+ getSetPan ().setFixedState (newInstrument .defaultPan !=-1 );
1018
+ getSetPanValue ().setText (Integer .toString (newInstrument .defaultPan ));
1019
+
1020
+ getPitchPanSep ().setText (Integer .toString (newInstrument .pitchPanSeparation ));
1021
+ getPitchPanCenter ().setText (ModConstants .getNoteNameForIndex (newInstrument .pitchPanCenter + 1 ));
1022
+
1023
+ if (newInstrument .initialFilterResonance !=-1 )
1009
1024
{
1010
- clearInstrument ();
1025
+ getSetResonance ().setFixedState ((newInstrument .initialFilterResonance &0x80 )!=0 );
1026
+ getResonanceValue ().setText (Integer .toString (newInstrument .initialFilterResonance &0x7F ));
1011
1027
}
1012
1028
else
1013
1029
{
1014
- spinnerModelData = new ArrayList <String >(instruments .length );
1015
- for (int i =0 ; i <instruments .length ; i ++) spinnerModelData .add (ModConstants .getAsHex (i +1 , 2 ));
1016
- getSelectInstrument ().setModel (new SpinnerListModel (spinnerModelData ));
1017
-
1018
- getInstrumentName ().setText (newInstrument .name );
1019
- getFileName ().setText (newInstrument .dosFileName );
1020
-
1021
- getGlobalVolume ().setText (Integer .toString (newInstrument .globalVolume ));
1022
- getFadeOutVolume ().setText (Integer .toString (newInstrument .volumeFadeOut ));
1023
- getSetPan ().setFixedState (newInstrument .defaultPan !=-1 );
1024
- getSetPanValue ().setText (Integer .toString (newInstrument .defaultPan ));
1025
-
1026
- getPitchPanSep ().setText (Integer .toString (newInstrument .pitchPanSeparation ));
1027
- getPitchPanCenter ().setText (ModConstants .getNoteNameForIndex (newInstrument .pitchPanCenter + 1 ));
1028
-
1029
- if (newInstrument .initialFilterResonance !=-1 )
1030
- {
1031
- getSetResonance ().setFixedState ((newInstrument .initialFilterResonance &0x80 )!=0 );
1032
- getResonanceValue ().setText (Integer .toString (newInstrument .initialFilterResonance &0x7F ));
1033
- }
1034
- else
1035
- {
1036
- getSetResonance ().setFixedState (false );
1037
- getResonanceValue ().setText ("-1" );
1038
- }
1039
- if (newInstrument .initialFilterCutoff !=-1 )
1040
- {
1041
- getSetCutOff ().setFixedState ((newInstrument .initialFilterCutoff &0x80 )!=0 );
1042
- getCutOffValue ().setText (Integer .toString (newInstrument .initialFilterCutoff &0x7F ));
1043
- }
1044
- else
1045
- {
1046
- getSetCutOff ().setFixedState (false );
1047
- getCutOffValue ().setText ("-1" );
1048
- }
1049
-
1050
- getVolumeVariation ().setText (Integer .toString (newInstrument .randomVolumeVariation ));
1051
- getPanningVariation ().setText (Integer .toString (newInstrument .randomPanningVariation ));
1052
- getResonanceVariation ().setText (Integer .toString (newInstrument .randomResonanceVariation ));
1053
- getCutOffVariation ().setText (Integer .toString (newInstrument .randomCutOffVariation ));
1054
-
1055
- getActionNNA ().setText (getNNAActionString (newInstrument .NNA ));
1056
- getCheckDNA ().setText (getDNACheckString (newInstrument .dublicateNoteCheck ));
1057
- getActionDNA ().setText (getDNAActionString (newInstrument .dublicateNoteAction ));
1058
-
1059
- getSampleMap ().setText (getSampleMapString (newInstrument .noteIndex , newInstrument .sampleIndex ));
1060
- getSampleMap ().select (0 ,0 );
1061
-
1062
- getVolumeEnvelopePanel ().setEnvelope (newInstrument .volumeEnvelope , EnvelopeType .volume );
1063
- getPanningEnvelopePanel ().setEnvelope (newInstrument .panningEnvelope , EnvelopeType .panning );
1064
- getPitchEnvelopePanel ().setEnvelope (newInstrument .pitchEnvelope , EnvelopeType .pitch );
1030
+ getSetResonance ().setFixedState (false );
1031
+ getResonanceValue ().setText ("-1" );
1065
1032
}
1066
-
1067
- // after setting the new model, make the editor of the spinner un-editable
1068
- ((DefaultEditor )getSelectInstrument ().getEditor ()).getTextField ().setEditable (false );
1033
+ if (newInstrument .initialFilterCutoff !=-1 )
1034
+ {
1035
+ getSetCutOff ().setFixedState ((newInstrument .initialFilterCutoff &0x80 )!=0 );
1036
+ getCutOffValue ().setText (Integer .toString (newInstrument .initialFilterCutoff &0x7F ));
1037
+ }
1038
+ else
1039
+ {
1040
+ getSetCutOff ().setFixedState (false );
1041
+ getCutOffValue ().setText ("-1" );
1042
+ }
1043
+
1044
+ getVolumeVariation ().setText (Integer .toString (newInstrument .randomVolumeVariation ));
1045
+ getPanningVariation ().setText (Integer .toString (newInstrument .randomPanningVariation ));
1046
+ getResonanceVariation ().setText (Integer .toString (newInstrument .randomResonanceVariation ));
1047
+ getCutOffVariation ().setText (Integer .toString (newInstrument .randomCutOffVariation ));
1048
+
1049
+ getActionNNA ().setText (getNNAActionString (newInstrument .NNA ));
1050
+ getCheckDNA ().setText (getDNACheckString (newInstrument .dublicateNoteCheck ));
1051
+ getActionDNA ().setText (getDNAActionString (newInstrument .dublicateNoteAction ));
1052
+
1053
+ getSampleMap ().setText (getSampleMapString (newInstrument .noteIndex , newInstrument .sampleIndex ));
1054
+ getSampleMap ().select (0 ,0 );
1055
+
1056
+ getVolumeEnvelopePanel ().setEnvelope (newInstrument .volumeEnvelope , EnvelopeType .volume );
1057
+ getPanningEnvelopePanel ().setEnvelope (newInstrument .panningEnvelope , EnvelopeType .panning );
1058
+ getPitchEnvelopePanel ().setEnvelope (newInstrument .pitchEnvelope , EnvelopeType .pitch );
1069
1059
}
1070
1060
public void fillWithInstrumentArray (final Instrument [] instruments )
1071
1061
{
1072
1062
this .instruments = instruments ;
1073
1063
if (instruments !=null )
1064
+ {
1065
+ spinnerModelData = new ArrayList <String >(instruments .length );
1066
+ for (int i =0 ; i <instruments .length ; i ++) spinnerModelData .add (ModConstants .getAsHex (i +1 , 2 ));
1067
+ getSelectInstrument ().setModel (new SpinnerListModel (spinnerModelData ));
1068
+
1074
1069
fillWithInstrument (instruments [0 ]);
1070
+
1071
+ // after setting the new model, make the editor of the spinner un-editable
1072
+ ((DefaultEditor )getSelectInstrument ().getEditor ()).getTextField ().setEditable (false );
1073
+ }
1075
1074
else
1076
- fillWithInstrument ( null );
1075
+ clearInstrument ( );
1077
1076
}
1078
1077
}
0 commit comments