From 2dfe6c2858312f626e4f21f15c495db864b96f13 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 26 Nov 2025 12:29:05 +0000 Subject: [PATCH 1/3] Fix NullPointerException when MIDI devices unavailable Add -nomusic flag to MochaDoom to prevent crash when running on systems without MIDI devices. The error occurred in DavidMusicModule.sendSysexMessage() when VolumeScalingReceiver returns null due to unavailable MIDI hardware. Fixes #3 --- main.nf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.nf b/main.nf index 679fc86..c0674ac 100644 --- a/main.nf +++ b/main.nf @@ -71,8 +71,10 @@ process playDoom { val true script: + // Use -nomusic to prevent NullPointerException when MIDI devices are unavailable + // See: https://github.com/nextflow-io/doom/issues/3 """ - java -jar $projectDir/lib/mochadoom.jar -iwad $projectDir/doom1.wad + java -jar $projectDir/lib/mochadoom.jar -iwad $projectDir/doom1.wad -nomusic """ } From 838c66a453585a0c7650e337dcb2494f4f0a3fdd Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 26 Nov 2025 16:52:12 +0000 Subject: [PATCH 2/3] Add --nomusic parameter for systems without MIDI devices Instead of hardcoding -nomusic flag, add a params.nomusic option that users can enable when running on systems without MIDI audio hardware. Also add troubleshooting section to README documenting the NullPointerException error and the workaround. Fixes #3 --- README.md | 16 ++++++++++++++++ main.nf | 7 ++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 87bf5b6..dc8854a 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,19 @@ nextflow run doom > [!NOTE] > All credit for the Java implementation go to this project: https://github.com/gaborbata/vanilla-mocha-doom + +## Troubleshooting + +### Sound error: NullPointerException + +If you see an error like: + +``` +Cannot invoke "javax.sound.midi.Receiver.send(javax.sound.midi.MidiMessage, long)" because "receiver" is null +``` + +This occurs on systems without MIDI audio devices. Run with the `--nomusic` flag to disable music: + +```bash +nextflow run doom --nomusic +``` diff --git a/main.nf b/main.nf index c0674ac..61b323c 100644 --- a/main.nf +++ b/main.nf @@ -1,5 +1,7 @@ #!/usr/bin/env nextflow +params.nomusic = false + process printLogo { output: stdout @@ -71,10 +73,9 @@ process playDoom { val true script: - // Use -nomusic to prevent NullPointerException when MIDI devices are unavailable - // See: https://github.com/nextflow-io/doom/issues/3 + def musicFlag = params.nomusic ? '-nomusic' : '' """ - java -jar $projectDir/lib/mochadoom.jar -iwad $projectDir/doom1.wad -nomusic + java -jar $projectDir/lib/mochadoom.jar -iwad $projectDir/doom1.wad $musicFlag """ } From 595bac313a9aff0ae7facfdfa45501d396e4aa10 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 27 Nov 2025 16:43:31 +0000 Subject: [PATCH 3/3] Add --nosound parameter to disable all audio Add params.nosound option that disables all sound (music and effects). The --nosound flag takes precedence over --nomusic. Updated README to document both options. --- README.md | 5 +++-- main.nf | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dc8854a..26d0da1 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,9 @@ If you see an error like: Cannot invoke "javax.sound.midi.Receiver.send(javax.sound.midi.MidiMessage, long)" because "receiver" is null ``` -This occurs on systems without MIDI audio devices. Run with the `--nomusic` flag to disable music: +This occurs on systems without MIDI audio devices. Run with `--nomusic` to disable music only, or `--nosound` to disable all audio: ```bash -nextflow run doom --nomusic +nextflow run doom --nomusic # Disable music only +nextflow run doom --nosound # Disable all sound ``` diff --git a/main.nf b/main.nf index 61b323c..224b651 100644 --- a/main.nf +++ b/main.nf @@ -1,6 +1,7 @@ #!/usr/bin/env nextflow params.nomusic = false +params.nosound = false process printLogo { output: @@ -73,9 +74,9 @@ process playDoom { val true script: - def musicFlag = params.nomusic ? '-nomusic' : '' + def soundFlags = params.nosound ? '-nosound' : (params.nomusic ? '-nomusic' : '') """ - java -jar $projectDir/lib/mochadoom.jar -iwad $projectDir/doom1.wad $musicFlag + java -jar $projectDir/lib/mochadoom.jar -iwad $projectDir/doom1.wad $soundFlags """ }