Skip to content

Commit 33864d0

Browse files
committed
V3.7.2 - XMAS Edition - Second BugFix
1 parent e3f1c8d commit 33864d0

File tree

7 files changed

+143
-106
lines changed

7 files changed

+143
-106
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# JavaMod V3.7.1
1+
# JavaMod V3.7.2
22
JavaMod - a java based multimedia player for Protracker, Fast Tracker,
33
Impulse Tracker, Scream Tracker and other mod files plus
44
SID, MP3, WAV, OGG, APE, FLAC, MIDI, AdLib ROL-Files (OPL), ...
@@ -66,6 +66,13 @@ JavaMod incorporates modified versions of the following libraries:
6666
* Midi and AdLib/OPL with Mods
6767
* read 7z archives
6868

69+
## New in Version 3.7.2
70+
* FIX: Sample- and instrument dialog - iterating through the instruments was
71+
broken
72+
* NEW: Added some sanity checks with mod loading.
73+
* NEW: Added Mod-Files with ID !PM! - it is a ProTracker mod with delta saved
74+
samples. However, I have no idea what tracker created those.
75+
6976
## New in Version 3.7.1
7077
* FIX: Error if window manager does not support tray icon. So really check for
7178
tray icon support. Would end up in a hard error, JavaMod will not start!

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

+57-58
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public void windowClosing(java.awt.event.WindowEvent e)
188188
pack();
189189
setLocation(Helpers.getFrameCenteredLocation(this, getParent()));
190190

191-
fillWithInstrument(null);
191+
clearInstrument();
192192
}
193193
public void doClose()
194194
{
@@ -741,6 +741,7 @@ private JLabel getCheckDNALabel()
741741
private JTextField getCheckDNA()
742742
{
743743
if (checkDNA==null)
744+
744745
{
745746
checkDNA = new JTextField();
746747
checkDNA.setName("checkDNA");
@@ -1002,77 +1003,75 @@ private void clearInstrument()
10021003
getVolumeEnvelopePanel().setEnvelope(null, EnvelopeType.volume);
10031004
getPanningEnvelopePanel().setEnvelope(null, EnvelopeType.panning);
10041005
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);
10051009
}
10061010
private void fillWithInstrument(Instrument newInstrument)
10071011
{
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)
10091024
{
1010-
clearInstrument();
1025+
getSetResonance().setFixedState((newInstrument.initialFilterResonance&0x80)!=0);
1026+
getResonanceValue().setText(Integer.toString(newInstrument.initialFilterResonance&0x7F));
10111027
}
10121028
else
10131029
{
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");
10651032
}
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);
10691059
}
10701060
public void fillWithInstrumentArray(final Instrument [] instruments)
10711061
{
10721062
this.instruments = instruments;
10731063
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+
10741069
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+
}
10751074
else
1076-
fillWithInstrument(null);
1075+
clearInstrument();
10771076
}
10781077
}

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

+36-37
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public void windowClosing(java.awt.event.WindowEvent e)
168168
pack();
169169
setLocation(Helpers.getFrameCenteredLocation(this, getParent()));
170170

