/[svn]/linuxsampler/trunk/src/network/lscpresultset.cpp
ViewVC logotype

Annotation of /linuxsampler/trunk/src/network/lscpresultset.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 113 - (hide annotations) (download)
Sun Jun 6 20:59:49 2004 UTC (19 years, 10 months ago) by senkov
File size: 2789 byte(s)
* Added LSCP command GET CHANNEL INFO

1 senkov 113 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5     * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6     * *
7     * 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 *
9     * the Free Software Foundation; either version 2 of the License, or *
10     * (at your option) any later version. *
11     * *
12     * This program is distributed in the hope that it will be useful, *
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15     * GNU General Public License for more details. *
16     * *
17     * You should have received a copy of the GNU General Public License *
18     * along with this program; if not, write to the Free Software *
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20     * MA 02111-1307 USA *
21     ***************************************************************************/
22    
23     #include "lscpresultset.h"
24     #include "../common/LinuxSamplerException.h"
25    
26     LSCPResultSet::LSCPResultSet(void) {
27     count = 0;
28     storage = "";
29     }
30    
31     LSCPResultSet::LSCPResultSet(String Value) {
32     count = 1;
33     storage = Value + "\r\n";
34     }
35    
36     void LSCPResultSet::Add(String Label, String Value) {
37     if (count == -1)
38     throw LinuxSamplerException("Attempting to change already produced resultset");
39     storage = storage + Label + ": " + Value + "\r\n";
40     count++;
41     }
42    
43     void LSCPResultSet::Add(String Label, int Value) {
44     char temp[16];
45     snprintf(temp, sizeof(temp), "%i", Value);
46     Add(Label, temp);
47     }
48    
49     void LSCPResultSet::Add(String Label, float Value) {
50     char temp[16];
51     snprintf(temp, sizeof(temp), "%10.4f", Value);
52     Add(Label, temp);
53     }
54    
55     void LSCPResultSet::Add(String Value) {
56     if (count == -1)
57     throw LinuxSamplerException("Attempting to change already produced resultset");
58     if (count != 0)
59     throw LinuxSamplerException("Attempting to create illegal resultset");
60     storage = Value + "\r\n";
61     count = 1;
62     }
63    
64     String LSCPResultSet::Produce(void) {
65     if (count == 0)
66     return "OK\r\n";
67     if (count == 1)
68     return storage;
69     return storage + ".\r\n";
70     }

  ViewVC Help
Powered by ViewVC