/[svn]/linuxsampler/trunk/src/network/lscpserver.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/network/lscpserver.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 35 by schoenebeck, Fri Mar 5 13:46:15 2004 UTC revision 143 by capela, Wed Jun 23 18:54:08 2004 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003 by Benno Senoner and Christian Schoenebeck         *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *                                                                         *   *                                                                         *
7   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
8   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 31  Line 31 
31  #include <arpa/inet.h>  #include <arpa/inet.h>
32  #include <netdb.h>  #include <netdb.h>
33    
34    #include "lscp.h"
35  #include "lscpparser.h"  #include "lscpparser.h"
36  #include "../thread.h"  #include "../Sampler.h"
37  #include "../audiothread.h"  #include "../common/Thread.h"
38    
39  /// TCP Port on which the server should listen for connection requests.  /// TCP Port on which the server should listen for connection requests.
40  #define LSCP_PORT 8888  #define LSCP_PORT 8888
41    
42    using namespace LinuxSampler;
43    
44  /// Handle for a client connection (FIXME: doesn't work for more than one network connections of course, thus has to be included to the yyparse() parameters instead).  /// Handle for a client connection (FIXME: doesn't work for more than one network connections of course, thus has to be included to the yyparse() parameters instead).
45  extern int hSession;  extern int hSession;
46    
# Line 51  extern int yylex_destroy(yyscan_t yyscan Line 54  extern int yylex_destroy(yyscan_t yyscan
54   */   */
55  class LSCPServer : public Thread {  class LSCPServer : public Thread {
56      public:      public:
57          LSCPServer(AudioThread* pEngine);          LSCPServer(Sampler* pSampler);
58    
59          // Methods called by the parser          // Methods called by the parser
60          String LoadInstrument(String Filename, uint Instrument, uint SamplerChannel);          String DestroyAudioOutputDevice(uint DeviceIndex);
61          String LoadEngine(String EngineName, uint SamplerChannel);          String LoadInstrument(String Filename, uint uiInstrument, uint uiSamplerChannel, bool bBackground = false);
62            String LoadEngine(String EngineName, uint uiSamplerChannel);
63          String GetChannels();          String GetChannels();
64          String AddChannel();          String AddChannel();
65          String RemoveChannel(uint SamplerChannel);          String RemoveChannel(uint uiSamplerChannel);
66          String GetAvailableEngines();          String GetAvailableEngines();
67          String GetEngineInfo(String EngineName);          String GetEngineInfo(String EngineName);
68          String GetChannelInfo(uint SamplerChannel);          String GetChannelInfo(uint uiSamplerChannel);
69          String GetVoiceCount(uint SamplerChannel);          String GetVoiceCount(uint uiSamplerChannel);
70          String GetStreamCount(uint SamplerChannel);          String GetStreamCount(uint uiSamplerChannel);
71          String GetBufferFill(fill_response_t ResponseType, uint SamplerChannel);          String GetBufferFill(fill_response_t ResponseType, uint uiSamplerChannel);
72          String SetAudioOutputType(audio_output_type_t AudioOutputType, uint SamplerChannel);          String GetAvailableAudioOutputDrivers();
73          String SetAudioOutputChannel(uint AudioOutputChannel, uint SamplerChannel);          String GetAudioOutputDriverInfo(String Driver);
74          String SetMIDIInputPort(String MIDIInputPort, uint Samplerchannel);  #ifdef __GNUC__
75          String SetMIDIInputChannel(uint MIDIChannel, uint SamplerChannel);          typedef std::map<String,String> StringMap; // nasty workaround for a GCC bug (see GCC bug #15980, #57)
76          String SetVolume(double Volume, uint SamplerChannel);          String GetAudioOutputDriverParameterInfo(String Driver, String Parameter, std::map<String,String> DependencyList = StringMap());
77          String ResetChannel(uint SamplerChannel);          String CreateAudioOutputDevice(String Driver, std::map<String,String> Parameters = StringMap());
78          String SubscribeNotification(uint UDPPort);  #else
79          String UnsubscribeNotification(String SessionID);          String GetAudioOutputDriverParameterInfo(String Driver, String Parameter, std::map<String,String> DependencyList = std::map<String,String>());
80            String CreateAudioOutputDevice(String Driver, std::map<String,String> Parameters = std::map<String,String>());
81    #endif // __GNUC__
82            String GetAudioOutputDeviceCount();
83            String GetAudioOutputDevices();
84            String GetAudioOutputDeviceInfo(uint DeviceIndex);
85            String GetAudioOutputChannelInfo(uint DeviceId, uint ChannelId);
86            String GetAudioOutputChannelParameterInfo(uint DeviceId, uint ChannelId, String ParameterName);
87            String SetAudioOutputChannelParameter(uint DeviceId, uint ChannelId, String ParamKey, String ParamVal);
88            String SetAudioOutputDeviceParameter(uint DeviceIndex, String ParamKey, String ParamVal);
89            String SetAudioOutputChannel(uint ChannelAudioOutputChannel, uint AudioOutputDeviceInputChannel, uint uiSamplerChannel);
90            String SetAudioOutputType(String AudioOutputDriver, uint uiSamplerChannel);
91            String SetMIDIInputType(String MidiInputDriver, uint uiSamplerChannel);
92            String SetMIDIInputPort(String MIDIInputPort, uint uiSamplerchannel);
93            String SetMIDIInputChannel(uint MIDIChannel, uint uiSamplerChannel);
94            String SetAudioOutputDevice(uint AudioDeviceId, uint SamplerChannel);
95            String SetVolume(double Volume, uint uiSamplerChannel);
96            String ResetChannel(uint uiSamplerChannel);
97            String SubscribeNotification(event_t Event);
98            String UnsubscribeNotification(event_t Event);
99          void   AnswerClient(String ReturnMessage);          void   AnswerClient(String ReturnMessage);
100      protected:      protected:
101          int          hSocket;          int            hSocket;
102          sockaddr_in  SocketAddress;          sockaddr_in    SocketAddress;
103          AudioThread* pEngine; // FIXME: as long as we only have one engine...          Sampler*       pSampler;
104    
105          int Main(); ///< Implementation of virtual method from class Thread          int Main(); ///< Implementation of virtual method from class Thread
106      private:      private:
107            
108            /**
109             * Find a created audio output device index.
110             */
111            int GetAudioOutputDeviceIndex (AudioOutputDevice *pDevice);
112    
113          /**          /**
114           * Converts a result_t structure into a valid LSCP answer message.           * Converts a result_t structure into a valid LSCP answer message.
115           */           */
# Line 102  class LSCPServer : public Thread { Line 131  class LSCPServer : public Thread {
131              }              }
132          }          }
133    
134          inline String ToString(int i) {          template<class T> inline String ToString(T o) {
135              std::stringstream ss;              std::stringstream ss;
136              ss << i;              ss << o;
137              return ss.str();              return ss.str();
138          }          }
139    };
140    
141          inline String ToString(double d) {  
142              std::stringstream ss;  /**
143              ss << d;   * Instrument loader thread for the LinuxSampler Control Protocol (LSCP).
144              return ss.str();   */
145          }  class LSCPLoadInstrument : public Thread {
146    
147        public:
148            LSCPLoadInstrument(Engine* pEngine, String Filename, uint uiInstrument);
149    
150        protected:
151            // Instance variables.
152            Engine* pEngine;
153            String  Filename;
154            uint    uiInstrument;
155    
156            // Implementation of virtual method from class Thread.
157            int Main();
158  };  };
159    
160  #endif // __LSCPSERVER_H_  #endif // __LSCPSERVER_H_

Legend:
Removed from v.35  
changed lines
  Added in v.143

  ViewVC Help
Powered by ViewVC