35 |
#include "lscpserver.h" |
#include "lscpserver.h" |
36 |
#include "lscpevent.h" |
#include "lscpevent.h" |
37 |
|
|
38 |
|
namespace LinuxSampler { |
39 |
|
|
40 |
// to save us typing work in the rules action definitions |
// to save us typing work in the rules action definitions |
41 |
#define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer |
#define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer |
42 |
#define SESSION_PARAM ((yyparse_param_t*) yyparse_param) |
#define SESSION_PARAM ((yyparse_param_t*) yyparse_param) |
46 |
void restart(yyparse_param_t* pparam, int& yychar); |
void restart(yyparse_param_t* pparam, int& yychar); |
47 |
#define RESTART restart((yyparse_param_t*) YYPARSE_PARAM, yychar) |
#define RESTART restart((yyparse_param_t*) YYPARSE_PARAM, yychar) |
48 |
|
|
|
// we provide our own version of yyerror() so we don't have to link against the yacc library |
|
|
void yyerror(const char* s); |
|
|
|
|
49 |
static char buf[1024]; // input buffer to feed the parser with new characters |
static char buf[1024]; // input buffer to feed the parser with new characters |
50 |
static int bytes = 0; // current number of characters in the input buffer |
static int bytes = 0; // current number of characters in the input buffer |
51 |
static int ptr = 0; // current position in the input buffer |
static int ptr = 0; // current position in the input buffer |
100 |
return atoi(d2)*8*8 + atoi(d1)*8 + atoi(d0); |
return atoi(d2)*8*8 + atoi(d1)*8 + atoi(d0); |
101 |
} |
} |
102 |
|
|
103 |
|
} |
104 |
|
|
105 |
|
// we provide our own version of yyerror() so we don't have to link against the yacc library |
106 |
|
void yyerror(const char* s); |
107 |
|
|
108 |
|
using namespace LinuxSampler; |
109 |
|
|
110 |
%} |
%} |
111 |
|
|
112 |
// reentrant parser |
// reentrant parser |
120 |
%type <Char> char char_base alpha_char digit digit_oct digit_hex escape_seq escape_seq_octal escape_seq_hex |
%type <Char> char char_base alpha_char digit digit_oct digit_hex escape_seq escape_seq_octal escape_seq_hex |
121 |
%type <Dotnum> dotnum volume_value boolean |
%type <Dotnum> dotnum volume_value boolean |
122 |
%type <Number> number sampler_channel instrument_index fx_send_id audio_channel_index device_index midi_input_channel_index midi_input_port_index midi_map midi_bank midi_prog midi_ctrl |
%type <Number> number sampler_channel instrument_index fx_send_id audio_channel_index device_index midi_input_channel_index midi_input_port_index midi_map midi_bank midi_prog midi_ctrl |
123 |
%type <String> string string_escaped text text_escaped text_escaped_base stringval stringval_escaped digits param_val_list param_val query_val filename db_path map_name entry_name fx_send_name engine_name command add_instruction create_instruction destroy_instruction get_instruction list_instruction load_instruction set_chan_instruction load_instr_args load_engine_args audio_output_type_name midi_input_type_name remove_instruction unmap_instruction set_instruction subscribe_event unsubscribe_event map_instruction reset_instruction clear_instruction find_instruction move_instruction copy_instruction scan_mode edit_instruction format_instruction |
%type <String> string string_escaped text text_escaped text_escaped_base stringval stringval_escaped digits param_val_list param_val query_val filename db_path map_name entry_name fx_send_name engine_name command add_instruction create_instruction destroy_instruction get_instruction list_instruction load_instruction send_instruction set_chan_instruction load_instr_args load_engine_args audio_output_type_name midi_input_type_name remove_instruction unmap_instruction set_instruction subscribe_event unsubscribe_event map_instruction reset_instruction clear_instruction find_instruction move_instruction copy_instruction scan_mode edit_instruction format_instruction |
124 |
%type <FillResponse> buffer_size_type |
%type <FillResponse> buffer_size_type |
125 |
%type <KeyValList> key_val_list query_val_list |
%type <KeyValList> key_val_list query_val_list |
126 |
%type <LoadMode> instr_load_mode |
%type <LoadMode> instr_load_mode |
178 |
| COPY SP copy_instruction { $$ = $3; } |
| COPY SP copy_instruction { $$ = $3; } |
179 |
| EDIT SP edit_instruction { $$ = $3; } |
| EDIT SP edit_instruction { $$ = $3; } |
180 |
| FORMAT SP format_instruction { $$ = $3; } |
| FORMAT SP format_instruction { $$ = $3; } |
181 |
|
command : SEND SP send_instruction { $$ = $3; } |
182 |
| RESET { $$ = LSCPSERVER->ResetSampler(); } |
| RESET { $$ = LSCPSERVER->ResetSampler(); } |
183 |
| QUIT { LSCPSERVER->AnswerClient("Bye!\r\n"); return LSCP_QUIT; } |
| QUIT { LSCPSERVER->AnswerClient("Bye!\r\n"); return LSCP_QUIT; } |
184 |
; |
; |
329 |
| DB_INSTRUMENT_DIRECTORY SP DESCRIPTION SP db_path SP stringval_escaped { $$ = LSCPSERVER->SetDbInstrumentDirectoryDescription($5,$7); } |
| DB_INSTRUMENT_DIRECTORY SP DESCRIPTION SP db_path SP stringval_escaped { $$ = LSCPSERVER->SetDbInstrumentDirectoryDescription($5,$7); } |
330 |
| DB_INSTRUMENT SP NAME SP db_path SP stringval_escaped { $$ = LSCPSERVER->SetDbInstrumentName($5,$7); } |
| DB_INSTRUMENT SP NAME SP db_path SP stringval_escaped { $$ = LSCPSERVER->SetDbInstrumentName($5,$7); } |
331 |
| DB_INSTRUMENT SP DESCRIPTION SP db_path SP stringval_escaped { $$ = LSCPSERVER->SetDbInstrumentDescription($5,$7); } |
| DB_INSTRUMENT SP DESCRIPTION SP db_path SP stringval_escaped { $$ = LSCPSERVER->SetDbInstrumentDescription($5,$7); } |
332 |
|
| DB_INSTRUMENT SP FILE_PATH SP filename SP filename { $$ = LSCPSERVER->SetDbInstrumentFilePath($5,$7); } |
333 |
| ECHO SP boolean { $$ = LSCPSERVER->SetEcho((yyparse_param_t*) yyparse_param, $3); } |
| ECHO SP boolean { $$ = LSCPSERVER->SetEcho((yyparse_param_t*) yyparse_param, $3); } |
334 |
| VOLUME SP volume_value { $$ = LSCPSERVER->SetGlobalVolume($3); } |
| VOLUME SP volume_value { $$ = LSCPSERVER->SetGlobalVolume($3); } |
335 |
; |
; |
353 |
| DB_INSTRUMENTS SP db_path SP query_val_list { $$ = LSCPSERVER->FindDbInstruments($3,$5, true); } |
| DB_INSTRUMENTS SP db_path SP query_val_list { $$ = LSCPSERVER->FindDbInstruments($3,$5, true); } |
354 |
| DB_INSTRUMENT_DIRECTORIES SP NON_RECURSIVE SP db_path SP query_val_list { $$ = LSCPSERVER->FindDbInstrumentDirectories($5,$7, false); } |
| DB_INSTRUMENT_DIRECTORIES SP NON_RECURSIVE SP db_path SP query_val_list { $$ = LSCPSERVER->FindDbInstrumentDirectories($5,$7, false); } |
355 |
| DB_INSTRUMENT_DIRECTORIES SP db_path SP query_val_list { $$ = LSCPSERVER->FindDbInstrumentDirectories($3,$5, true); } |
| DB_INSTRUMENT_DIRECTORIES SP db_path SP query_val_list { $$ = LSCPSERVER->FindDbInstrumentDirectories($3,$5, true); } |
356 |
|
| LOST SP DB_INSTRUMENT_FILES { $$ = LSCPSERVER->FindLostDbInstrumentFiles(); } |
357 |
; |
; |
358 |
|
|
359 |
move_instruction : DB_INSTRUMENT_DIRECTORY SP db_path SP db_path { $$ = LSCPSERVER->MoveDbInstrumentDirectory($3,$5); } |
move_instruction : DB_INSTRUMENT_DIRECTORY SP db_path SP db_path { $$ = LSCPSERVER->MoveDbInstrumentDirectory($3,$5); } |
424 |
| FILE SP INSTRUMENTS SP filename { $$ = LSCPSERVER->ListFileInstruments($5); } |
| FILE SP INSTRUMENTS SP filename { $$ = LSCPSERVER->ListFileInstruments($5); } |
425 |
; |
; |
426 |
|
|
427 |
|
send_instruction : CHANNEL SP MIDI_DATA SP string SP sampler_channel SP number SP number { $$ = LSCPSERVER->SendChannelMidiData($5, $7, $9, $11); } |
428 |
|
; |
429 |
|
|
430 |
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); } |
431 |
| NON_MODAL SP filename SP instrument_index SP sampler_channel { $$ = LSCPSERVER->LoadInstrument($3, $5, $7, true); } |
| NON_MODAL SP filename SP instrument_index SP sampler_channel { $$ = LSCPSERVER->LoadInstrument($3, $5, $7, true); } |
432 |
; |
; |
827 |
DB_INSTRUMENT_INFO : 'D''B''_''I''N''S''T''R''U''M''E''N''T''_''I''N''F''O' |
DB_INSTRUMENT_INFO : 'D''B''_''I''N''S''T''R''U''M''E''N''T''_''I''N''F''O' |
828 |
; |
; |
829 |
|
|
830 |
|
DB_INSTRUMENT_FILES : 'D''B''_''I''N''S''T''R''U''M''E''N''T''_''F''I''L''E''S' |
831 |
|
; |
832 |
|
|
833 |
DB_INSTRUMENTS_JOB_INFO : 'D''B''_''I''N''S''T''R''U''M''E''N''T''S''_''J''O''B''_''I''N''F''O' |
DB_INSTRUMENTS_JOB_INFO : 'D''B''_''I''N''S''T''R''U''M''E''N''T''S''_''J''O''B''_''I''N''F''O' |
834 |
; |
; |
835 |
|
|
962 |
MIDI_CONTROLLER : 'M''I''D''I''_''C''O''N''T''R''O''L''L''E''R' |
MIDI_CONTROLLER : 'M''I''D''I''_''C''O''N''T''R''O''L''L''E''R' |
963 |
; |
; |
964 |
|
|
965 |
|
SEND : 'S''E''N''D' |
966 |
|
; |
967 |
|
|
968 |
FX_SEND : 'F''X''_''S''E''N''D' |
FX_SEND : 'F''X''_''S''E''N''D' |
969 |
; |
; |
970 |
|
|
1004 |
NON_RECURSIVE : 'N''O''N''_''R''E''C''U''R''S''I''V''E' |
NON_RECURSIVE : 'N''O''N''_''R''E''C''U''R''S''I''V''E' |
1005 |
; |
; |
1006 |
|
|
1007 |
|
LOST : 'L''O''S''T' |
1008 |
|
; |
1009 |
|
|
1010 |
|
FILE_PATH : 'F''I''L''E''_''P''A''T''H' |
1011 |
|
; |
1012 |
|
|
1013 |
SERVER : 'S''E''R''V''E''R' |
SERVER : 'S''E''R''V''E''R' |
1014 |
; |
; |
1015 |
|
|
1040 |
FORMAT : 'F''O''R''M''A''T' |
FORMAT : 'F''O''R''M''A''T' |
1041 |
; |
; |
1042 |
|
|
1043 |
|
MIDI_DATA : 'M''I''D''I''_''D''A''T''A' |
1044 |
|
; |
1045 |
|
|
1046 |
RESET : 'R''E''S''E''T' |
RESET : 'R''E''S''E''T' |
1047 |
; |
; |
1048 |
|
|
1073 |
sLastError = msg; |
sLastError = msg; |
1074 |
} |
} |
1075 |
|
|
1076 |
|
namespace LinuxSampler { |
1077 |
|
|
1078 |
/** |
/** |
1079 |
* Clears input buffer. |
* Clears input buffer. |
1080 |
*/ |
*/ |
1083 |
ptr = 0; |
ptr = 0; |
1084 |
sLastError = ""; |
sLastError = ""; |
1085 |
} |
} |
1086 |
|
|
1087 |
|
} |