LSCP response format

You name it!
Post Reply
svenmeier
Newbie
Posts: 2
Joined: Fri Apr 11, 2008 9:20 am

LSCP response format

Post by svenmeier » Fri Apr 11, 2008 9:59 am

Hi all,

I'm currently working on a small integration of Linuxsampler in the jOrgan project:
For easier setup the program will be able to send LSCP scripts to a running Linuxsampler (these LSCP scripts can easily be created with JSampler).

This works great! :)

Now I'd like to display error messages to the user about possible problems in the LSCP script. So the result of each command sent to Linuxsampler is scanned for an ERR or WRN prefix.
Regretfully a single-line or multi-line result is not distinguishable without knowing the result format of a command:

C: "GET AVAILABLE_AUDIO_OUTPUT_DRIVERS"
S: "2"

C: "GET AUDIO_OUTPUT_DRIVER INFO ALSA"
S: "DESCRIPTION: Advanced Linux Sound Architecture"
"VERSION: 1.0"
"PARAMETERS: DRIVER,CHANNELS,SAMPLERATE,ACTIVE,FRAGMENTS, FRAGMENTSIZE,CARD"
"."

Without knowing wether a command returns a single-line or multi-line result jOrgan cannot consume the whole result sent back from Linuxsampler without potentially blocking :cry: .

Did someone else run into this problem? Is this something where LSCP could be improved?

Thanks

Sven

sbenno
Developer
Posts: 80
Joined: Wed Jan 23, 2008 8:30 pm

Re: LSCP response format

Post by sbenno » Fri Apr 11, 2008 8:35 pm

I'd suggesto to just write a small app that parses the original LSCP file, sends one line at time to LinuxSampler and check every response if it contains WRN or ERR.

User avatar
cuse
Developer
Posts: 366
Joined: Wed Jan 23, 2008 10:07 pm
Location: Germany

Re: LSCP response format

Post by cuse » Mon Apr 14, 2008 7:31 am

The LSCP specification clearly defines which command returns a multi line and which one returns a single line response. There's no command that could return both response types.

svenmeier
Newbie
Posts: 2
Joined: Fri Apr 11, 2008 9:20 am

Re: LSCP response format

Post by svenmeier » Mon Apr 14, 2008 8:55 am

Well, I'd like to parse the result of the commands without knowing which command has which response type.
I'm not an expert on designing computer protocols but it seems to me that the LSCP could be improved, e.g. it could always return OK (or WRN) even after a single or multi line result.

Sven

grishata
Developer
Posts: 138
Joined: Thu Jan 24, 2008 7:21 pm
Location: Bulgaria
Contact:

Re: LSCP response format

Post by grishata » Sun Apr 20, 2008 2:06 pm

Well, I'd like to parse the result of the commands without knowing which command has which response type.
If blocking is the only problem you have I suppose you can solve that with some kind of a workaround. I would suggest to try the lscp command QUIT to close the connection at the and of the script. If this doesn't work for you, you can use the SET ECHO 1, so LS will echo the commands you send before every response. Then add some lscp command to the end of the script, which return a single line like GET VOLUME and then check the LinuxSampler response for that command. Of course, make sure you don't have that command in the script before that, you don't need GET commands in such lscp scripts, so this is not a problem. Or just try to find some other workaround like that :). Hope that helps.

Of course, you can also consider controlling LS without using scripts, by using jlscp instead. :) I believe the API is well documented.

pyriet
Newbie
Posts: 1
Joined: Fri Mar 26, 2010 4:24 am

Re: LSCP response format

Post by pyriet » Fri Mar 26, 2010 4:41 am

hello,
svenmeier wrote:Well, I'd like to parse the result of the commands without knowing which command has which response type.
I'm not an expert on designing computer protocols but it seems to me that the LSCP could be improved, e.g. it could always return OK (or WRN) even after a single or multi line result.
i agree, this would be an improvement, that would make it simpler to write a more general parsing function on the client-side. now this would require a workaround like in the previous post, knowledge (a table) of commands and their responses, or some timeout based mechanism

also, single-line lists like the following one:
LIST MIDI_INPUT_DEVICES
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
could be returned with one list element on it's own line. this doesn't generate more traffic since a comma (,) takes up one character, just like a newline (\n).

anyway, nothing that can't be worked around, but something that can be taken in account if there ever comes an overhaul of the LSCP protocol.

thanks for LS, great software!

greetz

Post Reply