quippy-git / javamod

JavaMod Player
https://quippy-git.github.io/javamod/
GNU General Public License v3.0
9 stars 2 forks source link

Can't set some of params. #3

Closed FireFox1121 closed 1 year ago

FireFox1121 commented 1 year ago

I was created a new project and tried this JAR as library in project, but I can't loop song:

props.setProperty(ModContainer.PROPERTY_PLAYER_ISP, ModContainer.DEFAULT_INTERPOLATION_INDEX);
props.setProperty(ModContainer.PROPERTY_PLAYER_STEREO, ModContainer.DEFAULT_CHANNEL);
props.setProperty(ModContainer.PROPERTY_PLAYER_WIDESTEREOMIX, "false");
props.setProperty(ModContainer.PROPERTY_PLAYER_NOISEREDUCTION, ModContainer.DEFAULT_NOISEREDUCTION);
props.setProperty(ModContainer.PROPERTY_PLAYER_NOLOOPS, "4"); // No loop, player stops after song end
props.setProperty(ModContainer.PROPERTY_PLAYER_MEGABASS, "false");
props.setProperty(ModContainer.PROPERTY_PLAYER_BITSPERSAMPLE, ModContainer.DEFAULT_BITSPERSAMPLE);
props.setProperty(ModContainer.PROPERTY_PLAYER_FREQUENCY, ModContainer.DEFAULT_SAMPLERATE);
props.setProperty(ModContainer.PROPERTY_PLAYER_MSBUFFERSIZE, ModContainer.DEFAULT_MSBUFFERSIZE);
props.setProperty(ModContainer.PROPERTY_PLAYER_MAXNNACHANNELS, ModContainer.DEFAULT_MAXNNACHANNELS);

I discovered public static final int PLAYER_LOOP_LOOPSONG = 0x04; flag, that I can set from GUI via "Loop song" in "Setup..." window, but i can't even set loop via command-line: ./javamod-3.4.jar de.quippy.javamod.main.CommandLine -l4 ./TEST.XM

Also, i can't set volume in command-line: ./javamod-3.4.jar de.quippy.javamod.main.CommandLine -v0.4 ./TEST.XM Returns:

Error occured:
java.lang.RuntimeException: Unknown parameter: v
        at de.quippy.javamod.main.CommandLine.parseParameters(Unknown Source)
        at de.quippy.javamod.main.CommandLine.main(Unknown Source)
quippy-git commented 1 year ago

I must admit that I do not really test the command line.

The fixed version (with other fixes) is on the way...

quippy-git commented 1 year ago

GIT-Release will take a while. New JAR is online here: https://quippy.de/mod_en.php

FireFox1121 commented 1 year ago

Loop works fine now, but volume still not controlling. (But without argument error now)

And I think volume control should be like "ModContainer.PROPERTY_PLAYER_VOLUME", not hardcoded float parse from command-line.

quippy-git commented 1 year ago

Did the fix for the fix - sorry, volume and balance change cannot succeed when Source Line is not yet present, but was then not done again because value did not change. Please download again from https://quippy.de/mod_en.php

So far I do not intend to add the global line volume to a property. And to set it initially there must be some kind of setting from command line. I always have to parse that in some way.

FireFox1121 commented 1 year ago

Downloaded again, volume control still not work. By the way, creating Mixer from code and using mixer.setVolume(0.4F); not work properly too. mixer.setBalance(0.8F); also broken too. But from GUI I can control the volume, not balance.

quippy-git commented 1 year ago

Cannot reproduce. Volume-control works with me: java -cp javamod.jar de.quippy.javamod.main.CommandLine -r48000 -b16 -s+ -i3 -t30 -w+ -n- -m+ -d- -l0 -a1024 -h- -j- -v0.1 MODFILE

It is quite silent then.... Maybe try V0.01 then? However it could be, that the line created on your machine does not support gain control. Cannot test that from here then.

