Skip to content

Commit 552388c

Browse files
committed
BugFix 3.3
1 parent 1b10327 commit 552388c

21 files changed

+1791
-149
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8

bin/.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
/de/
2-
/gpl-3.0.txt

bin/gpl-3.0.txt

+674
Large diffs are not rendered by default.

source/de/quippy/javamod/multimedia/MultimediaContainer.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public MultimediaContainer()
5454
*/
5555
public MultimediaContainer getInstance(URL url)
5656
{
57-
this.fileURL = url;
57+
setFileURL(url);
5858
return this;
5959
}
6060
/**
@@ -65,6 +65,14 @@ public URL getFileURL()
6565
{
6666
return fileURL;
6767
}
68+
/**
69+
* @since 19.12.2022
70+
* @param url
71+
*/
72+
public void setFileURL(URL url)
73+
{
74+
this.fileURL = url;
75+
}
6876
/**
6977
* @since 23.12.2010
7078
* @return a printable version of the URL

source/de/quippy/javamod/multimedia/MultimediaContainerManager.java

+17-1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@ public static MultimediaContainer getMultimediaContainerSingleton(URL url) throw
163163

164164
return baseContainer;
165165
}
166+
/**
167+
* Will use getMultimediaContainerSingleton to retrieve the basic singleton
168+
* and then create an instance by getInstance on that singleton
169+
* This will also update the Info-Panels, if getInstance is overridden
170+
* @since 19.12.2022
171+
* @param url
172+
* @return
173+
* @throws UnsupportedAudioFileException
174+
*/
166175
public static MultimediaContainer getMultimediaContainer(URL url) throws UnsupportedAudioFileException
167176
{
168177
MultimediaContainer baseContainer = getMultimediaContainerSingleton(url);
@@ -228,8 +237,15 @@ public static String getSongNameFromFile(File fileName)
228237
try
229238
{
230239
MultimediaContainer container = getMultimediaContainerSingleton(url);
231-
if (container!=null)
240+
if (container!=null)
241+
{
242+
// The container needs to know the URL if
243+
// MultimediaContainer::getSongNameFromURL is used
244+
// Typically we would use "getInstance" for that, but
245+
// that will update the infodialogs also
246+
container.setFileURL(url);
232247
return container.getSongInfosFor(url);
248+
}
233249
}
234250
catch (UnsupportedAudioFileException ex)
235251
{

source/de/quippy/javamod/multimedia/mod/ModInfoPanel.java

+39-25
Original file line numberDiff line numberDiff line change
@@ -328,31 +328,45 @@ private JTextField getModInfo_Trackername()
328328
}
329329
return modInfo_Trackername;
330330
}
331-
public void fillInfoPanelWith(Module currentMod)
331+
public void fillInfoPanelWith(final Module currentMod)
332332
{
333-
String modFileName = currentMod.getFileName();
334-
int i = modFileName.lastIndexOf(File.separatorChar);
335-
if (i==-1) i= modFileName.lastIndexOf('/');
336-
getModInfo_Filename().setText(modFileName.substring(i+1));
337-
getModInfo_Filename().select(0, 0);
338-
getModInfo_Modname().setText(currentMod.getSongName());
339-
getModInfo_Modname().select(0, 0);
340-
getModInfo_Trackername().setText(currentMod.toShortInfoString());
341-
getModInfo_Trackername().select(0, 0);
342-
StringBuilder songInfos = new StringBuilder();
343-
String songMessage = currentMod.getSongMessage();
344-
if (songMessage!=null && songMessage.length()>0) songInfos.append("Song Message:\n").append(songMessage).append("\n\n");
345-
songInfos.append(currentMod.getInstrumentContainer().toString());
346-
getModInfo_Instruments().setText(songInfos.toString());
347-
getModInfo_Instruments().select(0, 0);
348-
349-
// Only do this, if we have a parent dialog. If not, these dialogs will never
350-
// get destroyed (and will never be visible anyways...)
351-
if (parent!=null)
352-
{
353-
getModPatternDialog().fillWithPatternArray(currentMod.getSongLength(), currentMod.getArrangement(), currentMod.getPatternContainer().getPattern());
354-
getModSampleDialog().fillWithSamples(currentMod.getInstrumentContainer().getSamples());
355-
getModInstrumentDialog().fillWithInstrumentArray(currentMod.getInstrumentContainer().getInstruments());
356-
}
333+
if (currentMod==null)
334+
{
335+
getModInfo_Filename().setText(Helpers.EMPTY_STING);
336+
getModInfo_Modname().setText(Helpers.EMPTY_STING);
337+
getModInfo_Trackername().setText(Helpers.EMPTY_STING);
338+
getModInfo_Instruments().setText(Helpers.EMPTY_STING);
339+
}
340+
else
341+
{
342+
String modFileName = currentMod.getFileName();
343+
int i = modFileName.lastIndexOf(File.separatorChar);
344+
if (i==-1) i= modFileName.lastIndexOf('/');
345+
getModInfo_Filename().setText(modFileName.substring(i+1));
346+
getModInfo_Filename().select(0, 0);
347+
getModInfo_Modname().setText(currentMod.getSongName());
348+
getModInfo_Modname().select(0, 0);
349+
getModInfo_Trackername().setText(currentMod.toShortInfoString());
350+
getModInfo_Trackername().select(0, 0);
351+
StringBuilder songInfos = new StringBuilder();
352+
String songMessage = currentMod.getSongMessage();
353+
if (songMessage!=null && songMessage.length()>0) songInfos.append("Song Message:\n").append(songMessage).append("\n\nInstrument Names:\n");
354+
if (currentMod.getInstrumentContainer()!=null)
355+
songInfos.append(currentMod.getInstrumentContainer().toString());
356+
getModInfo_Instruments().setText(songInfos.toString());
357+
getModInfo_Instruments().select(0, 0);
358+
359+
// Only do this, if we have a parent dialog. If not, these dialogs will never
360+
// get destroyed (and will never be visible anyways...)
361+
if (parent!=null)
362+
{
363+
if (currentMod.getPatternContainer()!=null) getModPatternDialog().fillWithPatternArray(currentMod.getSongLength(), currentMod.getArrangement(), currentMod.getPatternContainer().getPattern());
364+
if (currentMod.getInstrumentContainer()!=null)
365+
{
366+
getModSampleDialog().fillWithSamples(currentMod.getInstrumentContainer().getSamples());
367+
getModInstrumentDialog().fillWithInstrumentArray(currentMod.getInstrumentContainer().getInstruments());
368+
}
369+
}
370+
}
357371
}
358372
}

