swesterfeld / liquidsfz

SFZ Sampler
Mozilla Public License 2.0
86 stars 12 forks source link

Support use as daemon #32

Closed hobzcalvin closed 2 years ago

hobzcalvin commented 2 years ago

Happy to move this to a discussion board etc. if there is one!

I've created a systemd service file to run liquidsfz as a daemon:

[Unit]
Description=liquidsfz
After=jackd.service

[Service]
Type=simple
Restart=always
LimitRTPRIO=infinity
LimitMEMLOCK=infinity
User=grant
ExecStart=/usr/local/bin/liquidsfz /home/grant/projects/trees/harp/Harp_Normal.sfz

[Install]
WantedBy=multi-user.target

When I try to start it, I get this:

Jun 24 15:49:49 flowbuntu systemd[1]: Started liquidsfz.
Jun 24 15:49:49 flowbuntu liquidsfz[22341]: [liquidsfz::warning] /home/grant/projects/trees/harp/Harp_Normal.sfz: line 18: unsupported opcode 'ampeg_dynamic'
Jun 24 15:49:49 flowbuntu liquidsfz[22341]: [liquidsfz::warning] /home/grant/projects/trees/harp/Harp_Normal.sfz: line 36: unsupported opcode 'group_label'
Jun 24 15:49:49 flowbuntu liquidsfz[22341]: [liquidsfz::warning] /home/grant/projects/trees/harp/Harp_Normal.sfz: line 1211: unsupported opcode 'group_label'
Jun 24 15:49:49 flowbuntu liquidsfz[22341]: [3.6K blob data]
Jun 24 15:49:49 flowbuntu liquidsfz[22341]: liquidsfz>
Jun 24 15:49:49 flowbuntu systemd[1]: liquidsfz.service: Deactivated successfully.
Jun 24 15:49:49 flowbuntu systemd[1]: liquidsfz.service: Scheduled restart job, restart counter is at 5.
Jun 24 15:49:49 flowbuntu systemd[1]: Stopped liquidsfz.

"Deactivated successfully" is nice, but not what I want! I assume this is because of the interactive shell nature of the application, but I don't really know. Maybe there's a service file setting that will fix this for me?

If not, a command line flag to disable the interactive shell would be great. Thanks.

hobzcalvin commented 2 years ago

Update: definitely happening because readline gets an EOF from the stdin set up by systemd. I’ll either figure out the service file setting I need and post it here or submit a PR for a flag to disable readline.

swesterfeld commented 2 years ago

You could probably use a script like this to get what you want:

while : ; do echo sleep 1000; done|liquidsfz ~/sfz/SalamanderGrandPianoV3_44.1khz16bit/SalamanderGrandPianoV3.sfz

But if there is something to be added to liquidsfz to make this easier, I generally would consider merging it. Is there any prior art (like other jack clients / audio tools)? How do they handle this case?