/[svn]/linuxsampler/trunk/src/network/lscp.y
ViewVC logotype

Diff of /linuxsampler/trunk/src/network/lscp.y

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

revision 53 by schoenebeck, Mon Apr 26 17:15:51 2004 UTC revision 135 by senkov, Sun Jun 20 16:01:50 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 52  void yyerror(const char* s); Line 52  void yyerror(const char* s);
52  %token <Char>   CHAR  %token <Char>   CHAR
53  %token <Dotnum> DOTNUM  %token <Dotnum> DOTNUM
54  %token <Number> NUMBER  %token <Number> NUMBER
55  %token SP LF CR  %token <String> STRINGVAL
56  %token ADD GET LOAD REMOVE SET SUBSCRIBE UNSUBSCRIBE RESET QUIT  %token SP LF CR HASH EQ
57    %token ADD GET CREATE DESTROY LIST LOAD LOAD_BACKGROUND REMOVE SET SUBSCRIBE UNSUBSCRIBE RESET QUIT
58  %token CHANNEL NOTIFICATION  %token CHANNEL NOTIFICATION
59  %token AVAILABLE_ENGINES CHANNELS INFO BUFFER_FILL STREAM_COUNT VOICE_COUNT  %token AVAILABLE_ENGINES AVAILABLE_AUDIO_OUTPUT_DRIVERS CHANNELS INFO BUFFER_FILL STREAM_COUNT VOICE_COUNT
60  %token INSTRUMENT ENGINE  %token INSTRUMENT ENGINE
61  %token AUDIO_OUTPUT_CHANNEL AUDIO_OUTPUT_TYPE MIDI_INPUT_PORT MIDI_INPUT_CHANNEL MIDI_INPUT_TYPE VOLUME  %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
62  %token BYTES PERCENTAGE  %token BYTES PERCENTAGE
63  %token ALSA JACK  %token MISCELLANEOUS
64    
65  %type <Dotnum> volume  %type <Dotnum> volume
66  %type <Number> sampler_channel instrument_index udp_port audio_output_channel midi_input_channel  %type <Number> sampler_channel instrument_index audio_output_channel midi_input_channel
67  %type <String> string alpha_num_string filename engine_name session_id midi_input_port command get_instruction load_instruction set_chan_instruction load_instr_args load_engine_args  %type <String> string param_val filename engine_name midi_input_port command create_instruction destroy_instruction get_instruction list_instruction load_instruction set_chan_instruction load_instr_args load_engine_args midi_input_type set_instruction subscribe_event unsubscribe_event
68  %type <FillResponse> buffer_size_type  %type <FillResponse> buffer_size_type
69  %type <AudioOutput> audio_output_type  %type <KeyValList> key_val_list
 %type <MidiInput> midi_input_type  