source/de/quippy/javamod/multimedia/mod/gui/ModInstrumentDialog.java

+50-43
Original file line numberDiff line numberDiff line change
@@ -930,53 +930,60 @@ private void clearInstrument()
930930
}
931931
private void fillWithInstrument(Instrument instrument)
932932
{
933-
getInstrumentName().setText(instrument.name);
934-
getFileName().setText(instrument.dosFileName);
935-
936-
getGlobalVolume().setText(Integer.toString(instrument.globalVolume));
937-
getFadeOutVolume().setText(Integer.toString(instrument.volumeFadeOut));
938-
getSetPan().setFixedState(instrument.defaultPan!=-1);
939-
getSetPanValue().setText(Integer.toString(instrument.defaultPan));
940-
941-
getPitchPanSep().setText(Integer.toString(instrument.pitchPanSeparation));
942-
getPitchPanCenter().setText(ModConstants.getNoteNameForIndex(instrument.pitchPanCenter + 1));
943-
944-
if (instrument.initialFilterResonance!=-1)
945-
{
946-
getSetResonance().setFixedState((instrument.initialFilterResonance&0x80)!=0);
947-
getResonanceValue().setText(Integer.toString(instrument.initialFilterResonance&0x7F));
948-
}
949-
else
950-
{
951-
getSetResonance().setFixedState(false);
952-
getResonanceValue().setText("-1");
953-
}
954-
if (instrument.initialFilterCutoff!=-1)
933+
if (instrument==null)
955934
{
956-
getSetCutOff().setFixedState((instrument.initialFilterCutoff&0x80)!=0);
957-
getCutOffValue().setText(Integer.toString(instrument.initialFilterCutoff&0x7F));
935+
clearInstrument();
958936
}
959937
else
960938
{
961-
getSetCutOff().setFixedState(false);
962-
getCutOffValue().setText("-1");
939+
getInstrumentName().setText(instrument.name);
940+
getFileName().setText(instrument.dosFileName);
941+
942+
getGlobalVolume().setText(Integer.toString(instrument.globalVolume));
943+
getFadeOutVolume().setText(Integer.toString(instrument.volumeFadeOut));
944+
getSetPan().setFixedState(instrument.defaultPan!=-1);
945+
getSetPanValue().setText(Integer.toString(instrument.defaultPan));
946+
947+
getPitchPanSep().setText(Integer.toString(instrument.pitchPanSeparation));
948+
getPitchPanCenter().setText(ModConstants.getNoteNameForIndex(instrument.pitchPanCenter + 1));
949+
950+
if (instrument.initialFilterResonance!=-1)
951+
{
952+
getSetResonance().setFixedState((instrument.initialFilterResonance&0x80)!=0);
953+
getResonanceValue().setText(Integer.toString(instrument.initialFilterResonance&0x7F));
954+
}
955+
else
956+
{
957+
getSetResonance().setFixedState(false);
958+
getResonanceValue().setText("-1");
959+
}
960+
if (instrument.initialFilterCutoff!=-1)
961+
{
962+
getSetCutOff().setFixedState((instrument.initialFilterCutoff&0x80)!=0);
963+
getCutOffValue().setText(Integer.toString(instrument.initialFilterCutoff&0x7F));
964+
}
965+
else
966+
{
967+
getSetCutOff().setFixedState(false);
968+
getCutOffValue().setText("-1");
969+
}
970+
971+
getVolumeVariation().setText(Integer.toString(instrument.randomVolumeVariation));
972+
getPanningVariation().setText(Integer.toString(instrument.randomPanningVariation));
973+
getResonanceVariation().setText(Integer.toString(instrument.randomResonanceVariation));
974+
getCutOffVariation().setText(Integer.toString(instrument.randomCutOffVariation));
975+
976+
getActionNNA().setText(getNNAActionString(instrument.NNA));
977+
getCheckDNA().setText(getDNACheckString(instrument.dublicateNoteCheck));
978+
getActionDNA().setText(getDNAActionString(instrument.dublicateNoteAction));
979+
980+
getSampleMap().setText(getSampleMapString(instrument.noteIndex, instrument.sampleIndex));
981+
getSampleMap().select(0,0);
982+
983+
getVolumeEnvelopePanel().setEnvelope(instrument.volumeEnvelope, EnvelopeType.volume);
984+
getPanningEnvelopePanel().setEnvelope(instrument.panningEnvelope, EnvelopeType.panning);
985+
getPitchEnvelopePanel().setEnvelope(instrument.pitchEnvelope, EnvelopeType.pitch);
963986
}
964-
965-
getVolumeVariation().setText(Integer.toString(instrument.randomVolumeVariation));
966-
getPanningVariation().setText(Integer.toString(instrument.randomPanningVariation));
967-
getResonanceVariation().setText(Integer.toString(instrument.randomResonanceVariation));
968-
getCutOffVariation().setText(Integer.toString(instrument.randomCutOffVariation));
969-
970-
getActionNNA().setText(getNNAActionString(instrument.NNA));
971-
getCheckDNA().setText(getDNACheckString(instrument.dublicateNoteCheck));
972-
getActionDNA().setText(getDNAActionString(instrument.dublicateNoteAction));
973-
974-
getSampleMap().setText(getSampleMapString(instrument.noteIndex, instrument.sampleIndex));
975-
getSampleMap().select(0,0);
976-
977-
getVolumeEnvelopePanel().setEnvelope(instrument.volumeEnvelope, EnvelopeType.volume);
978-
getPanningEnvelopePanel().setEnvelope(instrument.panningEnvelope, EnvelopeType.panning);
979-
getPitchEnvelopePanel().setEnvelope(instrument.pitchEnvelope, EnvelopeType.pitch);
980987
}
981988
public void fillWithInstrumentArray(final Instrument [] instruments)
982989
{
@@ -986,7 +993,7 @@ public void fillWithInstrumentArray(final Instrument [] instruments)
986993
ArrayList<Integer> list = new ArrayList<Integer>(instruments.length);
987994
for (int i=0; i<instruments.length; i++) list.add(Integer.valueOf(i+1));
988995
getSelectInstrument().setModel(new SpinnerListModel(list));
989-
if (instruments[0]!=null) fillWithInstrument(instruments[0]);
996+
fillWithInstrument(instruments[0]);
990997
}
991998
else
992999
clearInstrument();

