Skip to content

Commit 84aadd9

Browse files
committed
Added an option to ignore MPC loops.
1 parent 1a34205 commit 84aadd9

5 files changed

Lines changed: 156 additions & 10 deletions

File tree

documentation/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changes
22

3+
## 15.5.2 (unreleased)
4+
5+
* MPC Keygroups
6+
* New: Added an option to ignore loops
7+
38
## 15.5.1
49

510
* Fixed: Split-stereo files were not combined into stereo files for formats which require it (e.g. Bento).

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>de.mossgrabers</groupId>
77
<artifactId>convertwithmoss</artifactId>
8-
<version>15.5.1</version>
8+
<version>15.5.2</version>
99
<packaging>jar</packaging>
1010
<name>ConvertWithMoss</name>
1111
<organization>
@@ -34,7 +34,7 @@
3434
<dependency>
3535
<groupId>org.openjfx</groupId>
3636
<artifactId>javafx-controls</artifactId>
37-
<version>25.0.1</version>
37+
<version>25.0.2</version>
3838
</dependency>
3939
<dependency>
4040
<groupId>com.github.trilarion</groupId>
@@ -208,7 +208,7 @@
208208
<plugin>
209209
<groupId>org.codehaus.mojo</groupId>
210210
<artifactId>versions-maven-plugin</artifactId>
211-
<version>2.20.1</version>
211+
<version>2.21.0</version>
212212
<configuration>
213213
<ignoredVersions>.*-M.*,.*-alpha.*,.*-beta.*,.*-ea.*</ignoredVersions>
214214
<generateBackupPoms>false</generateBackupPoms>

