|
From: Vladimir S. <ha...@so...> - 2004-06-20 17:20:48
|
Hi Rui,
Thanks!
I'll put that code to work asap (after i fix CREATE AUDIO_OUTPUT_DEVICE).
I should have no problems now with the parser now after all that help
from Simon.
Regards,
Vladimir
Rui Nuno Capela wrote:
>Hi,
>
>linuxsampler 0.2.x:
>
>* Changed LSCPServer::LoadInstrument() signature, which adds a new
> boolean argument (bool bBackground) where the loading mode maybe
> selected, whether modal (the default), or modeless (in background).
>
>This means that the LOAD INSTRUMENT command is back to the old modal
>behavior, and the new LOAD_BACKGROUND INSTRUMENT just waits to be
>implemented. These will be the intended mappings:
>
> LOAD INSTRUMENT <file> <index> <channel>
> -> LoadInstrument(file, index, channel, false);
>
> LOAD_BACKGROUND INSTRUMENT <file> <index> <channel>
> -> LoadInstrument(file, index, channel, true);
>
>So, I'll ask the you lex/yacc gurus to put it to work asap :)
>
>OTOH, this post of mine didn't get to the list, AFAICT, so I'll repeat it
>here...
>
>Hi Vladimir,
>Christian,
>Simon,
>everybody
>
>About the LOAD INSTRUMENT command, I've been doing simple implementation
>changes (see attached patch). However I've stumbled on the
>(f)lex/yacc/bison mysteries.
>
>The fault is that my flex and bison installed packages probably aren't up
>to par--they fail miserably while doing `make parser` under src/network.
>I've give up for now.
>
>My patch does try to implement the background mode for the LOAD
>INSTRUMENT. However, I've bee trying to implement the following syntax:
>
> LOAD INSTRUMENT <filename> <index> <channel> BACKGROUND
>
>where I've introduced the BACKGROUND token to flag the modeless option.
>I've noticed that Vladimir suggested a new LOAD_BACKGROUND verb instead of
>an optional trailing particle like me. Of course, I prefer mine, but our
>dictator must be heard ;)
>
>Either way, the main change, which I think is about to stay, goes in
>lscpserver.h/cpp, where I added a new boolean argument to
>LSCPServer::LoadInstrument method (bool bBackground), where one opts for
>the precise loading mode (default is false, that is modal).
>
>Please try the patch and please help me on putting that damned flex/bison
>stuff to work.
>
>About the new quoting requirements, I'm all for it. Incidentally I was
>predicting that myself, the bare proof is that liblscp implementation is
>already prepared on parsing quoted responses. It even does not matter if
>are single (') our double (").
>
>However I personally find this new quoting requirement rather strange.
>Forgive my lex/yacc ignorance, but is it really unavoidable? Is it really
>impossible having a syntax where a token is distinguishable from a
>arbitrary literal value? Is it a lex/yacc fundamental limitation or what?
>I'd rather have quotes optional, and only required where strictly
>necessary, like e.g. in comma-separated list items.
>
>Bye now.
>
>
>------------------------------------------------------------------------
>
>diff -duPNr linuxsampler-0.2-cvs20040619a/src/network/lscpserver.cpp linuxsampler-0.2-cvs20040619b/src/network/lscpserver.cpp
>--- linuxsampler-0.2-cvs20040619a/src/network/lscpserver.cpp 2004-06-19 20:16:49.000000000 +0100
>+++ linuxsampler-0.2-cvs20040619b/src/network/lscpserver.cpp 2004-06-19 23:17:54.332470712 +0100
>@@ -132,7 +132,7 @@
> /**
> * Will be called by the parser to load an instrument.
> */
>-String LSCPServer::LoadInstrument(String Filename, uint uiInstrument, uint uiSamplerChannel) {
>+String LSCPServer::LoadInstrument(String Filename, uint uiInstrument, uint uiSamplerChannel, bool bBackground) {
> dmsg(2,("LSCPServer: LoadInstrument(Filename=%s,Instrument=%d,SamplerChannel=%d)\n", Filename.c_str(), uiInstrument, uiSamplerChannel));
> LSCPResultSet result;
> try {
>@@ -140,8 +140,11 @@
> if (!pSamplerChannel) throw LinuxSamplerException("Index out of bounds");
> Engine* pEngine = pSamplerChannel->GetEngine();
> if (!pEngine) throw LinuxSamplerException("No engine loaded on channel");
>- LSCPLoadInstrument *pLoadInstrument = new LSCPLoadInstrument(pEngine, Filename.c_str(), uiInstrument);
>- pLoadInstrument->StartThread();
>+ if (bBackground) {
>+ LSCPLoadInstrument *pLoadInstrument = new LSCPLoadInstrument(pEngine, Filename.c_str(), uiInstrument);
>+ pLoadInstrument->StartThread();
>+ }
>+ else pEngine->LoadInstrument(Filename.c_str(), uiInstrument);
> }
> catch (LinuxSamplerException e) {
> result.Error(e);
>diff -duPNr linuxsampler-0.2-cvs20040619a/src/network/lscpserver.h linuxsampler-0.2-cvs20040619b/src/network/lscpserver.h
>--- linuxsampler-0.2-cvs20040619a/src/network/lscpserver.h 2004-06-19 20:16:49.000000000 +0100
>+++ linuxsampler-0.2-cvs20040619b/src/network/lscpserver.h 2004-06-19 23:17:54.332470712 +0100
>@@ -59,7 +59,7 @@
> // Methods called by the parser
> String CreateAudioOutputDevice(String Driver, std::map<String,String> Parameters);
> String DestroyAudioOutputDevice(uint DeviceIndex);
>- String LoadInstrument(String Filename, uint uiInstrument, uint uiSamplerChannel);
>+ String LoadInstrument(String Filename, uint uiInstrument, uint uiSamplerChannel, bool bBackground = false);
> String LoadEngine(String EngineName, uint uiSamplerChannel);
> String GetChannels();
> String AddChannel();
>diff -duPNr linuxsampler-0.2-cvs20040619a/src/network/lscp.y linuxsampler-0.2-cvs20040619b/src/network/lscp.y
>--- linuxsampler-0.2-cvs20040619a/src/network/lscp.y 2004-06-14 20:33:15.000000000 +0100
>+++ linuxsampler-0.2-cvs20040619b/src/network/lscp.y 2004-06-19 23:17:54.332470712 +0100
>@@ -59,6 +59,7 @@
> %token INSTRUMENT ENGINE
> %token AUDIO_OUTPUT_CHANNEL AUDIO_OUTPUT_CHANNEL_PARAMETER AUDIO_OUTPUT_DEVICE AUDIO_OUTPUT_DEVICES AUDIO_OUTPUT_DEVICE_PARAMETER AUDIO_OUTPUT_DRIVER AUDIO_OUTPUT_DRIVER_PARAMETER MIDI_INPUT_PORT MIDI_INPUT_CHANNEL MIDI_INPUT_TYPE VOLUME
> %token BYTES PERCENTAGE
>+%token BACKGROUND
>
> %type <Dotnum> volume
> %type <Number> sampler_channel instrument_index udp_port audio_output_channel midi_input_channel
>@@ -156,7 +157,8 @@
> list_instruction : AUDIO_OUTPUT_DEVICES { $$ = LSCPSERVER->GetAudioOutputDevices(); }
> ;
>
>-load_instr_args : filename SP instrument_index SP sampler_channel { $$ = LSCPSERVER->LoadInstrument($1, $3, $5); }
>+load_instr_args : filename SP instrument_index SP sampler_channel { $$ = LSCPSERVER->LoadInstrument($1, $3, $5, false); }
>+ | filename SP instrument_index SP sampler_channel SP BACKGROUND { $$ = LSCPSERVER->LoadInstrument($1, $3, $5, true); }
> ;
>
> load_engine_args : engine_name SP sampler_channel { $$ = LSCPSERVER->LoadEngine($1, $3); }
>
|