source/de/quippy/javamod/multimedia/mod/gui/ModPatternDialog.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,16 @@ private void fillWithArrangementIndex(final int index)
299299
}
300300
public void fillWithPatternArray(final int songLength, final int [] arrangement, final Pattern [] patterns)
301301
{
302-
if (arrangement==null || patterns==null) return;
303302
this.arrangement = new int [songLength];
304-
for (int i=0; i<songLength; i++) this.arrangement[i] = arrangement[i];
305-
this.patterns = patterns;
303+
if (patterns==null)
304+
{
305+
getTextView_PatternData().setText(Helpers.EMPTY_STING);
306+
}
307+
else
308+
{
309+
for (int i=0; i<songLength; i++) this.arrangement[i] = arrangement[i];
310+
this.patterns = patterns;
311+
}
306312
fillButtonsForArrangement();
307313
if (buttonArrangement!=null && buttonArrangement.length>0 && buttonArrangement[0]!=null)
308314
buttonArrangement[0].doClick();

source/de/quippy/javamod/multimedia/mod/gui/ModSampleDialog.java

+60-24
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public class ModSampleDialog extends JDialog
5151
{
5252
private static final long serialVersionUID = -9058637708283713743L;
5353

54+
private static String [] AUTOVIBRATO_TYPES = new String [] { "Sine", "Square", "Ramp Up", "Ramp Down", "Random" };
55+
5456
private JLabel labelSelectSample = null;
5557
private JSpinner selectSample = null;
5658
private JTextField sampleType = null;
@@ -821,31 +823,63 @@ private SampleImagePanel getImageBufferPanel()
821823
}
822824
return imageBufferPanel;
823825
}
824-
private static String [] AUTOVIBRATO_TYPES = new String [] { "Sine", "Square", "Ramp Up", "Ramp Down", "Random" };
826+
private void clearSample()
827+
{
828+
getSampleType().setText(Helpers.EMPTY_STING);
829+
getSampleName().setText(Helpers.EMPTY_STING);
830+
getDosFileName().setText(Helpers.EMPTY_STING);
831+
getDefaultVolume().setText(Helpers.EMPTY_STING);
832+
getGlobalVolume().setText(Helpers.EMPTY_STING);
833+
getSetPan().setFixedState(false);
834+
getSetPanValue().setText(Helpers.EMPTY_STING);
835+
getFineTuneValue().setText(Helpers.EMPTY_STING);
836+
getBaseFreqValue().setText(Helpers.EMPTY_STING);
837+
getTransposeValue().setText(Helpers.EMPTY_STING);
838+
getLoopTypeValue().setText(Helpers.EMPTY_STING);
839+
getLoopStartValue().setText(Helpers.EMPTY_STING);
840+
getLoopEndValue().setText(Helpers.EMPTY_STING);
841+
getSustainLoopTypeValue().setText(Helpers.EMPTY_STING);
842+
getSustainLoopStartValue().setText(Helpers.EMPTY_STING);
843+
getSustainLoopEndValue().setText(Helpers.EMPTY_STING);
844+
getAutoVibTypeValue().setText(Helpers.EMPTY_STING);
845+
getAutoVibDepthValue().setText(Helpers.EMPTY_STING);
846+
getAutoVibSweepValue().setText(Helpers.EMPTY_STING);
847+
getAutoVibRateValue().setText(Helpers.EMPTY_STING);
848+
// can handle NULL-Sample:
849+
getImageBufferPanel().setSample(null);
850+
getImageBufferPanel().drawMe();
851+
}
825852
private void fillWithSample(final Sample sample)
826853
{
827-
getSampleType().setText(sample.getSampleTypeString());
828-
getSampleName().setText(sample.name);
829-
getDosFileName().setText(sample.dosFileName);
830-
getDefaultVolume().setText(Integer.toString(sample.volume));
831-
getGlobalVolume().setText(Integer.toString(sample.globalVolume));
832-
getSetPan().setFixedState(sample.panning!=-1);
833-
getSetPanValue().setText(Integer.toString(sample.panning));
834-
getFineTuneValue().setText(Integer.toString(sample.fineTune));
835-
getBaseFreqValue().setText(Integer.toString(sample.baseFrequency));
836-
getTransposeValue().setText(Integer.toString(sample.transpose));
837-
getLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_IS_PINGPONG)==0?"On":"Bidi");
838-
getLoopStartValue().setText(Integer.toString(sample.loopStart));
839-
getLoopEndValue().setText(Integer.toString(sample.loopStop));
840-
getSustainLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_SUSTAIN_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_SUSTAIN_IS_PINGPONG)==0?"On":"Bidi");
841-
getSustainLoopStartValue().setText(Integer.toString(sample.sustainLoopStart));
842-
getSustainLoopEndValue().setText(Integer.toString(sample.sustainLoopStop));
843-
getAutoVibTypeValue().setText(AUTOVIBRATO_TYPES[sample.vibratoType]);
844-
getAutoVibDepthValue().setText(Integer.toString(sample.vibratoDepth));
845-
getAutoVibSweepValue().setText(Integer.toString(sample.vibratoSweep));
846-
getAutoVibRateValue().setText(Integer.toString(sample.vibratoRate));
847-
getImageBufferPanel().setSample(sample);
848-
getImageBufferPanel().drawMe();
854+
if (sample==null)
855+
{
856+
clearSample();
857+
}
858+
else
859+
{
860+
getSampleType().setText(sample.getSampleTypeString());
861+
getSampleName().setText(sample.name);
862+
getDosFileName().setText(sample.dosFileName);
863+
getDefaultVolume().setText(Integer.toString(sample.volume));
864+
getGlobalVolume().setText(Integer.toString(sample.globalVolume));
865+
getSetPan().setFixedState(sample.panning!=-1);
866+
getSetPanValue().setText(Integer.toString(sample.panning));
867+
getFineTuneValue().setText(Integer.toString(sample.fineTune));
868+
getBaseFreqValue().setText(Integer.toString(sample.baseFrequency));
869+
getTransposeValue().setText(Integer.toString(sample.transpose));
870+
getLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_IS_PINGPONG)==0?"On":"Bidi");
871+
getLoopStartValue().setText(Integer.toString(sample.loopStart));
872+
getLoopEndValue().setText(Integer.toString(sample.loopStop));
873+
getSustainLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_SUSTAIN_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_SUSTAIN_IS_PINGPONG)==0?"On":"Bidi");
874+
getSustainLoopStartValue().setText(Integer.toString(sample.sustainLoopStart));
875+
getSustainLoopEndValue().setText(Integer.toString(sample.sustainLoopStop));
876+
getAutoVibTypeValue().setText(AUTOVIBRATO_TYPES[sample.vibratoType]);
877+
getAutoVibDepthValue().setText(Integer.toString(sample.vibratoDepth));
878+
getAutoVibSweepValue().setText(Integer.toString(sample.vibratoSweep));
879+
getAutoVibRateValue().setText(Integer.toString(sample.vibratoRate));
880+
getImageBufferPanel().setSample(sample);
881+
getImageBufferPanel().drawMe();
882+
}
849883
}
850884
public void fillWithSamples(final Sample [] samples)
851885
{
@@ -855,7 +889,9 @@ public void fillWithSamples(final Sample [] samples)
855889
ArrayList<Integer> list = new ArrayList<Integer>(samples.length);
856890
for (int i=0; i<samples.length; i++) list.add(Integer.valueOf(i+1));
857891
getSelectSample().setModel(new SpinnerListModel(list));
858-
if (samples[0]!=null) fillWithSample(samples[0]);
892+
fillWithSample(samples[0]);
859893
}
894+
else
895+
clearSample();
860896
}
861897
}

source/de/quippy/javamod/multimedia/mod/loader/instrument/InstrumentsContainer.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ public String toString()
167167
if (instruments!=null && instruments.length>0) bf.append("\nSamples:\n");
168168
for (int i=0; i<samples.length; i++)
169169
{
170-
bf.append(samples[i].toShortString()).append('\n');
170+
if (samples[i]!=null) bf.append(samples[i].toShortString());
171+
bf.append('\n');
171172
}
172173
}
173174
return bf.toString();

0 commit comments

Comments
 (0)