Browse Source

Export Engine/Plugin C++ API; Make carla_get_engine() non-const

tags/1.9.6
falkTX 10 years ago
parent
commit
0eec70a1ca
5 changed files with 44 additions and 17 deletions
  1. +12
    -12
      source/backend/CarlaEngine.hpp
  2. +1
    -1
      source/backend/CarlaHost.h
  3. +1
    -1
      source/backend/CarlaPlugin.hpp
  4. +1
    -1
      source/backend/CarlaStandalone.cpp
  5. +29
    -2
      source/tests/ansi-pedantic-test.c

+ 12
- 12
source/backend/CarlaEngine.hpp View File

@@ -167,7 +167,7 @@ enum EngineControlEventType {
/*!
* Engine control event.
*/
struct EngineControlEvent {
struct CARLA_API EngineControlEvent {
EngineControlEventType type; //!< Control-Event type.
uint16_t param; //!< Parameter Id, midi bank or midi program.
float value; //!< Parameter value, normalized to 0.0f<->1.0f.
@@ -181,7 +181,7 @@ struct EngineControlEvent {
/*!
* Engine MIDI event.
*/
struct EngineMidiEvent {
struct CARLA_API EngineMidiEvent {
static const uint8_t kDataSize = 4; //!< Size of internal data

uint8_t port; //!< Port offset (usually 0)
@@ -198,7 +198,7 @@ struct EngineMidiEvent {
/*!
* Engine event.
*/
struct EngineEvent {
struct CARLA_API EngineEvent {
EngineEventType type; //!< Event Type; either Control or MIDI
uint32_t time; //!< Time offset in frames
uint8_t channel; //!< Channel, used for MIDI-related events
@@ -222,7 +222,7 @@ struct EngineEvent {
/*!
* Engine options.
*/
struct EngineOptions {
struct CARLA_API EngineOptions {
EngineProcessMode processMode;
EngineTransportMode transportMode;

@@ -264,7 +264,7 @@ struct EngineOptions {
/*!
* Engine BBT Time information.
*/
struct EngineTimeInfoBBT {
struct CARLA_API EngineTimeInfoBBT {
int32_t bar; //!< current bar
int32_t beat; //!< current beat-within-bar
int32_t tick; //!< current tick-within-beat
@@ -284,7 +284,7 @@ struct EngineTimeInfoBBT {
/*!
* Engine Time information.
*/
struct EngineTimeInfo {
struct CARLA_API EngineTimeInfo {
static const uint kValidBBT = 0x1;

bool playing;
@@ -313,7 +313,7 @@ struct EngineTimeInfo {
* Carla Engine port (Abstract).
* This is the base class for all Carla Engine ports.
*/
class CarlaEnginePort
class CARLA_API CarlaEnginePort
{
protected:
/*!
@@ -366,7 +366,7 @@ protected:
/*!
* Carla Engine Audio port.
*/
class CarlaEngineAudioPort : public CarlaEnginePort
class CARLA_API CarlaEngineAudioPort : public CarlaEnginePort
{
public:
/*!
@@ -413,7 +413,7 @@ protected:
/*!
* Carla Engine CV port.
*/
class CarlaEngineCVPort : public CarlaEnginePort
class CARLA_API CarlaEngineCVPort : public CarlaEnginePort
{
public:
/*!
@@ -460,7 +460,7 @@ protected:
/*!
* Carla Engine Event port.
*/
class CarlaEngineEventPort : public CarlaEnginePort
class CARLA_API CarlaEngineEventPort : public CarlaEnginePort
{
public:
/*!
@@ -553,7 +553,7 @@ protected:
* Each plugin requires one client from the engine (created via CarlaEngine::addClient()).
* @note This is a virtual class, some engine types provide custom funtionality.
*/
class CarlaEngineClient
class CARLA_API CarlaEngineClient
{
public:
/*!
@@ -648,7 +648,7 @@ protected:
* Carla Engine.
* @note This is a virtual class for all available engine types available in Carla.
*/
class CarlaEngine
class CARLA_API CarlaEngine
{
protected:
/*!


+ 1
- 1
source/backend/CarlaHost.h View File

@@ -408,7 +408,7 @@ CARLA_EXPORT const CarlaCachedPluginInfo* carla_get_cached_plugin_info(PluginTyp
* Get the currently used engine, maybe be NULL.
* @note C++ only
*/
CARLA_EXPORT const CarlaEngine* carla_get_engine();
CARLA_EXPORT CarlaEngine* carla_get_engine();
#endif

/*!


+ 1
- 1
source/backend/CarlaPlugin.hpp View File

@@ -64,7 +64,7 @@ struct StateSave;
*
* @see PluginType
*/
class CarlaPlugin
class CARLA_API CarlaPlugin
{
protected:
/*!


+ 1
- 1
source/backend/CarlaStandalone.cpp View File

@@ -404,7 +404,7 @@ const EngineDriverDeviceInfo* carla_get_engine_driver_device_info(uint index, co

// -------------------------------------------------------------------------------------------------------------------

const CarlaEngine* carla_get_engine()
CarlaEngine* carla_get_engine()
{
carla_debug("carla_get_engine()");



+ 29
- 2
source/tests/ansi-pedantic-test.c View File

@@ -23,12 +23,14 @@
#ifdef __cplusplus
# include "CarlaEngine.hpp"
# include "CarlaPlugin.hpp"
# include <cassert>
# include <cstdio>
# ifdef CARLA_PROPER_CPP11_SUPPORT
# undef NULL
# define NULL nullptr
# endif
#else
# include <assert.h>
# include <stdio.h>
#endif

@@ -87,8 +89,18 @@ int main(int argc, char* argv[])

if (carla_engine_init("JACK", "ansi-test"))
{
#ifdef __cplusplus
CarlaEngine* const engine(carla_get_engine());
assert(engine != nullptr);
engine->getLastError();
#endif
if (carla_add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, NULL, NULL, "audiofile", 0, NULL))
{
#ifdef __cplusplus
CarlaPlugin* const plugin(engine->getPlugin(0));
assert(plugin != nullptr);
plugin->getId();
#endif
carla_set_custom_data(0, CUSTOM_DATA_TYPE_STRING, "file", "/home/falktx/Music/test.wav");
carla_transport_play();
}
@@ -96,15 +108,30 @@ int main(int argc, char* argv[])
{
printf("%s\n", carla_get_last_error());
}

#ifdef __cplusplus
engine->setAboutToClose();
#endif
carla_engine_close();
}

#ifdef __cplusplus
EngineControlEvent e1;
EngineMidiEvent e2;
EngineEvent e3;
e3.fillFromMidiData(0, nullptr);
EngineOptions e4;
EngineTimeInfoBBT e5;
EngineTimeInfo e6;
#endif

return 0;

/* unused */
/* unused C */
(void)argc;
(void)argv;
(void)a; (void)b; (void)c; (void)d; (void)e;
(void)f; (void)g; (void)h; (void)i; (void)j; (void)k;
#ifdef __cplusplus
(void)e1; (void)e2; (void)e4; (void)e5; (void)e6;
#endif
}

Loading…
Cancel
Save