23f7369f52b16d05511f4cbfc7c1b0b001c010dd
[ardour.git] / cfgtool / cfgtool.cc
1 #include <stdio.h>
2 #include <glib.h>
3
4 #include "pbd/xml++.h"
5 #include "ardour/rc_configuration.h"
6
7 using namespace ARDOUR;
8 using namespace std;
9
10 int main (int argc, char **argv) {
11         if (argc < 2) {
12                 fprintf(stderr, "Usage: %s [-h] <file-name>\n", argv[0]);
13                 return -1;
14         }
15
16         if (!strcmp (argv[1], "-h") || !strcmp (argv[1], "--help")) {
17                 fprintf(stdout, "Usage: %s <file-name>\n\n", argv[0]);
18                 fprintf(stdout, "Writes the default Ardour config to the given file\n");
19                 return 0;
20         }
21
22         g_setenv ("ARDOUR_DLL_PATH", "/xxx", 1);
23         g_setenv ("ARDOUR_CONFIG_PATH", "/xxx", 1);
24
25         if (!ARDOUR::init (false, true, "/xxx")) {
26                 fprintf(stderr, "Failed to initialize libardour\n");
27                 return -1;
28         }
29
30         RCConfiguration * rc = new RCConfiguration;
31         XMLNode& state = rc->get_state();
32
33         XMLNode* cfg = state.child ("Config");
34         cfg->remove_nodes_and_delete ("name", "donate-url");
35         cfg->remove_nodes_and_delete ("name", "osx_pingback-url");
36         cfg->remove_nodes_and_delete ("name", "linux-pingback-url");
37         cfg->remove_nodes_and_delete ("name", "updates-url");
38         cfg->remove_nodes_and_delete ("name", "freesound-download-dir"); // user specific
39
40         XMLTree tree;
41         tree.set_root (&state);
42
43         if (!tree.write (argv[1])) {
44                 fprintf(stderr, "Error saving config file '%s'\n", argv[1]);
45                 return -1;
46         }
47
48         return 0;
49 }
50
51
52 #include "ardour/vst_types.h"
53 int vstfx_init (void*) { return 0; }
54 void vstfx_exit () {}
55 void vstfx_destroy_editor (VSTState*) {}
56
57 #ifdef WINDOWS_VST_SUPPORT
58 extern "C" {
59 int        fst_init (void* possible_hmodule) { return -1;}
60 void       fst_exit (void) {}
61 VSTHandle* fst_load (const char*) { return 0; }
62 int        fst_unload (VSTHandle**) { return -1; }
63 VSTState * fst_instantiate (VSTHandle *, audioMasterCallback amc, void* userptr) { return 0; }
64 void       fst_close (VSTState *) {}
65 void       fst_audio_master_idle(void) {}
66 };
67 #endif