70    
71  %start input  %start input
72    
# Line 80  input                 :  line Line 80  input                 :  line
80                        ;                        ;
81    
82  line                  :  /* epsilon (empty line ignored) */  line                  :  /* epsilon (empty line ignored) */
83                          |  comment
84                        |  command  { LSCPSERVER->AnswerClient($1); }                        |  command  { LSCPSERVER->AnswerClient($1); }
85                        |  error    { LSCPSERVER->AnswerClient("Err:0:Unknown command.\r\n"); RESTART; return LSCP_SYNTAX_ERROR; }                        |  error    { LSCPSERVER->AnswerClient("Err:0:Unknown command.\r\n"); RESTART; return LSCP_SYNTAX_ERROR; }
86                        ;                        ;
87    
88    comment               :  HASH
89                          |  comment HASH
90                          |  comment SP
91                          |  comment NUMBER
92                          |  comment string
93                          ;
94    
95  command               :  ADD SP CHANNEL                             { $$ = LSCPSERVER->AddChannel();                  }  command               :  ADD SP CHANNEL                             { $$ = LSCPSERVER->AddChannel();                  }
96                        |  GET SP get_instruction                     { $$ = $3;                                        }                        |  GET SP get_instruction                     { $$ = $3;                                        }
97                          |  CREATE SP create_instruction               { $$ = $3;                                        }
98                          |  DESTROY SP destroy_instruction             { $$ = $3;                                        }
99                          |  LIST SP list_instruction                   { $$ = $3;                                        }
100                        |  LOAD SP load_instruction                   { $$ = $3;                                        }                        |  LOAD SP load_instruction                   { $$ = $3;                                        }
101                          |  LOAD_BACKGROUND SP load_instruction        { $$ = $3;                                        }
102                        |  REMOVE SP CHANNEL SP sampler_channel       { $$ = LSCPSERVER->RemoveChannel($5);             }                        |  REMOVE SP CHANNEL SP sampler_channel       { $$ = LSCPSERVER->RemoveChannel($5);             }
103                        |  SET SP CHANNEL SP set_chan_instruction     { $$ = $5;                                        }                        |  SET SP set_instruction                     { $$ = $3;                                        }
104                        |  SUBSCRIBE SP NOTIFICATION SP udp_port      { $$ = LSCPSERVER->SubscribeNotification($5);     }                        |  SUBSCRIBE SP subscribe_event               { $$ = $3;                                        }
105                        |  UNSUBSCRIBE SP NOTIFICATION SP session_id  { $$ = LSCPSERVER->UnsubscribeNotification($5);   }                        |  UNSUBSCRIBE SP unsubscribe_event           { $$ = $3;                                        }
106                        |  RESET SP CHANNEL SP sampler_channel        { $$ = LSCPSERVER->ResetChannel($5);              }                        |  RESET SP CHANNEL SP sampler_channel        { $$ = LSCPSERVER->ResetChannel($5);              }
107                        |  QUIT                                       { LSCPSERVER->AnswerClient("Bye!\r\n"); return 0; }                        |  QUIT                                       { LSCPSERVER->AnswerClient("Bye!\r\n"); return 0; }
108                        ;                        ;
109    
110  get_instruction       :  AVAILABLE_ENGINES                                              { $$ = LSCPSERVER->GetAvailableEngines(); }  subscribe_event       :  CHANNELS                                   { $$ = LSCPSERVER->SubscribeNotification(event_channels); }
111                        |  CHANNELS                                                       { $$ = LSCPSERVER->GetChannels();         }                        |  VOICE_COUNT                                { $$ = LSCPSERVER->SubscribeNotification(event_voice_count); }
112                        |  CHANNEL SP INFO SP sampler_channel                             { $$ = LSCPSERVER->GetChannelInfo($5);    }                        |  STREAM_COUNT                               { $$ = LSCPSERVER->SubscribeNotification(event_stream_count); }
113                        |  CHANNEL SP BUFFER_FILL SP buffer_size_type SP sampler_channel  { $$ = LSCPSERVER->GetBufferFill($5, $7); }                        |  BUFFER_FILL                                { $$ = LSCPSERVER->SubscribeNotification(event_channel_buffer_fill); }
114                        |  CHANNEL SP STREAM_COUNT SP sampler_channel                     { $$ = LSCPSERVER->GetStreamCount($5);    }                        |  INFO                                       { $$ = LSCPSERVER->SubscribeNotification(event_channel_info); }
115                        |  CHANNEL SP VOICE_COUNT SP sampler_channel                      { $$ = LSCPSERVER->GetVoiceCount($5);     }                        |  MISCELLANEOUS                              { $$ = LSCPSERVER->SubscribeNotification(event_misc); }
116                        |  ENGINE SP INFO SP engine_name                                  { $$ = LSCPSERVER->GetEngineInfo($5);     }                        ;
117    
118    unsubscribe_event     :  CHANNELS                                   { $$ = LSCPSERVER->UnsubscribeNotification(event_channels); }
119                          |  VOICE_COUNT                                { $$ = LSCPSERVER->UnsubscribeNotification(event_voice_count); }
120                          |  STREAM_COUNT                               { $$ = LSCPSERVER->UnsubscribeNotification(event_stream_count); }
121                          |  BUFFER_FILL                                { $$ = LSCPSERVER->UnsubscribeNotification(event_channel_buffer_fill); }
122                          |  INFO                                       { $$ = LSCPSERVER->UnsubscribeNotification(event_channel_info); }
123                          |  MISCELLANEOUS                              { $$ = LSCPSERVER->UnsubscribeNotification(event_misc); }
124                          ;
125    
126    get_instruction       :  AVAILABLE_ENGINES                                                          { $$ = LSCPSERVER->GetAvailableEngines();                          }
127                          |  AVAILABLE_AUDIO_OUTPUT_DRIVERS                                             { $$ = LSCPSERVER->GetAvailableAudioOutputDrivers();               }
128                          |  AUDIO_OUTPUT_DRIVER SP INFO SP string                                      { $$ = LSCPSERVER->GetAudioOutputDriverInfo($5);                   }
129                          |  AUDIO_OUTPUT_DRIVER_PARAMETER SP INFO SP string SP string                  { $$ = LSCPSERVER->GetAudioOutputDriverParameterInfo($5, $7);      }
130                          |  AUDIO_OUTPUT_DRIVER_PARAMETER SP INFO SP string SP string SP key_val_list  { $$ = LSCPSERVER->GetAudioOutputDriverParameterInfo($5, $7, $9);  }
131                          |  AUDIO_OUTPUT_DEVICES                                                       { $$ = LSCPSERVER->GetAudioOutputDeviceCount();                    }
132                          |  AUDIO_OUTPUT_DEVICE SP INFO SP NUMBER                                      { $$ = LSCPSERVER->GetAudioOutputDeviceInfo($5);                   }
133                          |  AUDIO_OUTPUT_CHANNEL SP INFO SP NUMBER SP NUMBER                           { $$ = LSCPSERVER->GetAudioOutputChannelInfo($5, $7);              }
134                          |  AUDIO_OUTPUT_CHANNEL_PARAMETER SP INFO SP NUMBER SP NUMBER SP string       { $$ = LSCPSERVER->GetAudioOutputChannelParameterInfo($5, $7, $9); }
135                          |  CHANNELS                                                                   { $$ = LSCPSERVER->GetChannels();                                  }
136                          |  CHANNEL SP INFO SP sampler_channel                                         { $$ = LSCPSERVER->GetChannelInfo($5);                             }
137                          |  CHANNEL SP BUFFER_FILL SP buffer_size_type SP sampler_channel              { $$ = LSCPSERVER->GetBufferFill($5, $7);                          }
138                          |  CHANNEL SP STREAM_COUNT SP sampler_channel                                 { $$ = LSCPSERVER->GetStreamCount($5);                             }
139                          |  CHANNEL SP VOICE_COUNT SP sampler_channel                                  { $$ = LSCPSERVER->GetVoiceCount($5);                              }
140                          |  ENGINE SP INFO SP engine_name                                              { $$ = LSCPSERVER->GetEngineInfo($5);                              }
141                          ;
142    
143    set_instruction       :  AUDIO_OUTPUT_DEVICE_PARAMETER SP NUMBER SP string EQ param_val             { $$ = LSCPSERVER->SetAudioOutputDeviceParameter($3, $5, $7);      }
144                          |  AUDIO_OUTPUT_CHANNEL_PARAMETER SP NUMBER SP NUMBER SP string EQ param_val  { $$ = LSCPSERVER->SetAudioOutputChannelParameter($3, $5, $7, $9); }
145                          |  CHANNEL SP set_chan_instruction                                                   { $$ = $3;                                                         }
146                          ;
147    
148    create_instruction    :  AUDIO_OUTPUT_DEVICE SP string SP key_val_list { $$ = LSCPSERVER->CreateAudioOutputDevice($3,$5); }
149                          ;
150    
151    destroy_instruction   :  AUDIO_OUTPUT_DEVICE SP NUMBER  { $$ = LSCPSERVER->DestroyAudioOutputDevice($3); }
152                        ;                        ;
153    
154  load_instruction      :  INSTRUMENT SP load_instr_args  { $$ = $3; }  load_instruction      :  INSTRUMENT SP load_instr_args  { $$ = $3; }
155                        |  ENGINE SP load_engine_args     { $$ = $3; }                        |  ENGINE SP load_engine_args     { $$ = $3; }
156                        ;                        ;
157    
158  set_chan_instruction  :  AUDIO_OUTPUT_CHANNEL SP sampler_channel SP audio_output_channel  { $$ = LSCPSERVER->SetAudioOutputChannel($5, $3); }  set_chan_instruction  :  AUDIO_OUTPUT_DEVICE SP sampler_channel SP NUMBER                                         { $$ = LSCPSERVER->SetAudioOutputDevice($5, $3);      }
159                        |  AUDIO_OUTPUT_TYPE SP sampler_channel SP audio_output_type        { $$ = LSCPSERVER->SetAudioOutputType($5, $3);    }                        |  AUDIO_OUTPUT_CHANNEL SP sampler_channel SP audio_output_channel SP audio_output_channel  { $$ = LSCPSERVER->SetAudioOutputChannel($5, $7, $3); }
160                        |  MIDI_INPUT_PORT SP sampler_channel SP midi_input_port            { $$ = LSCPSERVER->SetMIDIInputPort($5, $3);      }                        |  MIDI_INPUT_PORT SP sampler_channel SP midi_input_port                                    { $$ = LSCPSERVER->SetMIDIInputPort($5, $3);          }
161                        |  MIDI_INPUT_CHANNEL SP sampler_channel SP midi_input_channel      { $$ = LSCPSERVER->SetMIDIInputChannel($5, $3);   }                        |  MIDI_INPUT_CHANNEL SP sampler_channel SP midi_input_channel                              { $$ = LSCPSERVER->SetMIDIInputChannel($5, $3);       }
162                        |  MIDI_INPUT_TYPE SP sampler_channel SP midi_input_type            { $$ = LSCPSERVER->SetMIDIInputType($5, $3);      }                        |  MIDI_INPUT_TYPE SP sampler_channel SP midi_input_type                                    { $$ = LSCPSERVER->SetMIDIInputType($5, $3);          }
163                        |  VOLUME SP sampler_channel SP volume                              { $$ = LSCPSERVER->SetVolume($5, $3);             }                        |  VOLUME SP sampler_channel SP volume                                                      { $$ = LSCPSERVER->SetVolume($5, $3);                 }
164                          ;
165    
166    key_val_list          :  string EQ param_val                  { $$[$1] = $3;          }
167                          |  key_val_list SP string EQ param_val  { $$ = $1; $$[$3] = $5; }
168                        ;                        ;
169    
170  buffer_size_type      :  BYTES       { $$ = fill_response_bytes;      }  buffer_size_type      :  BYTES       { $$ = fill_response_bytes;      }
171                        |  PERCENTAGE  { $$ = fill_response_percentage; }                        |  PERCENTAGE  { $$ = fill_response_percentage; }
172                        ;                        ;
173    
174  load_instr_args       :  filename SP instrument_index SP sampler_channel  { $$ = LSCPSERVER->LoadInstrument($1, $3, $5); }  list_instruction      :  AUDIO_OUTPUT_DEVICES  { $$ = LSCPSERVER->GetAudioOutputDevices(); }
175                        ;                        ;
176    
177  load_engine_args      :  engine_name SP sampler_channel  { $$ = LSCPSERVER->LoadEngine($1, $3); }  load_instr_args       :  filename SP instrument_index SP sampler_channel  { $$ = LSCPSERVER->LoadInstrument($1, $3, $5); }
178                        ;                        ;
179    
180  audio_output_type     :  ALSA  { $$ = audio_output_type_alsa; }  load_engine_args      :  engine_name SP sampler_channel  { $$ = LSCPSERVER->LoadEngine($1, $3); }
                       |  JACK  { $$ = audio_output_type_jack; }  
