Skip to content

Commit

Permalink
V3.7.2 - XMAS Edition - Second BugFix
Browse files Browse the repository at this point in the history
  • Loading branch information
quippy-git committed Dec 14, 2023
1 parent e3f1c8d commit 33864d0
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 106 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# JavaMod V3.7.1
# JavaMod V3.7.2
JavaMod - a java based multimedia player for Protracker, Fast Tracker,
Impulse Tracker, Scream Tracker and other mod files plus
SID, MP3, WAV, OGG, APE, FLAC, MIDI, AdLib ROL-Files (OPL), ...
Expand Down Expand Up @@ -66,6 +66,13 @@ JavaMod incorporates modified versions of the following libraries:
* Midi and AdLib/OPL with Mods
* read 7z archives

## New in Version 3.7.2
* FIX: Sample- and instrument dialog - iterating through the instruments was
broken
* NEW: Added some sanity checks with mod loading.
* NEW: Added Mod-Files with ID !PM! - it is a ProTracker mod with delta saved
samples. However, I have no idea what tracker created those.

## New in Version 3.7.1
* FIX: Error if window manager does not support tray icon. So really check for
tray icon support. Would end up in a hard error, JavaMod will not start!
Expand Down
115 changes: 57 additions & 58 deletions source/de/quippy/javamod/multimedia/mod/gui/ModInstrumentDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public void windowClosing(java.awt.event.WindowEvent e)
pack();
setLocation(Helpers.getFrameCenteredLocation(this, getParent()));

