From 33864d0022ebcfa313e4b5c4a4cf75d03cd4668c Mon Sep 17 00:00:00 2001 From: quippy-git Date: Thu, 14 Dec 2023 21:21:37 +0100 Subject: [PATCH] V3.7.2 - XMAS Edition - Second BugFix --- README.md | 9 +- .../mod/gui/ModInstrumentDialog.java | 115 +++++++++--------- .../multimedia/mod/gui/ModSampleDialog.java | 73 ++++++----- .../javamod/multimedia/mod/loader/Module.java | 28 ++++- .../mod/loader/tracker/ProTrackerMod.java | 20 ++- .../multimedia/mod/mixer/BasicModMixer.java | 2 +- source/de/quippy/javamod/system/Helpers.java | 2 +- 7 files changed, 143 insertions(+), 106 deletions(-) diff --git a/README.md b/README.md index 25a5401..135dae7 100644 --- a/README.md +++ b/README.md @@ -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), ... @@ -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! diff --git a/source/de/quippy/javamod/multimedia/mod/gui/ModInstrumentDialog.java b/source/de/quippy/javamod/multimedia/mod/gui/ModInstrumentDialog.java index e0693cc..3899055 100644 --- a/source/de/quippy/javamod/multimedia/mod/gui/ModInstrumentDialog.java +++ b/source/de/quippy/javamod/multimedia/mod/gui/ModInstrumentDialog.java @@ -188,7 +188,7 @@ public void windowClosing(java.awt.event.WindowEvent e) pack(); setLocation(Helpers.getFrameCenteredLocation(this, getParent())); - fillWithInstrument(null); + clearInstrument(); } public void doClose() { @@ -741,6 +741,7 @@ private JLabel getCheckDNALabel() private JTextField getCheckDNA() { if (checkDNA==null) + { checkDNA = new JTextField(); checkDNA.setName("checkDNA"); @@ -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(instruments.length); - for (int i=0; i(instruments.length); + for (int i=0; i(samples.length); - for (int i=0; i(samples.length); + for (int i=0; i32767) delta = 32767; else if (delta<-32768) delta = -32768; + current.sampleL[s] = ModConstants.promoteSigned16BitToSigned32Bit((long)delta); + } if (isStereo) { delta = 0; for (int s=0; s32767) 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; s127) delta = 127; else if (delta<-128) delta = -128; + current.sampleL[s] = ModConstants.promoteSigned8BitToSigned32Bit((long)delta); + } if (isStereo) { delta = 0; for (int s=0; s127) delta = 127; else if (delta<-128) delta = -128; + current.sampleR[s] = ModConstants.promoteSigned8BitToSigned32Bit((long)delta); + } } } else diff --git a/source/de/quippy/javamod/multimedia/mod/loader/tracker/ProTrackerMod.java b/source/de/quippy/javamod/multimedia/mod/loader/tracker/ProTrackerMod.java index a915137..6604d57 100644 --- a/source/de/quippy/javamod/multimedia/mod/loader/tracker/ProTrackerMod.java +++ b/source/de/quippy/javamod/multimedia/mod/loader/tracker/ProTrackerMod.java @@ -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); @@ -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); @@ -500,7 +513,10 @@ protected void loadModFileInternal(ModfileInputStream inputStream) throws IOExce for (int i=0; i> (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; diff --git a/source/de/quippy/javamod/system/Helpers.java b/source/de/quippy/javamod/system/Helpers.java index c1c41a0..02f2488 100644 --- a/source/de/quippy/javamod/system/Helpers.java +++ b/source/de/quippy/javamod/system/Helpers.java @@ -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";