181                        ;                        ;
182    
183  midi_input_type       :  ALSA  { $$ = midi_input_type_alsa; }  midi_input_type       :  string
184                        ;                        ;
185    
186  volume                :  DOTNUM  volume                :  DOTNUM
# Line 143  sampler_channel       :  NUMBER Line 193  sampler_channel       :  NUMBER
193  instrument_index      :  NUMBER  instrument_index      :  NUMBER
194                        ;                        ;
195    
 udp_port              :  NUMBER  
                       ;  
   
196  audio_output_channel  :  NUMBER  audio_output_channel  :  NUMBER
197                        ;                        ;
198    
199  midi_input_channel    :  NUMBER  midi_input_channel    :  NUMBER
200                        ;                        ;
201    
 session_id            :  alpha_num_string  
                       ;  
   
202  engine_name           :  string  engine_name           :  string
203                        ;                        ;
204    
205  midi_input_port       :  alpha_num_string  midi_input_port       :  STRINGVAL
206                        ;                        ;
207    
208  filename              :  alpha_num_string  filename              :  STRINGVAL
                       |  filename SP alpha_num_string  { $$ = $1 + ' ' + $3; }  
209                        ;                        ;
210    
211  alpha_num_string      :  string                   { $$ = $1;                                             }  param_val             :  STRINGVAL                { $$ = $1;                                             }
212                        |  NUMBER                   { std::stringstream ss; ss << $1; $$ = ss.str();       }                        |  NUMBER                   { std::stringstream ss; ss << $1; $$ = ss.str();       }
213                        |  alpha_num_string string  { $$ = $1 + $2;                                        }                        |  DOTNUM                   { std::stringstream ss; ss << $1; $$ = ss.str();       }
                       |  alpha_num_string NUMBER  { std::stringstream ss; ss << $1 << $2; $$ = ss.str(); }  
214                        ;                        ;
215    
216  string                :  CHAR          { std::string s; s = $1; $$ = s; }  string                :  CHAR          { std::string s; s = $1; $$ = s; }

Legend:
Removed from v.53  
changed lines
  Added in v.135

  ViewVC Help
Powered by ViewVC