00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef SYN_SUBSYNTH_INSTRUMENT_BUILDER
00033 #define SYN_SUBSYNTH_INSTRUMENT_BUILDER
00034
00035 #include <string>
00036 #include <map>
00037 #include <xmlpp/xmlpp.h>
00038 #include <syn/Core/Module.h>
00039 #include <syn/Util/Singleton.h>
00040 #include <syn/Module/InstrumentModule.h>
00041 #include <syn/Builder/InstrumentBuilder.h>
00042
00043
00044 namespace syn
00045 {
00052 class SubsynthInstrumentBuilder : public InstrumentBuilder
00053 {
00054 public:
00059 virtual Module* create( std::string filename )
00060 {
00061 xmlpp::XMLContextPtr ctx( new xmlpp::XMLContext );
00062 xmlpp::XMLDocument doc( ctx );
00063
00064
00065 try
00066 {
00067 doc.load_file( filename );
00068 }
00069 catch (xmlpp::xmlerror e)
00070 {
00071 std::cerr << "Error: " << e.get_string() << std::endl;
00072 if (e.get_info().size())
00073 {
00074 std::cerr << "File: " << e.get_info() << std::endl;
00075 }
00076 if (e.get_error() != xmlpp::xml_filename_invalid &&
00077 e.get_error() != xmlpp::xml_file_access)
00078 {
00079
00080
00081 }
00082 return false;
00083 }
00084
00085 std::cerr << "Loaded Configuration: " << filename << std::endl;
00086
00087 xmlpp::XMLNodeList nl = doc.getChild( "gameinput" )->getChildren();
00088 xmlpp::XMLNodeListIterator it = nl.begin();
00089 while (it != nl.end())
00090 {
00091
00092 try
00093 {
00094 xmlpp::XMLAttributes& attr = (*it)->get_attrmap();
00095
00096
00097
00098 }
00099 catch (xmlpp::xmlerror e)
00100 {
00101 std::cerr << "Error: " << e.get_string() << std::endl;
00102 it++;
00103 continue;
00104 }
00105 it++;
00106 }
00107 }
00108 };
00109
00110 }
00111
00112 #endif