--- linuxsampler/trunk/src/network/lscpserver.cpp 2004/07/25 23:27:41 211 +++ linuxsampler/trunk/src/network/lscpserver.cpp 2004/08/17 20:35:04 219 @@ -147,7 +147,8 @@ if (FD_ISSET((*iter).hSession, &selectSet)) { //Was it this socket? if (GetLSCPCommand(iter)) { //Have we read the entire command? dmsg(3,("LSCPServer: Got command on socket %d, calling parser.\n", currentSocket)); - yylex_init(&((*iter).pScanner)); //FIXME: should me moved out of this loop and initialized only when a new session is created + int dummy; // just a temporary hack to fulfill the restart() function prototype + restart(NULL, dummy); // restart the 'scanner' currentSocket = (*iter).hSession; //a hack if ((*iter).bVerbose) { // if echo mode enabled AnswerClient(bufferedCommands[currentSocket]); @@ -173,8 +174,6 @@ } NotifyBufferMutex.Unlock(); } - //It will never get here anyway - //yylex_destroy(yyparse_param.pScanner); } void LSCPServer::CloseConnection( std::vector::iterator iter ) { @@ -193,7 +192,6 @@ bufferedNotifies.erase(socket); close(socket); NotifyMutex.Unlock(); - //yylex_destroy((*iter).pScanner); } void LSCPServer::SendLSCPNotify( LSCPEvent event ) { @@ -743,14 +741,14 @@ DeviceCreationParameter* pParameter = MidiInputDeviceFactory::GetDriverParameter(Driver, Parameter); result.Add("TYPE", pParameter->Type()); result.Add("DESCRIPTION", pParameter->Description()); - result.Add("MANDATORY", pParameter->Mandatory()); - result.Add("FIX", pParameter->Fix()); - result.Add("MULTIPLICITY", pParameter->Multiplicity()); - if (pParameter->Depends()) result.Add("DEPENDS", pParameter->Depends()); - if (pParameter->Default()) result.Add("DEFAULT", pParameter->Default()); - if (pParameter->RangeMin()) result.Add("RANGE_MIN", pParameter->RangeMin()); - if (pParameter->RangeMax()) result.Add("RANGE_MAX", pParameter->RangeMax()); - if (pParameter->Possibilities()) result.Add("POSSIBILITIES", pParameter->Possibilities()); + result.Add("MANDATORY", (pParameter->Mandatory()) ? "true" : "false"); + result.Add("FIX", (pParameter->Fix()) ? "true" : "false"); + result.Add("MULTIPLICITY", (pParameter->Multiplicity()) ? "true" : "false"); + if (pParameter->Depends()) result.Add("DEPENDS", *pParameter->Depends()); + if (pParameter->Default()) result.Add("DEFAULT", *pParameter->Default()); + if (pParameter->RangeMin()) result.Add("RANGE_MIN", *pParameter->RangeMin()); + if (pParameter->RangeMax()) result.Add("RANGE_MAX", *pParameter->RangeMax()); + if (pParameter->Possibilities()) result.Add("POSSIBILITIES", *pParameter->Possibilities()); } catch (LinuxSamplerException e) { result.Error(e); @@ -765,14 +763,14 @@ DeviceCreationParameter* pParameter = AudioOutputDeviceFactory::GetDriverParameter(Driver, Parameter); result.Add("TYPE", pParameter->Type()); result.Add("DESCRIPTION", pParameter->Description()); - result.Add("MANDATORY", pParameter->Mandatory()); - result.Add("FIX", pParameter->Fix()); - result.Add("MULTIPLICITY", pParameter->Multiplicity()); - if (pParameter->Depends()) result.Add("DEPENDS", pParameter->Depends()); - if (pParameter->Default()) result.Add("DEFAULT", pParameter->Default()); - if (pParameter->RangeMin()) result.Add("RANGE_MIN", pParameter->RangeMin()); - if (pParameter->RangeMax()) result.Add("RANGE_MAX", pParameter->RangeMax()); - if (pParameter->Possibilities()) result.Add("POSSIBILITIES", pParameter->Possibilities()); + result.Add("MANDATORY", (pParameter->Mandatory()) ? "true" : "false"); + result.Add("FIX", (pParameter->Fix()) ? "true" : "false"); + result.Add("MULTIPLICITY", (pParameter->Multiplicity()) ? "true" : "false"); + if (pParameter->Depends()) result.Add("DEPENDS", *pParameter->Depends()); + if (pParameter->Default()) result.Add("DEFAULT", *pParameter->Default()); + if (pParameter->RangeMin()) result.Add("RANGE_MIN", *pParameter->RangeMin()); + if (pParameter->RangeMax()) result.Add("RANGE_MAX", *pParameter->RangeMax()); + if (pParameter->Possibilities()) result.Add("POSSIBILITIES", *pParameter->Possibilities()); } catch (LinuxSamplerException e) { result.Error(e); @@ -1283,6 +1281,16 @@ return result.Produce(); } +/** + * Will be called by the parser to reset the whole sampler. + */ +String LSCPServer::ResetSampler() { + dmsg(2,("LSCPServer: ResetSampler()\n")); + pSampler->Reset(); + LSCPResultSet result; + return result.Produce(); +} + /** * Will be called by the parser to subscribe a client (frontend) on the * server for receiving event messages.