fillWithInstrument(null);
clearInstrument();
}
public void doClose()
{
Expand Down Expand Up @@ -741,6 +741,7 @@ private JLabel getCheckDNALabel()
private JTextField getCheckDNA()
{
if (checkDNA==null)

{
checkDNA = new JTextField();
checkDNA.setName("checkDNA");
Expand Down Expand Up @@ -1002,77 +1003,75 @@ private void clearInstrument()
getVolumeEnvelopePanel().setEnvelope(null, EnvelopeType.volume);
getPanningEnvelopePanel().setEnvelope(null, EnvelopeType.panning);
getPitchEnvelopePanel().setEnvelope(null, EnvelopeType.pitch);

// after setting the new model, make the editor of the spinner un-editable
((DefaultEditor)getSelectInstrument().getEditor()).getTextField().setEditable(false);
}
private void fillWithInstrument(Instrument newInstrument)
{
if (newInstrument==null)
getInstrumentName().setText(newInstrument.name);
getFileName().setText(newInstrument.dosFileName);

getGlobalVolume().setText(Integer.toString(newInstrument.globalVolume));
getFadeOutVolume().setText(Integer.toString(newInstrument.volumeFadeOut));
getSetPan().setFixedState(newInstrument.defaultPan!=-1);
getSetPanValue().setText(Integer.toString(newInstrument.defaultPan));

getPitchPanSep().setText(Integer.toString(newInstrument.pitchPanSeparation));
getPitchPanCenter().setText(ModConstants.getNoteNameForIndex(newInstrument.pitchPanCenter + 1));

if (newInstrument.initialFilterResonance!=-1)
{
clearInstrument();
getSetResonance().setFixedState((newInstrument.initialFilterResonance&0x80)!=0);
getResonanceValue().setText(Integer.toString(newInstrument.initialFilterResonance&0x7F));
}
else
{
spinnerModelData = new ArrayList<String>(instruments.length);
for (int i=0; i<instruments.length; i++) spinnerModelData.add(ModConstants.getAsHex(i+1, 2));
getSelectInstrument().setModel(new SpinnerListModel(spinnerModelData));

getInstrumentName().setText(newInstrument.name);
getFileName().setText(newInstrument.dosFileName);

getGlobalVolume().setText(Integer.toString(newInstrument.globalVolume));
getFadeOutVolume().setText(Integer.toString(newInstrument.volumeFadeOut));
getSetPan().setFixedState(newInstrument.defaultPan!=-1);
getSetPanValue().setText(Integer.toString(newInstrument.defaultPan));

getPitchPanSep().setText(Integer.toString(newInstrument.pitchPanSeparation));
getPitchPanCenter().setText(ModConstants.getNoteNameForIndex(newInstrument.pitchPanCenter + 1));

if (newInstrument.initialFilterResonance!=-1)
{
getSetResonance().setFixedState((newInstrument.initialFilterResonance&0x80)!=0);
getResonanceValue().setText(Integer.toString(newInstrument.initialFilterResonance&0x7F));
}
else
{
getSetResonance().setFixedState(false);
getResonanceValue().setText("-1");
}
if (newInstrument.initialFilterCutoff!=-1)
{
getSetCutOff().setFixedState((newInstrument.initialFilterCutoff&0x80)!=0);
getCutOffValue().setText(Integer.toString(newInstrument.initialFilterCutoff&0x7F));
}
else
{
getSetCutOff().setFixedState(false);
getCutOffValue().setText("-1");
}

getVolumeVariation().setText(Integer.toString(newInstrument.randomVolumeVariation));
getPanningVariation().setText(Integer.toString(newInstrument.randomPanningVariation));
getResonanceVariation().setText(Integer.toString(newInstrument.randomResonanceVariation));
getCutOffVariation().setText(Integer.toString(newInstrument.randomCutOffVariation));

getActionNNA().setText(getNNAActionString(newInstrument.NNA));
getCheckDNA().setText(getDNACheckString(newInstrument.dublicateNoteCheck));
getActionDNA().setText(getDNAActionString(newInstrument.dublicateNoteAction));

getSampleMap().setText(getSampleMapString(newInstrument.noteIndex, newInstrument.sampleIndex));
getSampleMap().select(0,0);

getVolumeEnvelopePanel().setEnvelope(newInstrument.volumeEnvelope, EnvelopeType.volume);
getPanningEnvelopePanel().setEnvelope(newInstrument.panningEnvelope, EnvelopeType.panning);
getPitchEnvelopePanel().setEnvelope(newInstrument.pitchEnvelope, EnvelopeType.pitch);
getSetResonance().setFixedState(false);
getResonanceValue().setText("-1");
}

// after setting the new model, make the editor of the spinner un-editable
((DefaultEditor)getSelectInstrument().getEditor()).getTextField().setEditable(false);
if (newInstrument.initialFilterCutoff!=-1)
{
getSetCutOff().setFixedState((newInstrument.initialFilterCutoff&0x80)!=0);
getCutOffValue().setText(Integer.toString(newInstrument.initialFilterCutoff&0x7F));
}
else
{
getSetCutOff().setFixedState(false);
getCutOffValue().setText("-1");
}

getVolumeVariation().setText(Integer.toString(newInstrument.randomVolumeVariation));
getPanningVariation().setText(Integer.toString(newInstrument.randomPanningVariation));
getResonanceVariation().setText(Integer.toString(newInstrument.randomResonanceVariation));
getCutOffVariation().setText(Integer.toString(newInstrument.randomCutOffVariation));

getActionNNA().setText(getNNAActionString(newInstrument.NNA));
getCheckDNA().setText(getDNACheckString(newInstrument.dublicateNoteCheck));
getActionDNA().setText(getDNAActionString(newInstrument.dublicateNoteAction));

getSampleMap().setText(getSampleMapString(newInstrument.noteIndex, newInstrument.sampleIndex));
getSampleMap().select(0,0);

getVolumeEnvelopePanel().setEnvelope(newInstrument.volumeEnvelope, EnvelopeType.volume);
getPanningEnvelopePanel().setEnvelope(newInstrument.panningEnvelope, EnvelopeType.panning);
getPitchEnvelopePanel().setEnvelope(newInstrument.pitchEnvelope, EnvelopeType.pitch);
}
public void fillWithInstrumentArray(final Instrument [] instruments)
{
this.instruments = instruments;
if (instruments!=null)
{
spinnerModelData = new ArrayList<String>(instruments.length);
for (int i=0; i<instruments.length; i++) spinnerModelData.add(ModConstants.getAsHex(i+1, 2));
getSelectInstrument().setModel(new SpinnerListModel(spinnerModelData));

fillWithInstrument(instruments[0]);

// after setting the new model, make the editor of the spinner un-editable
((DefaultEditor)getSelectInstrument().getEditor()).getTextField().setEditable(false);
}
else
fillWithInstrument(null);
clearInstrument();
}
}
73 changes: 36 additions & 37 deletions source/de/quippy/javamod/multimedia/mod/gui/ModSampleDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void windowClosing(java.awt.event.WindowEvent e)
pack();
setLocation(Helpers.getFrameCenteredLocation(this, getParent()));

fillWithSample(null);
clearSample();
}
public void doClose()
{
Expand Down Expand Up @@ -866,45 +866,35 @@ private void clearSample()
// can handle NULL-Sample:
getImageBufferPanel().setSample(null);
getImageBufferPanel().drawMe();
}
private void fillWithSample(final Sample sample)
{
if (sample==null)
{
clearSample();
}
else
{
spinnerModelData = new ArrayList<String>(samples.length);
for (int i=0; i<samples.length; i++) spinnerModelData.add(ModConstants.getAsHex(i+1, 2));
getSelectSample().setModel(new SpinnerListModel(spinnerModelData));

getSampleType().setText(sample.getSampleTypeString());
getSampleName().setText(sample.name);
getDosFileName().setText(sample.dosFileName);
getDefaultVolume().setText(Integer.toString(sample.volume));
getGlobalVolume().setText(Integer.toString(sample.globalVolume));
getSetPan().setFixedState(sample.panning!=-1);
getSetPanValue().setText(Integer.toString(sample.panning));
getFineTuneValue().setText(Integer.toString(sample.fineTune));
getBaseFreqValue().setText(Integer.toString(sample.baseFrequency));
getTransposeValue().setText(Integer.toString(sample.transpose));
getLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_IS_PINGPONG)==0?"On":"Bidi");
getLoopStartValue().setText(Integer.toString(sample.loopStart));
getLoopEndValue().setText(Integer.toString(sample.loopStop));
getSustainLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_SUSTAIN_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_SUSTAIN_IS_PINGPONG)==0?"On":"Bidi");
getSustainLoopStartValue().setText(Integer.toString(sample.sustainLoopStart));
getSustainLoopEndValue().setText(Integer.toString(sample.sustainLoopStop));
getAutoVibTypeValue().setText(AUTOVIBRATO_TYPES[sample.vibratoType]);
getAutoVibDepthValue().setText(Integer.toString(sample.vibratoDepth));
getAutoVibSweepValue().setText(Integer.toString(sample.vibratoSweep));
getAutoVibRateValue().setText(Integer.toString(sample.vibratoRate));
getImageBufferPanel().setSample(sample);
getImageBufferPanel().drawMe();
}
// after setting the new model, make the editor of the spinner un-editable
((DefaultEditor)getSelectSample().getEditor()).getTextField().setEditable(false);
}
private void fillWithSample(final Sample sample)
{
getSampleType().setText(sample.getSampleTypeString());
getSampleName().setText(sample.name);
getDosFileName().setText(sample.dosFileName);
getDefaultVolume().setText(Integer.toString(sample.volume));
getGlobalVolume().setText(Integer.toString(sample.globalVolume));
getSetPan().setFixedState(sample.panning!=-1);
getSetPanValue().setText(Integer.toString(sample.panning));
getFineTuneValue().setText(Integer.toString(sample.fineTune));
getBaseFreqValue().setText(Integer.toString(sample.baseFrequency));
getTransposeValue().setText(Integer.toString(sample.transpose));
getLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_IS_PINGPONG)==0?"On":"Bidi");
getLoopStartValue().setText(Integer.toString(sample.loopStart));
getLoopEndValue().setText(Integer.toString(sample.loopStop));
getSustainLoopTypeValue().setText((sample.loopType&ModConstants.LOOP_SUSTAIN_ON)==0?"Off":(sample.loopType&ModConstants.LOOP_SUSTAIN_IS_PINGPONG)==0?"On":"Bidi");
getSustainLoopStartValue().setText(Integer.toString(sample.sustainLoopStart));
getSustainLoopEndValue().setText(Integer.toString(sample.sustainLoopStop));
getAutoVibTypeValue().setText(AUTOVIBRATO_TYPES[sample.vibratoType]);
getAutoVibDepthValue().setText(Integer.toString(sample.vibratoDepth));
getAutoVibSweepValue().setText(Integer.toString(sample.vibratoSweep));
getAutoVibRateValue().setText(Integer.toString(sample.vibratoRate));
getImageBufferPanel().setSample(sample);
getImageBufferPanel().drawMe();
}
public void showSample(final int sampleIndex)
{
if (samples!=null)
Expand All @@ -917,8 +907,17 @@ public void fillWithSamples(final Sample [] samples)
{
this.samples = samples;
if (samples!=null)
{
spinnerModelData = new ArrayList<String>(samples.length);
for (int i=0; i<samples.length; i++) spinnerModelData.add(ModConstants.getAsHex(i+1, 2));
getSelectSample().setModel(new SpinnerListModel(spinnerModelData));

fillWithSample(samples[0]);

// after setting the new model, make the editor of the spinner un-editable
((DefaultEditor)getSelectSample().getEditor()).getTextField().setEditable(false);
}
else
fillWithSample(null);
clearSample();
}
}
28 changes: 22 additions & 6 deletions source/de/quippy/javamod/multimedia/mod/loader/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -568,27 +568,43 @@ protected void readSampleData(final Sample current, final ModfileInputStream inp
else
if ((flags&ModConstants.SM_PCM16D)==ModConstants.SM_PCM16D)
{
short delta = 0;
int delta = 0;
for (int s=0; s<current.length; s++)
current.sampleL[s] = ModConstants.promoteSigned16BitToSigned32Bit((long)(delta += inputStream.readIntelWord()));
{
delta += (int)inputStream.readIntelWord();
if (delta>32767) delta = 32767; else if (delta<-32768) delta = -32768;
current.sampleL[s] = ModConstants.promoteSigned16BitToSigned32Bit((long)delta);
}
if (isStereo)
{
delta = 0;
for (int s=0; s<current.length; s++)
current.sampleR[s] = ModConstants.promoteSigned16BitToSigned32Bit((long)(delta += inputStream.readIntelWord()));
{
delta += (int)inputStream.readIntelWord();
if (delta>32767) delta = 32767; else if (delta<-32768) delta = -32768;
current.sampleR[s] = ModConstants.promoteSigned16BitToSigned32Bit((long)delta);
}
}
}
else
if ((flags&ModConstants.SM_PCMD)==ModConstants.SM_PCMD)
{
byte delta = 0;
int delta = 0;
for (int s=0; s<current.length; s++)
current.sampleL[s] = ModConstants.promoteSigned8BitToSigned32Bit((long)(delta += inputStream.readByte()));
{
delta += (int)inputStream.readByte();
if (delta>127) delta = 127; else if (delta<-128) delta = -128;
current.sampleL[s] = ModConstants.promoteSigned8BitToSigned32Bit((long)delta);
}
if (isStereo)
{
delta = 0;
for (int s=0; s<current.length; s++)
current.sampleR[s] = ModConstants.promoteSigned8BitToSigned32Bit((long)(delta += inputStream.readByte()));
{
delta += (int)inputStream.readByte();
if (delta>127) delta = 127; else if (delta<-128) delta = -128;
current.sampleR[s] = ModConstants.promoteSigned8BitToSigned32Bit((long)delta);
}
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ private String getModType(String kennung)
setNChannels(8);
return "Atari Oktalyzer";
}
if (kennung.equals("!PM!"))
{
isAmigaLike = true;
setNChannels(4);
return "Unknown Tracker";
}

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

if (pe.getPeriod()<25)
pe.setPeriod(0);
else
if (pe.getPeriod()>0)
{
pe.setNoteIndex(ModConstants.getNoteIndexForPeriod(pe.getPeriod())+1);
final int noteIndex = ModConstants.getNoteIndexForPeriod(pe.getPeriod());
if (noteIndex>0)
pe.setNoteIndex(noteIndex+1);
else
pe.setPeriod(0);
}

pe.setEffekt((note&0xF00)>>8);
Expand Down Expand Up @@ -500,7 +513,10 @@ protected void loadModFileInternal(ModfileInputStream inputStream) throws IOExce
for (int i=0; i<getNSamples(); i++)
{
Sample current = getInstrumentContainer().getSample(i);
current.setSampleType(ModConstants.SM_PCMS);
if (getModID().equals("!PM!"))
current.setSampleType(ModConstants.SM_PCMD);
else
current.setSampleType(ModConstants.SM_PCMS);
readSampleData(current, inputStream);
}
cleanUpArrangement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ protected int getFineTunePeriod(final ChannelMemory aktMemo, final int period)
return (ModConstants.FreqS3MTable[noteIndex%12] << 7) >> (noteIndex/12);

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

case ModConstants.XM_AMIGA_TABLE:
int fineTune=aktMemo.currentFineTune;
Expand Down
2 changes: 1 addition & 1 deletion source/de/quippy/javamod/system/Helpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private Helpers()
}

/** Version Information */
public static final String VERSION = "V3.7.1";
public static final String VERSION = "V3.7.2";
public static final String PROGRAM = "Java Mod Player";
public static final String FULLVERSION = PROGRAM+' '+VERSION;
public static final String COPYRIGHT = "© by Daniel Becker since 2006";
Expand Down

0 comments on commit 33864d0

Please sign in to comment.