Are you sure, you really re-downloaded and did nor receive the JAR file from the browser cache? File size should be 1,328,490 bytes

FireFox1121 commented 1 year ago

Yes, i re-downloaded JAR from website: Size: 1.3 MiB (1,328,490)

Parameter -v0.01 still not affect. Even -v0.0.

However it could be, that the line created on your machine does not support gain control. Cannot test that from here then.

But I can control volume from GUI and that work fine.

quippy-git commented 1 year ago

I am a bit lost then. As said, volume control via command line parameter works here now, so IMHO no coding problem. Which JDK-Version do you use on what OS? I am on windows 10 with openjdk 18.0.1.1

On the other hand, if it works with GUI, why not on command line...

FireFox1121 commented 1 year ago

I'm using Debian 12 with OpenJDK 17.

openjdk 17.0.7 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.7+7-Debian-1deb12u1, mixed mode, sharing)
quippy-git commented 1 year ago

OK, that should be fine - I will test on my OpenSuse tumbleweed later as I encountered some differences between windows and linux already.

But to give us a hint I added some output to the setVolume (error messages...) Please do me a favour and try that one. If things work, you should see an additional output like this one

SourceLine NULL, volume 0.1 NOT set (<-- this is indented, if it shows up only once) Volume 0.1 set

FireFox1121 commented 1 year ago

For some reason, I can change volume gain now. Also using controls from code mixer.setVolume(0.2F) and mixer.setBalance(1.0F) works too.

Returns:

SourceLine NULL, volume 0.2 NOT set
Volume 0.2 set
quippy-git commented 1 year ago

Nice. Thanks for testing this.

I re-uploaded the version without the output. Release will be done later. After release I will close this one.

FireFox1121 commented 1 year ago

btw, I can't control volume gain and balance in 24 and 32 BITPERSAMPLE. But in 8 and 16 BITPERSAMPLE works fine.

quippy-git commented 1 year ago

The XM is now read correctly. It had instruments without samples and indicated that with 0xFFFF instead of 0 - but I read the amount of samples as "unsigned word" and got 65535 - not -1... Reading so many samples might end in a very long loop, till memory is out.

Uploaded the new jar.

Regarding the volume / balance control - it might be that you only have a physical 8 and 16 bit output line available - and when using 24 or 32 bit something funny happens or at least GAIN_control is not available for those lines. I have to dig into that one. I can check with 32 bit output line - I haven't that myself.

FireFox1121 commented 1 year ago

Well, I'll use 16 bitpersample then (i use bluetooth headset, maybe i only have 8/16 bit output line with control), and I closed issue about .XM file.

FireFox1121 commented 1 year ago

Also weird visual GUI thing on loop enabled: Timer not resetting to zero (continuing count) and progressbar still filled after end.

quippy-git commented 1 year ago

Also weird visual GUI thing on loop enabled: Timer not resetting to zero (continuing count) and progressbar still filled after end.

Yes, that is not nice, but currently not easy to avoid. The modmixer, which is doing the loop, does not "know" about the gui and the gui has no idea that the mod did a restart. I will make up my mind on that one.

quippy-git commented 1 year ago

btw, I can't control volume gain and balance in 24 and 32 BITPERSAMPLE. But in 8 and 16 BITPERSAMPLE works fine.

As I expected. On Windows I get a "Format not supported" when trying use 24 or 32 Bit depth. However, on Linux I will receive a line but that does not support MASTER_GAIN. So sorry, no help on that one possible...

quippy-git commented 1 year ago

Also weird visual GUI thing on loop enabled: Timer not resetting to zero (continuing count) and progressbar still filled after end.

Yes, that is not nice, but currently not easy to avoid. The modmixer, which is doing the loop, does not "know" about the gui and the gui has no idea that the mod did a restart. I will make up my mind on that one.

I fixed that for you. When mod is looping, timecode is now reset.

quippy-git commented 1 year ago

As all seems fixed to me, this is closed now. The release 3.5 is available now.