add export control to libevoral

This commit is contained in:
Paul Davis 2013-10-17 10:52:02 -04:00
parent 92b9fea3d1
commit 94ef2692b8
26 changed files with 100 additions and 51 deletions

View File

@ -417,6 +417,7 @@ def build(bld):
'LIBARDOUR_DLL=1',
'LIBARDOUR_CP_DLL=1',
'LIBGTKMM2EXT_DLL=1',
'LIBEVORAL_DLL=1',
]
# continue with setup of obj, which could be a shared library
# or an executable.

View File

@ -321,11 +321,15 @@ def build(bld):
# Library
if bld.is_defined ('INTERNAL_SHARED_LIBS'):
obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=libardour_sources)
# macros for this shared library
obj.defines = [ 'LIBARDOUR_DLL=1', 'LIBARDOUR_DLL_EXPORTS=1' ]
# macros for this other internal shared libraries that we use
obj.defines += [ 'LIBEVORAL_DLL=1', 'LIBMIDIPP_DLL=1', 'LIBPBD_DLL=1' ]
else:
obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=libardour_sources)
obj.cxxflags = [ '-fPIC' ]
obj.cflags = [ '-fPIC' ]
obj.defines = []
obj.export_includes = ['.']
obj.includes = ['.', '../surfaces/control_protocol', '..']
obj.name = 'ardour'
@ -338,14 +342,13 @@ def build(bld):
'libaudiographer','libltc','libtimecode']
obj.vnum = LIBARDOUR_LIB_VERSION
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
obj.defines = [
obj.defines += [
'PACKAGE="' + I18N_PACKAGE + '"',
'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"',
'EVORAL_MIDI_XML=1',
'LIBARDOUR_DLL_EXPORTS=1'
]
#obj.source += ' st_stretch.cc st_pitch.cc '

View File

@ -23,6 +23,8 @@
#include <map>
#include <boost/shared_ptr.hpp>
#include "pbd/signals.h"
#include "evoral/visibility.h"
#include "evoral/types.hpp"
#include "evoral/Parameter.hpp"
@ -38,7 +40,7 @@ class Transport;
* a list of values for automation.
*/
class Control
class LIBEVORAL_API Control
{
public:
Control(const Parameter& parameter, boost::shared_ptr<ControlList>);

View File

@ -25,6 +25,8 @@
#include <boost/pool/pool_alloc.hpp>
#include <glibmm/threads.h>
#include "pbd/signals.h"
#include "evoral/visibility.h"
#include "evoral/types.hpp"
#include "evoral/Range.hpp"
#include "evoral/Parameter.hpp"
@ -35,7 +37,7 @@ class Curve;
/** A single event (time-stamped value) for a control
*/
class ControlEvent {
class LIBEVORAL_API ControlEvent {
public:
ControlEvent (double w, double v)
: when (w), value (v), coeff (0)
@ -67,7 +69,7 @@ public:
/** A list (sequence) of time-stamped values for a control
*/
class ControlList
class LIBEVORAL_API ControlList
{
public:
typedef std::list<ControlEvent*> EventList;

View File

@ -25,6 +25,8 @@
#include <boost/utility.hpp>
#include <glibmm/threads.h>
#include "pbd/signals.h"
#include "evoral/visibility.h"
#include "evoral/types.hpp"
#include "evoral/Parameter.hpp"
#include "evoral/ControlList.hpp"
@ -34,7 +36,7 @@ namespace Evoral {
class Control;
class ControlEvent;
class ControlSet : public boost::noncopyable {
class LIBEVORAL_API ControlSet : public boost::noncopyable {
public:
ControlSet();
ControlSet (const ControlSet&);

View File

@ -22,11 +22,13 @@
#include <inttypes.h>
#include <boost/utility.hpp>
#include "evoral/visibility.h"
namespace Evoral {
class ControlList;
class Curve : public boost::noncopyable
class LIBEVORAL_API Curve : public boost::noncopyable
{
public:
Curve (const ControlList& cl);
@ -51,7 +53,7 @@ private:
} // namespace Evoral
extern "C" {
void curve_get_vector_from_c (void *arg, double, double, float*, int32_t);
LIBEVORAL_API void curve_get_vector_from_c (void *arg, double, double, float*, int32_t);
}
#endif // EVORAL_CURVE_HPP

View File

@ -25,6 +25,7 @@
#include <sstream>
#include <stdint.h>
#include "evoral/visibility.h"
#include "evoral/types.hpp"
/** If this is not defined, all methods of MidiEvent are RT safe
@ -35,16 +36,16 @@
namespace Evoral {
event_id_t event_id_counter();
event_id_t next_event_id();
void init_event_id_counter(event_id_t n);
LIBEVORAL_API event_id_t event_id_counter();
LIBEVORAL_API event_id_t next_event_id();
LIBEVORAL_API void init_event_id_counter(event_id_t n);
/** An event (much like a type generic jack_midi_event_t)
*
* Template parameter Time is the type of the time stamp used for this event.
*/
template<typename Time>
class Event {
class LIBEVORAL_API Event {
public:
#ifdef EVORAL_EVENT_ALLOC
Event (EventType type=0, Time time=0, uint32_t size=0, uint8_t* buf=NULL, bool alloc=false);
@ -157,7 +158,7 @@ protected:
template<typename Time>
std::ostream& operator<<(std::ostream& o, const Evoral::Event<Time>& ev) {
LIBEVORAL_API std::ostream& operator<<(std::ostream& o, const Evoral::Event<Time>& ev) {
o << "Event #" << ev.id() << " type = " << ev.event_type() << " @ " << ev.time();
o << std::hex;
for (uint32_t n = 0; n < ev.size(); ++n) {

View File

@ -19,6 +19,8 @@
#define EVORAL_EVENT_LIST_HPP
#include <list>
#include "evoral/visibility.h"
#include "evoral/EventSink.hpp"
#include "evoral/types.hpp"
#include "evoral/Event.hpp"
@ -31,7 +33,7 @@ namespace Evoral {
* Used when we need an unsorted list of Events that is also an EventSink. Absolutely nothing more.
*/
template<typename Time>
class EventList : public std::list<Evoral::Event<Time> *>, public Evoral::EventSink<Time> {
class LIBEVORAL_API EventList : public std::list<Evoral::Event<Time> *>, public Evoral::EventSink<Time> {
public:
EventList() {}

View File

@ -22,6 +22,7 @@
#include "pbd/ringbufferNPT.h"
#include "evoral/visibility.h"
#include "evoral/EventSink.hpp"
#include "evoral/types.hpp"
@ -39,7 +40,7 @@ namespace Evoral {
* possible interpretation of uint8_t.
*/
template<typename Time>
class EventRingBuffer : public PBD::RingBufferNPT<uint8_t>, public Evoral::EventSink<Time> {
class LIBEVORAL_API EventRingBuffer : public PBD::RingBufferNPT<uint8_t>, public Evoral::EventSink<Time> {
public:
/** @param capacity Ringbuffer capacity in bytes.

View File

@ -19,15 +19,15 @@
#ifndef EVORAL_EVENT_SINK_HPP
#define EVORAL_EVENT_SINK_HPP
#include "evoral/visibility.h"
#include "evoral/types.hpp"
namespace Evoral {
/** Pure virtual base for anything you can write events to.
*/
template<typename Time>
class EventSink {
class LIBEVORAL_API EventSink {
public:
virtual ~EventSink() {}
virtual uint32_t write(Time time, EventType type, uint32_t size, const uint8_t* buf) = 0;

View File

@ -21,8 +21,11 @@
#include <cmath>
#include <boost/shared_ptr.hpp>
#include "evoral/visibility.h"
#include "evoral/Event.hpp"
#include "evoral/midi_events.h"
#ifdef EVORAL_MIDI_XML
class XMLNode;
#endif
@ -36,7 +39,7 @@ namespace Evoral {
* valid MIDI data for these functions to make sense.
*/
template<typename Time>
class MIDIEvent : public Event<Time> {
class LIBEVORAL_API MIDIEvent : public Event<Time> {
public:
MIDIEvent(EventType type=0, Time time=0, uint32_t size=0, uint8_t* buf=NULL, bool alloc=false)
: Event<Time>(type, time, size, buf, alloc)

View File

@ -19,23 +19,25 @@
#ifndef EVORAL_MIDI_PARAMETERS_HPP
#define EVORAL_MIDI_PARAMETERS_HPP
#include "evoral/visibility.h"
namespace Evoral {
namespace MIDI {
struct ContinuousController : public Parameter {
struct LIBEVORAL_API ContinuousController : public Parameter {
ContinuousController(uint32_t cc_type, uint8_t channel, uint32_t controller)
: Parameter(cc_type, channel, controller) {}
};
struct ProgramChange : public Parameter {
struct LIBEVORAL_API ProgramChange : public Parameter {
ProgramChange(uint32_t pc_type, uint8_t channel) : Parameter(pc_type, channel, 0) {}
};
struct ChannelPressure : public Parameter {
struct LIBEVORAL_API ChannelPressure : public Parameter {
ChannelPressure(uint32_t ca_type, uint32_t channel) : Parameter(ca_type, channel, 0) {}
};
struct PitchBender : public Parameter {
struct LIBEVORAL_API PitchBender : public Parameter {
PitchBender(uint32_t pb_type, uint32_t channel) : Parameter(pb_type, channel, 0) {}
};

View File

@ -22,6 +22,8 @@
#include <algorithm>
#include <glib.h>
#include <stdint.h>
#include "evoral/visibility.h"
#include "evoral/MIDIEvent.hpp"
namespace Evoral {
@ -31,7 +33,7 @@ namespace Evoral {
* Currently a note is defined as (on event, length, off event).
*/
template<typename Time>
class Note {
class LIBEVORAL_API Note {
public:
Note(uint8_t chan=0, Time time=0, Time len=0, uint8_t note=0, uint8_t vel=0x40);
Note(const Note<Time>& copy);
@ -106,7 +108,7 @@ private:
} // namespace Evoral
template<typename Time>
std::ostream& operator<<(std::ostream& o, const Evoral::Note<Time>& n) {
LIBEVORAL_API std::ostream& operator<<(std::ostream& o, const Evoral::Note<Time>& n) {
o << "Note #" << n.id() << ": pitch = " << (int) n.note()
<< " @ " << n.time() << " .. " << n.end_time()
<< " velocity " << (int) n.velocity()

View File

@ -19,6 +19,8 @@
#ifndef EVORAL_OLD_SMF_HPP
#define EVORAL_OLD_SMF_HPP
#include "evoral/visibility.h"
namespace Evoral {
template<typename Time> class Event;
@ -28,7 +30,7 @@ template<typename Time> class EventRingBuffer;
/** Standard Midi File (Type 0)
*/
template<typename Time>
class SMF {
class LIBEVORAL_API SMF {
public:
SMF();
virtual ~SMF();

View File

@ -24,6 +24,8 @@
#include <stdint.h>
#include <boost/shared_ptr.hpp>
#include "evoral/visibility.h"
namespace Evoral {
@ -36,7 +38,7 @@ namespace Evoral {
* This class defines a < operator which is a strict weak ordering, so
* Parameter may be stored in a std::set, used as a std::map key, etc.
*/
class Parameter
class LIBEVORAL_API Parameter
{
public:
Parameter(uint32_t type, uint8_t channel=0, uint32_t id=0)

View File

@ -20,6 +20,7 @@
#ifndef EVORAL_PATCH_CHANGE_HPP
#define EVORAL_PATCH_CHANGE_HPP
#include "evoral/visibility.h"
#include "evoral/Event.hpp"
#include "evoral/MIDIEvent.hpp"
@ -29,7 +30,7 @@ namespace Evoral {
* bank select and then a program change.
*/
template<typename Time>
class PatchChange
class LIBEVORAL_API PatchChange
{
public:
/** @param t Time.
@ -166,7 +167,7 @@ private:
}
template<typename Time>
std::ostream& operator<< (std::ostream& o, const Evoral::PatchChange<Time>& p) {
LIBEVORAL_API std::ostream& operator<< (std::ostream& o, const Evoral::PatchChange<Time>& p) {
o << "Patch Change " << p.id() << " @ " << p.time() << " bank " << (int) p.bank() << " program " << (int) p.program();
return o;
}

View File

@ -21,9 +21,11 @@
#include <list>
#include "evoral/visibility.h"
namespace Evoral {
enum OverlapType {
enum LIBEVORAL_API OverlapType {
OverlapNone, // no overlap
OverlapInternal, // the overlap is 100% with the object
OverlapStart, // overlap covers start, but ends within
@ -32,7 +34,7 @@ enum OverlapType {
};
template<typename T>
OverlapType coverage (T sa, T ea, T sb, T eb) {
LIBEVORAL_API OverlapType coverage (T sa, T ea, T sb, T eb) {
/* OverlapType returned reflects how the second (B)
range overlaps the first (A).
@ -107,7 +109,7 @@ OverlapType coverage (T sa, T ea, T sb, T eb) {
/** Type to describe a time range */
template<typename T>
struct Range {
struct LIBEVORAL_API Range {
Range (T f, T t) : from (f), to (t) {}
T from; ///< start of the range
T to; ///< end of the range
@ -119,7 +121,7 @@ bool operator== (Range<T> a, Range<T> b) {
}
template<typename T>
class RangeList {
class LIBEVORAL_API RangeList {
public:
RangeList () : _dirty (false) {}
@ -172,7 +174,7 @@ private:
/** Type to describe the movement of a time range */
template<typename T>
struct RangeMove {
struct LIBEVORAL_API RangeMove {
RangeMove (T f, double l, T t) : from (f), length (l), to (t) {}
T from; ///< start of the range
double length; ///< length of the range

View File

@ -21,6 +21,8 @@
#define EVORAL_SMF_HPP
#include <cassert>
#include "evoral/visibility.h"
#include "evoral/types.hpp"
struct smf_struct;
@ -35,7 +37,7 @@ namespace Evoral {
/** Standard Midi File.
* Currently only tempo-based time of a given PPQN is supported.
*/
class SMF {
class LIBEVORAL_API SMF {
public:
class FileError : public std::exception {
public:

View File

@ -24,6 +24,8 @@
#include <string>
#include <inttypes.h>
#include "evoral/visibility.h"
namespace Evoral {
@ -31,7 +33,7 @@ namespace Evoral {
*
* Currently this only reads SMF files with tempo-based timing.
*/
class SMFReader {
class LIBEVORAL_API SMFReader {
public:
class PrematureEOF : public std::exception {
const char* what() const throw() { return "Unexpected end of file"; }

View File

@ -26,6 +26,8 @@
#include <utility>
#include <boost/shared_ptr.hpp>
#include <glibmm/threads.h>
#include "evoral/visibility.h"
#include "evoral/types.hpp"
#include "evoral/Note.hpp"
#include "evoral/Parameter.hpp"
@ -42,7 +44,7 @@ template<typename Time> class Event;
/** An iterator over (the x axis of) a 2-d double coordinate space.
*/
class ControlIterator {
class LIBEVORAL_API ControlIterator {
public:
ControlIterator(boost::shared_ptr<const ControlList> al, double ax, double ay)
: list(al)
@ -60,7 +62,7 @@ public:
* notes (instead of just unassociated note on/off events) and controller data.
* Controller data is represented as a list of time-stamped float values. */
template<typename Time>
class Sequence : virtual public ControlSet {
class LIBEVORAL_API Sequence : virtual public ControlSet {
public:
Sequence(const TypeMap& type_map);
Sequence(const Sequence<Time>& other);
@ -354,7 +356,7 @@ private:
} // namespace Evoral
template<typename Time> std::ostream& operator<<(std::ostream& o, const Evoral::Sequence<Time>& s) { s.dump (o); return o; }
template<typename Time> LIBEVORAL_API std::ostream& operator<<(std::ostream& o, const Evoral::Sequence<Time>& s) { s.dump (o); return o; }
#endif // EVORAL_SEQUENCE_HPP

View File

@ -19,6 +19,8 @@
#ifndef EVORAL_TIME_CONVERTER_HPP
#define EVORAL_TIME_CONVERTER_HPP
#include "evoral/visibility.h"
namespace Evoral {
/** A bidirectional converter between two different time units.
@ -33,7 +35,7 @@ namespace Evoral {
* from() converts a time _origin_b + b into an offset from _origin_b in units of A.
*/
template<typename A, typename B>
class TimeConverter {
class LIBEVORAL_API TimeConverter {
public:
TimeConverter () : _origin_b (0) {}
TimeConverter (B ob) : _origin_b (ob) {}
@ -63,7 +65,7 @@ protected:
* going on.
*/
template<typename A, typename B>
class IdentityConverter : public TimeConverter<A,B> {
class LIBEVORAL_API IdentityConverter : public TimeConverter<A,B> {
public:
IdentityConverter() {}
B to(A a) const { return static_cast<B>(a); }

View File

@ -19,6 +19,7 @@
#ifndef EVORAL_TYPE_MAP_HPP
#define EVORAL_TYPE_MAP_HPP
#include "evoral/visibility.h"
#include "evoral/types.hpp"
namespace Evoral {
@ -28,7 +29,7 @@ class Parameter;
/** The applications passes one of these which provide the implementation
* with required information about event types in an opaque, type neutral way
*/
class TypeMap {
class LIBEVORAL_API TypeMap {
public:
virtual ~TypeMap() {}

View File

@ -26,6 +26,8 @@
#include <string>
#include <sys/types.h>
#include <assert.h>
#include "evoral/visibility.h"
#include "evoral/midi_events.h"
namespace Evoral {
@ -120,7 +122,7 @@ midi_event_is_valid(const uint8_t* buffer, size_t len)
return true;
}
std::string midi_note_name (uint8_t noteval);
LIBEVORAL_API std::string midi_note_name (uint8_t noteval);
} // namespace Evoral

View File

@ -26,6 +26,8 @@
#include "pbd/debug.h"
#include "evoral/visibility.h"
namespace Evoral {
/** ID of an event (note or other). This must be operable on by glib
@ -35,6 +37,7 @@ typedef int32_t event_id_t;
/** Musical time: beats relative to some defined origin */
typedef double MusicalTime;
const MusicalTime MaxMusicalTime = DBL_MAX;
const MusicalTime MinMusicalTime = DBL_MIN;
@ -77,9 +80,9 @@ typedef uint32_t EventType;
namespace PBD {
namespace DEBUG {
extern uint64_t Sequence;
extern uint64_t Note;
extern uint64_t ControlList;
LIBEVORAL_API extern uint64_t Sequence;
LIBEVORAL_API extern uint64_t Note;
LIBEVORAL_API extern uint64_t ControlList;
}
}

View File

@ -88,8 +88,13 @@ def build(bld):
'''
# Library
obj = bld(features = 'cxx cxxshlib')
obj.source = lib_source
if bld.is_defined ('INTERNAL_SHARED_LIBS'):
obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=lib_source)
else:
obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=lib_source)
obj.cxxflags = [ '-fPIC' ]
obj.cflags = [ '-fPIC' ]
obj.export_includes = ['.']
obj.includes = ['.', './src']
obj.name = 'libevoral'
@ -98,7 +103,9 @@ def build(bld):
obj.use = 'libsmf libpbd'
obj.vnum = EVORAL_LIB_VERSION
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
obj.defines = ['PACKAGE="libevoral"', 'EVORAL_MIDI_XML=1' ]
obj.defines = ['PACKAGE="libevoral"', 'EVORAL_MIDI_XML=1'
'LIBEVORAL_DLL=1', 'LIBEVORAL_DLL_EXPORTS=1'
]
if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
# Static library (for unit test code coverage)

View File

@ -23,8 +23,6 @@
#include <queue>
#include "pbd/signals.h"
#include "midi++/types.h"
#include "midi++/parser.h"
namespace MIDI {