Fix last commit
[carla.git] / source / tests.old / ansi-pedantic-test.c
blob2fead4c1a5fbf2ee9bf04cfad45153b19b83fba6
1 /*
2 * ANSI pedantic test for the Carla Backend & Host API
3 * Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #include "CarlaBackend.h"
19 #include "CarlaHost.h"
20 #include "CarlaNative.h"
21 #include "CarlaMIDI.h"
23 #ifdef __cplusplus
24 # include "CarlaEngine.hpp"
25 # include "CarlaPlugin.hpp"
26 # include <cassert>
27 # include <cstdio>
28 # ifdef CARLA_PROPER_CPP11_SUPPORT
29 # undef NULL
30 # define NULL nullptr
31 # endif
32 #else
33 # include <assert.h>
34 # include <stdio.h>
35 #endif
37 int main(int argc, char* argv[])
39 #ifdef __cplusplus
40 CARLA_BACKEND_USE_NAMESPACE
41 #endif
43 ParameterData a;
44 ParameterRanges b;
45 MidiProgramData c;
46 CustomData d;
47 EngineDriverDeviceInfo e;
49 CarlaPluginInfo f;
50 /*CarlaCachedPluginInfo g;*/
51 CarlaPortCountInfo h;
52 CarlaParameterInfo i;
53 CarlaScalePointInfo j;
54 CarlaTransportInfo k;
56 /*const char* licenseText;
57 const char* fileExtensions;*/
59 uint l, count;
61 /*licenseText = carla_get_complete_license_text();
62 printf("LICENSE:\n%s\n", licenseText);
64 fileExtensions = carla_get_supported_file_extensions();
65 printf("FILE EXTENSIONS:\n%s\n", fileExtensions);*/
67 count = carla_get_engine_driver_count();
68 printf("DRIVER COUNT: %i\n", count);
70 for (l=0; l < count; ++l)
72 const char* driverName;
73 const char* const* driverDeviceNames;
74 uint m, count2;
76 driverName = carla_get_engine_driver_name(l);
77 driverDeviceNames = carla_get_engine_driver_device_names(l);
78 printf("DRIVER %i/%i: \"%s\" : DEVICES:\n", l+1, count, driverName);
80 count2 = 0;
81 while (driverDeviceNames[count2] != NULL)
82 ++count2;
84 for (m = 0; m < count2; ++m)
86 printf("DRIVER DEVICE %i/%i: \"%s\"\n", m+1, count2, driverDeviceNames[m]);
90 if (carla_engine_init("JACK", "ansi-test"))
92 #ifdef __cplusplus
93 CarlaEngine* const engine(carla_get_engine());
94 assert(engine != nullptr);
95 engine->getLastError();
96 #endif
97 if (carla_add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, NULL, NULL, "audiofile", 0, NULL, 0x0))
99 #ifdef __cplusplus
100 CarlaPlugin* const plugin(engine->getPlugin(0));
101 assert(plugin != nullptr);
102 plugin->getId();
103 #endif
104 carla_set_custom_data(0, CUSTOM_DATA_TYPE_STRING, "file", "/home/falktx/Music/test.wav");
105 carla_transport_play();
107 else
109 printf("%s\n", carla_get_last_error());
111 #ifdef __cplusplus
112 engine->setAboutToClose();
113 #endif
114 carla_engine_close();
117 #ifdef __cplusplus
118 EngineControlEvent e1;
119 EngineMidiEvent e2;
120 EngineEvent e3;
121 e3.fillFromMidiData(0, nullptr);
122 EngineOptions e4;
123 EngineTimeInfoBBT e5;
124 EngineTimeInfo e6;
125 #endif
127 /* unused C */
128 (void)argc;
129 (void)argv;
130 (void)a; (void)b; (void)c; (void)d; (void)e;
131 (void)f; /*(void)g;*/ (void)h; (void)i; (void)j; (void)k;
132 #ifdef __cplusplus
133 (void)e1; (void)e2; (void)e4; (void)e5; (void)e6;
134 #endif
136 return 0;