171-
fillWithSample(null);
171+
clearSample();
172172
}
173173
public void doClose()
174174
{
@@ -866,45 +866,35 @@ private void clearSample()
866866
// can handle NULL-Sample:
867867
getImageBufferPanel().setSample(null);
868868
getImageBufferPanel().drawMe();
869-
}
870-
private void fillWithSample(final Sample sample)
871-
{
872-
if (sample==null)
873-
{
874-
clearSample();
875-
}
876-
else
877-
{
878-
spinnerModelData = new ArrayList<String>(samples.length);
879-
for (int i=0; i<samples.length; i++) spinnerModelData.add(ModConstants.getAsHex(i+1, 2));
880-
getSelectSample().setModel(new SpinnerListModel(spinnerModelData));
881869

882-
getSampleType().setText(sample.getSampleTypeString());
883-
getSampleName().setText(sample.name);
884-
getDosFileName().setText(sample.dosFileName);
885-
getDefaultVolume().setText(Integer.toString(sample.volume));
886-
getGlobalVolume().setText(Integer.toString(sample.globalVolume));
887-
getSetPan().setFixedState(sample.panning!=-1);
888-
getSetPanValue().setText(Integer.toString(sample.panning));
889-
getFineTuneValue().setText(Integer.toString(sample.fineTune));
890-
getBaseFreqValue().setText(Integer.toString(sample.baseFrequency));
891-
getTransposeValue().setText(Integer.toString(sample.transpose));
892-
getLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_IS_PINGPONG)==0?"On":"Bidi");
893-
getLoopStartValue().setText(Integer.toString(sample.loopStart));
894-
getLoopEndValue().setText(Integer.toString(sample.loopStop));
895-
getSustainLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_SUSTAIN_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_SUSTAIN_IS_PINGPONG)==0?"On":"Bidi");
896-
getSustainLoopStartValue().setText(Integer.toString(sample.sustainLoopStart));
897-
getSustainLoopEndValue().setText(Integer.toString(sample.sustainLoopStop));
898-
getAutoVibTypeValue().setText(AUTOVIBRATO_TYPES[sample.vibratoType]);
899-
getAutoVibDepthValue().setText(Integer.toString(sample.vibratoDepth));
900-
getAutoVibSweepValue().setText(Integer.toString(sample.vibratoSweep));
901-
getAutoVibRateValue().setText(Integer.toString(sample.vibratoRate));
902-
getImageBufferPanel().setSample(sample);
903-
getImageBufferPanel().drawMe();
904-
}
905870
// after setting the new model, make the editor of the spinner un-editable
906871
((DefaultEditor)getSelectSample().getEditor()).getTextField().setEditable(false);
907872
}
873+
private void fillWithSample(final Sample sample)
874+
{
875+
getSampleType().setText(sample.getSampleTypeString());
876+
getSampleName().setText(sample.name);
877+
getDosFileName().setText(sample.dosFileName);
878+
getDefaultVolume().setText(Integer.toString(sample.volume));
879+
getGlobalVolume().setText(Integer.toString(sample.globalVolume));
880+
getSetPan().setFixedState(sample.panning!=-1);
881+
getSetPanValue().setText(Integer.toString(sample.panning));
882+
getFineTuneValue().setText(Integer.toString(sample.fineTune));
883+
getBaseFreqValue().setText(Integer.toString(sample.baseFrequency));
884+
getTransposeValue().setText(Integer.toString(sample.transpose));
885+
getLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_IS_PINGPONG)==0?"On":"Bidi");
886+
getLoopStartValue().setText(Integer.toString(sample.loopStart));
887+
getLoopEndValue().setText(Integer.toString(sample.loopStop));
888+
getSustainLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_SUSTAIN_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_SUSTAIN_IS_PINGPONG)==0?"On":"Bidi");
889+
getSustainLoopStartValue().setText(Integer.toString(sample.sustainLoopStart));
890+
getSustainLoopEndValue().setText(Integer.toString(sample.sustainLoopStop));
891+
getAutoVibTypeValue().setText(AUTOVIBRATO_TYPES[sample.vibratoType]);
892+
getAutoVibDepthValue().setText(Integer.toString(sample.vibratoDepth));
893+
getAutoVibSweepValue().setText(Integer.toString(sample.vibratoSweep));
894+
getAutoVibRateValue().setText(Integer.toString(sample.vibratoRate));
895+
getImageBufferPanel().setSample(sample);
896+
getImageBufferPanel().drawMe();
897+
}
908898
public void showSample(final int sampleIndex)
909899
{
910900
if (samples!=null)
@@ -917,8 +907,17 @@ public void fillWithSamples(final Sample [] samples)
917907
{
918908
this.samples = samples;
919909
if (samples!=null)
910+
{
911+
spinnerModelData = new ArrayList<String>(samples.length);
912+
for (int i=0; i<samples.length; i++) spinnerModelData.add(ModConstants.getAsHex(i+1, 2));
913+
getSelectSample().setModel(new SpinnerListModel(spinnerModelData));
914+
920915
fillWithSample(samples[0]);
916+
917+
// after setting the new model, make the editor of the spinner un-editable
918+
((DefaultEditor)getSelectSample().getEditor()).getTextField().setEditable(false);
919+
}
921920
else
922-
fillWithSample(null);
921+
clearSample();
923922
}
924923
}

source/de/quippy/javamod/multimedia/mod/loader/Module.java