src/main/java/de/mossgrabers/convertwithmoss/format/akai/MPCKeygroupDetector.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import de.mossgrabers.convertwithmoss.core.model.implementation.DefaultGroup;
3737
import de.mossgrabers.convertwithmoss.core.model.implementation.DefaultSampleLoop;
3838
import de.mossgrabers.convertwithmoss.core.model.implementation.DefaultSampleZone;
39-
import de.mossgrabers.convertwithmoss.core.settings.MetadataSettingsUI;
4039
import de.mossgrabers.convertwithmoss.file.AudioFileUtils;
4140
import de.mossgrabers.convertwithmoss.format.wav.WavFileSampleData;
4241
import de.mossgrabers.tools.FileUtils;
@@ -48,7 +47,7 @@
4847
*
4948
* @author Jürgen Moßgraber
5049
*/
51-
public class MPCKeygroupDetector extends AbstractDetector<MetadataSettingsUI>
50+
public class MPCKeygroupDetector extends AbstractDetector<MPCKeygroupDetectorUI>
5251
{
5352
private static final String BAD_METADATA_FILE = "IDS_NOTIFY_ERR_BAD_METADATA_FILE";
5453

@@ -60,7 +59,7 @@ public class MPCKeygroupDetector extends AbstractDetector<MetadataSettingsUI>
6059
*/
6160
public MPCKeygroupDetector (final INotifier notifier)
6261
{
63-
super ("Akai MPC Keygroup", "MPC", notifier, new MetadataSettingsUI ("MPC"), ".xpm");
62+
super ("Akai MPC Keygroup", "MPC", notifier, new MPCKeygroupDetectorUI ("MPC"), ".xpm");
6463
}
6564

6665

@@ -311,7 +310,7 @@ private void readZones (final File basePath, final boolean isDrum, final List<IS
311310

312311
// No loop if it is a one-shot
313312
if (!isOneShot)
314-
parseLoop (layerElement, zone);
313+
this.parseLoop (layerElement, zone);
315314

316315
zone.setFilter (filter);
317316

@@ -477,7 +476,7 @@ private void readMissingData (final boolean isDrum, final ISampleZone zone, bool
477476
{
478477
final boolean needsUpdate = zone.getStop () > 0;
479478
final boolean needsRootKey = !isDrum && zone.getKeyRoot () >= 0;
480-
final boolean needsLoop = !isOneShot && zone.getLoops ().isEmpty ();
479+
final boolean needsLoop = !isOneShot && zone.getLoops ().isEmpty () && !this.settingsConfiguration.ignoreLoops ();
481480

482481
try
483482
{
@@ -501,8 +500,11 @@ private void readMissingData (final boolean isDrum, final ISampleZone zone, bool
501500
* @param layerElement THe layer element
502501
* @param zone Where to store the data
503502
*/
504-
private static void parseLoop (final Element layerElement, final ISampleZone zone)
503+
private void parseLoop (final Element layerElement, final ISampleZone zone)
505504
{
505+
if (this.settingsConfiguration.ignoreLoops ())
506+
return;
507+
506508
// There might be no loop, forward or reverse
507509
final int sliceLoop = XMLUtils.getChildElementIntegerContent (layerElement, MPCKeygroupTag.LAYER_SLICE_LOOP, -1);
508510
if (sliceLoop <= 0)
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
// Written by Jürgen Moßgraber - mossgrabers.de
2+
// (c) 2019-2026
3+
// Licensed under LGPLv3 - http://www.gnu.org/licenses/lgpl-3.0.txt
4+
5+
package de.mossgrabers.convertwithmoss.format.akai;
6+
7+
import java.util.ArrayList;
8+
import java.util.Arrays;
9+
import java.util.List;
10+
import java.util.Map;
11+
12+
import de.mossgrabers.convertwithmoss.core.INotifier;
13+
import de.mossgrabers.convertwithmoss.core.settings.MetadataSettingsUI;
14+
import de.mossgrabers.tools.ui.BasicConfig;
15+
import de.mossgrabers.tools.ui.panel.BoxPanel;
16+
import javafx.geometry.Orientation;
17+
import javafx.scene.Node;
18+
import javafx.scene.control.CheckBox;
19+
import javafx.scene.control.ScrollPane;
20+
21+
22+
/**
23+
* Settings of the MPC Key-group detector.
24+
*
25+
* @author Jürgen Moßgraber
26+
*/
27+
public class MPCKeygroupDetectorUI extends MetadataSettingsUI
28+
{
29+
private static final String MPC_IGNORE_LOOPS = "MPCIgnoreLoops";
30+
31+
private CheckBox ignoreLoopsCheckBox;
32+
private boolean ignoreLoops;
33+
34+
35+
/**
36+
* Constructor.
37+
*
38+
* @param prefix The prefix to use for the properties tags
39+
*/
40+
public MPCKeygroupDetectorUI (final String prefix)
41+
{
42+
super (prefix);
43+
}
44+
45+
46+
/** {@inheritDoc} */
47+
@Override
48+
public Node getEditPane ()
49+
{
50+
final BoxPanel panel = new BoxPanel (Orientation.VERTICAL);
51+
52+
////////////////////////////////////////////////////////////
53+
// Options
54+
55+
panel.createSeparator ("@IDS_MPC_OPTIONS");
56+
57+
this.ignoreLoopsCheckBox = panel.createCheckBox ("@IDS_MPC_IGNORE_LOOPS", "@IDS_MPC_IGNORE_LOOPS_TOOLTIP");
58+
59+
////////////////////////////////////////////////////////////
60+
// Metadata
61+
62+
this.addTo (panel);
63+
this.getSeparator ().getStyleClass ().add ("titled-separator-pane");
64+
65+
final ScrollPane scrollPane = new ScrollPane (panel.getPane ());
66+
scrollPane.fitToWidthProperty ().set (true);
67+
scrollPane.fitToHeightProperty ().set (true);
68+
return scrollPane;
69+
}
70+
71+
72+
/** {@inheritDoc} */
73+
@Override
74+
public void saveSettings (final BasicConfig config)
75+
{
76+
super.saveSettings (config);
77+
78+
config.setBoolean (MPC_IGNORE_LOOPS, this.ignoreLoopsCheckBox.isSelected ());
79+
}
80+
81+
82+
/** {@inheritDoc} */
83+
@Override
84+
public void loadSettings (final BasicConfig config)
85+
{
86+
super.loadSettings (config);
87+
88+
this.ignoreLoopsCheckBox.setSelected (config.getBoolean (MPC_IGNORE_LOOPS, false));
89+
}
90+
91+
92+
/** {@inheritDoc} */
93+
@Override
94+
public boolean checkSettingsUI (final INotifier notifier)
95+
{
96+
if (!super.checkSettingsUI (notifier))
97+
return false;
98+
99+
this.ignoreLoops = this.ignoreLoopsCheckBox.isSelected ();
100+
return true;
101+
}
102+
103+
104+
/** {@inheritDoc} */
105+
@Override
106+
public boolean checkSettingsCLI (final INotifier notifier, final Map<String, String> parameters)
107+
{
108+
if (!super.checkSettingsCLI (notifier, parameters))
109+
return false;
110+
111+
String value = parameters.remove (MPC_IGNORE_LOOPS);
112+
this.ignoreLoops = "1".equals (value);
113+
return true;
114+
}
115+
116+
117+
/** {@inheritDoc} */
118+
@Override
119+
public String [] getCLIParameterNames ()
120+
{
121+
final List<String> parameterNames = new ArrayList<> (Arrays.asList (super.getCLIParameterNames ()));
122+
parameterNames.add (MPC_IGNORE_LOOPS);
123+
return parameterNames.toArray (new String [parameterNames.size ()]);
124+
}
125+
126+
127+
/**
128+
* Should unsupported attributes be logged?
129+
*
130+
* @return True if they should be logged
131+
*/
132+
public boolean ignoreLoops ()
133+
{
134+
return this.ignoreLoops;
135+
}
136+
}

src/main/resources/Strings.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
TITLE=ConvertWithMoss 15.5.1
1+
TITLE=ConvertWithMoss 15.5.2
22

33
##################################################################################
44
#
@@ -415,6 +415,9 @@ IDS_KMP_WRITE_KMP_FOR_EACH_GROUP_TOOLTIP=Writes a KMP for each group in the sour
415415
IDS_MPC_LAYER_LIMIT=Limit layers to
416416
IDS_MPC_LAYER_LIMIT_4=4
417417
IDS_MPC_LAYER_LIMIT_8=8 (requires MPC Firmware 3.4 or later)
418+
IDS_MPC_OPTIONS=Options
419+
IDS_MPC_IGNORE_LOOPS=Ignore Loops
420+
IDS_MPC_IGNORE_LOOPS_TOOLTIP=Ignores (removes) all loops from the detected samples.
418421

419422
IDS_MASCHINE_OPTIONS=Options
420423
IDS_MASCHINE_SCAN_FOR_MSND=Scan for Maschine 1 MSND files

0 commit comments

Comments
 (0)