+22-6
Original file line numberDiff line numberDiff line change
@@ -568,27 +568,43 @@ protected void readSampleData(final Sample current, final ModfileInputStream inp
568568
else
569569
if ((flags&ModConstants.SM_PCM16D)==ModConstants.SM_PCM16D)
570570
{
571-
short delta = 0;
571+
int delta = 0;
572572
for (int s=0; s<current.length; s++)
573-
current.sampleL[s] = ModConstants.promoteSigned16BitToSigned32Bit((long)(delta += inputStream.readIntelWord()));
573+
{
574+
delta += (int)inputStream.readIntelWord();
575+
if (delta>32767) delta = 32767; else if (delta<-32768) delta = -32768;
576+
current.sampleL[s] = ModConstants.promoteSigned16BitToSigned32Bit((long)delta);
577+
}
574578
if (isStereo)
575579
{
576580
delta = 0;
577581
for (int s=0; s<current.length; s++)
578-
current.sampleR[s] = ModConstants.promoteSigned16BitToSigned32Bit((long)(delta += inputStream.readIntelWord()));
582+
{
583+
delta += (int)inputStream.readIntelWord();
584+
if (delta>32767) delta = 32767; else if (delta<-32768) delta = -32768;
585+
current.sampleR[s] = ModConstants.promoteSigned16BitToSigned32Bit((long)delta);
586+
}
579587
}
580588
}
581589
else
582590
if ((flags&ModConstants.SM_PCMD)==ModConstants.SM_PCMD)
583591
{
584-
byte delta = 0;
592+
int delta = 0;
585593
for (int s=0; s<current.length; s++)
586-
current.sampleL[s] = ModConstants.promoteSigned8BitToSigned32Bit((long)(delta += inputStream.readByte()));
594+
{
595+
delta += (int)inputStream.readByte();
596+
if (delta>127) delta = 127; else if (delta<-128) delta = -128;
597+
current.sampleL[s] = ModConstants.promoteSigned8BitToSigned32Bit((long)delta);
598+
}
587599
if (isStereo)
588600
{
589601
delta = 0;
590602
for (int s=0; s<current.length; s++)
591-
current.sampleR[s] = ModConstants.promoteSigned8BitToSigned32Bit((long)(delta += inputStream.readByte()));
603+
{
604+
delta += (int)inputStream.readByte();
605+
if (delta>127) delta = 127; else if (delta<-128) delta = -128;
606+
current.sampleR[s] = ModConstants.promoteSigned8BitToSigned32Bit((long)delta);
607+
}
592608
}
593609
}
594610
else

source/de/quippy/javamod/multimedia/mod/loader/tracker/ProTrackerMod.java

+18-2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ private String getModType(String kennung)
190190
setNChannels(8);
191191
return "Atari Oktalyzer";
192192
}
193+
if (kennung.equals("!PM!"))
194+
{
195+
isAmigaLike = true;
196+
setNChannels(4);
197+
return "Unknown Tracker";
198+
}
193199

194200
String firstKennung = kennung.substring(0,2);
195201
String lastKennung = kennung.substring(2,4);
@@ -301,9 +307,16 @@ private PatternElement createNewPatternElement(int pattNum, int row, int channel
301307
pe.setPeriod((note&0xFFFF0000)>>16);
302308
}
303309

310+
if (pe.getPeriod()<25)
311+
pe.setPeriod(0);
312+
else
304313
if (pe.getPeriod()>0)
305314
{
306-
pe.setNoteIndex(ModConstants.getNoteIndexForPeriod(pe.getPeriod())+1);
315+
final int noteIndex = ModConstants.getNoteIndexForPeriod(pe.getPeriod());
316+
if (noteIndex>0)
317+
pe.setNoteIndex(noteIndex+1);
318+
else
319+
pe.setPeriod(0);
307320
}
308321

309322
pe.setEffekt((note&0xF00)>>8);
@@ -500,7 +513,10 @@ protected void loadModFileInternal(ModfileInputStream inputStream) throws IOExce
500513
for (int i=0; i<getNSamples(); i++)
501514
{
502515
Sample current = getInstrumentContainer().getSample(i);
503-
current.setSampleType(ModConstants.SM_PCMS);
516+
if (getModID().equals("!PM!"))
517+
current.setSampleType(ModConstants.SM_PCMD);
518+
else
519+
current.setSampleType(ModConstants.SM_PCMS);
504520
readSampleData(current, inputStream);
505521
}
506522
cleanUpArrangement();

source/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ protected int getFineTunePeriod(final ChannelMemory aktMemo, final int period)
750750
return (ModConstants.FreqS3MTable[noteIndex%12] << 7) >> (noteIndex/12);
751751

752752
case ModConstants.AMIGA_TABLE:
753-
return ModConstants.protracker_fineTunedPeriods[(aktMemo.currentFineTune>>ModConstants.PERIOD_SHIFT)+8][period-25]; // Amiga has less octaves!
753+
return (period<25)?0:ModConstants.protracker_fineTunedPeriods[(aktMemo.currentFineTune>>ModConstants.PERIOD_SHIFT)+8][period-25]; // Amiga has less octaves!
754754

755755
case ModConstants.XM_AMIGA_TABLE:
756756
int fineTune=aktMemo.currentFineTune;

source/de/quippy/javamod/system/Helpers.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private Helpers()
8888
}
8989

9090
/** Version Information */
91-
public static final String VERSION = "V3.7.1";
91+
public static final String VERSION = "V3.7.2";
9292
public static final String PROGRAM = "Java Mod Player";
9393
public static final String FULLVERSION = PROGRAM+' '+VERSION;
9494
public static final String COPYRIGHT = "© by Daniel Becker since 2006";

0 commit comments

Comments
 (0)