diff options
Diffstat (limited to 'libs/ardour')
315 files changed, 2936 insertions, 1348 deletions
diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index e21cf62d62..f6a15666e9 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -19,6 +19,7 @@ #ifndef __ardour_amp_h__ #define __ardour_amp_h__ +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/chan_count.h" #include "ardour/processor.h" @@ -32,7 +33,7 @@ class IO; /** Applies a declick operation to all audio inputs, passing the same number of * audio outputs, and passing through any other types unchanged. */ -class Amp : public Processor { +class LIBARDOUR_API Amp : public Processor { public: Amp(Session& s); diff --git a/libs/ardour/ardour/analyser.h b/libs/ardour/ardour/analyser.h index 51adea67b9..cef71186cc 100644 --- a/libs/ardour/ardour/analyser.h +++ b/libs/ardour/ardour/analyser.h @@ -23,13 +23,15 @@ #include <glibmm/threads.h> #include <boost/shared_ptr.hpp> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { class AudioFileSource; class Source; class TransientDetector; -class Analyser { +class LIBARDOUR_API Analyser { public: Analyser(); diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 80bdf9d80e..9b1351a3fc 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -34,7 +34,9 @@ #include "pbd/locale_guard.h" #include "pbd/stateful.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" +#include "ardour/libardour_visibility.h" #include <jack/jack.h> @@ -47,8 +49,8 @@ namespace ARDOUR { class AudioEngine; - extern PBD::Signal1<void,std::string> BootMessage; - extern PBD::Signal0<void> GUIIdle; + extern LIBARDOUR_API PBD::Signal1<void,std::string> BootMessage; + extern LIBARDOUR_API PBD::Signal0<void> GUIIdle; /** * @param with_vst true to enable VST Support @@ -58,27 +60,27 @@ namespace ARDOUR { * * @return true if Ardour library was successfully initialized */ - bool init (bool with_vst, bool try_optimization, const char* localedir); - void init_post_engine (); - void cleanup (); - bool no_auto_connect (); - void make_property_quarks (); + LIBARDOUR_API bool init (bool with_vst, bool try_optimization, const char* localedir); + LIBARDOUR_API void init_post_engine (); + LIBARDOUR_API void cleanup (); + LIBARDOUR_API bool no_auto_connect (); + LIBARDOUR_API void make_property_quarks (); - extern PBD::PropertyChange bounds_change; + extern LIBARDOUR_API PBD::PropertyChange bounds_change; + + extern LIBARDOUR_API const char* const ardour_config_info; - extern const char* const ardour_config_info; - - void find_bindings_files (std::map<std::string,std::string>&); + LIBARDOUR_API void find_bindings_files (std::map<std::string,std::string>&); /* these only impact bundled installations */ - std::string translation_enable_path (); - bool translations_are_enabled (); - bool set_translations_enabled (bool); + LIBARDOUR_API std::string translation_enable_path (); + LIBARDOUR_API bool translations_are_enabled (); + LIBARDOUR_API bool set_translations_enabled (bool); - microseconds_t get_microseconds (); + LIBARDOUR_API microseconds_t get_microseconds (); - void setup_fpu (); - std::vector<SyncSource> get_available_sync_options(); + LIBARDOUR_API void setup_fpu (); + LIBARDOUR_API std::vector<SyncSource> get_available_sync_options(); } #endif /* __ardour_ardour_h__ */ diff --git a/libs/ardour/ardour/async_midi_port.h b/libs/ardour/ardour/async_midi_port.h index 76bdac0409..c5babf6135 100644 --- a/libs/ardour/ardour/async_midi_port.h +++ b/libs/ardour/ardour/async_midi_port.h @@ -34,11 +34,12 @@ #include "midi++/parser.h" #include "midi++/port.h" +#include "ardour/libardour_visibility.h" #include "ardour/midi_port.h" namespace ARDOUR { - class AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port { +class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port { public: AsyncMIDIPort (std::string const &, PortFlags); @@ -52,10 +53,16 @@ namespace ARDOUR { /* called from non-RT context */ void parse (framecnt_t timestamp); - int write (const MIDI::byte *msg, size_t msglen, MIDI::timestamp_t timestamp); + int write (const MIDI::byte *msg, size_t msglen, MIDI::timestamp_t timestamp); int read (MIDI::byte *buf, size_t bufsize); void drain (int check_interval_usecs); - int selectable () const { return xthread.selectable(); } + int selectable () const { +#ifdef PLATFORM_WINDOWS + return false; +#else + return xthread.selectable(); +#endif + } static void set_process_thread (pthread_t); static pthread_t get_process_thread () { return _process_thread; } @@ -66,8 +73,22 @@ namespace ARDOUR { MIDI::timestamp_t _last_write_timestamp; RingBuffer< Evoral::Event<double> > output_fifo; Evoral::EventRingBuffer<MIDI::timestamp_t> input_fifo; - Glib::Threads::Mutex output_fifo_lock; - CrossThreadChannel xthread; + Glib::Threads::Mutex output_fifo_lock; +#ifndef PLATFORM_WINDOWS + CrossThreadChannel xthread; +#endif + + int create_port (); + + /** Channel used to signal to the MidiControlUI that input has arrived */ + + std::string _connections; + PBD::ScopedConnection connect_connection; + PBD::ScopedConnection halt_connection; + void flush (void* jack_port_buffer); + void jack_halted (); + void make_connections (); + void init (std::string const &, Flags); void flush_output_fifo (pframes_t); diff --git a/libs/ardour/ardour/audio_backend.h b/libs/ardour/ardour/audio_backend.h index 387410685b..cdfd4971c8 100644 --- a/libs/ardour/ardour/audio_backend.h +++ b/libs/ardour/ardour/audio_backend.h @@ -28,21 +28,21 @@ #include <boost/function.hpp> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/audioengine.h" #include "ardour/port_engine.h" -#include "ardour/visibility.h" #ifdef ARDOURBACKEND_DLL_EXPORTS // defined if we are building the ARDOUR Panners DLLs (instead of using them) - #define ARDOURBACKEND_API LIBARDOUR_HELPER_DLL_EXPORT + #define ARDOURBACKEND_API LIBARDOUR_DLL_EXPORT #else - #define ARDOURBACKEND_API LIBARDOUR_HELPER_DLL_IMPORT + #define ARDOURBACKEND_API LIBARDOUR_DLL_IMPORT #endif -#define ARDOURBACKEND_LOCAL LIBARDOUR_HELPER_DLL_LOCAL +#define ARDOURBACKEND_LOCAL LIBARDOUR_DLL_LOCAL namespace ARDOUR { -class AudioBackend : public PortEngine { +class LIBARDOUR_API AudioBackend : public PortEngine { public: AudioBackend (AudioEngine& e) : PortEngine (e), engine (e) {} @@ -491,7 +491,7 @@ class AudioBackend : public PortEngine { virtual int _start (bool for_latency_measurement) = 0; }; -struct AudioBackendInfo { +struct LIBARDOUR_API AudioBackendInfo { const char* name; /** Using arg1 and arg2, initialize this audiobackend. diff --git a/libs/ardour/ardour/audio_buffer.h b/libs/ardour/ardour/audio_buffer.h index c356ed82b9..a32e679b69 100644 --- a/libs/ardour/ardour/audio_buffer.h +++ b/libs/ardour/ardour/audio_buffer.h @@ -27,7 +27,7 @@ namespace ARDOUR { /** Buffer containing audio data. */ -class AudioBuffer : public Buffer +class LIBARDOUR_API AudioBuffer : public Buffer { public: AudioBuffer(size_t capacity); diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 5a856e9b36..6741ba0ed4 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -53,7 +53,7 @@ class AudioPlaylist; class AudioFileSource; class IO; -class AudioDiskstream : public Diskstream +class LIBARDOUR_API AudioDiskstream : public Diskstream { public: AudioDiskstream (Session &, const std::string& name, Diskstream::Flag f = Recordable); diff --git a/libs/ardour/ardour/audio_library.h b/libs/ardour/ardour/audio_library.h index 2009ec39a7..6397821720 100644 --- a/libs/ardour/ardour/audio_library.h +++ b/libs/ardour/ardour/audio_library.h @@ -24,9 +24,11 @@ #include <map> #include <vector> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { -class AudioLibrary +class LIBARDOUR_API AudioLibrary { public: AudioLibrary (); @@ -43,7 +45,7 @@ class AudioLibrary std::string src; }; -extern AudioLibrary* Library; +LIBARDOUR_API extern AudioLibrary* Library; } // ARDOUR namespace diff --git a/libs/ardour/ardour/audio_playlist_importer.h b/libs/ardour/ardour/audio_playlist_importer.h index 011bfe39b8..a6d68b9c73 100644 --- a/libs/ardour/ardour/audio_playlist_importer.h +++ b/libs/ardour/ardour/audio_playlist_importer.h @@ -38,7 +38,7 @@ class AudioRegionImporter; class AudioPlaylistImporter; class Session; -class AudioPlaylistImportHandler : public ElementImportHandler +class LIBARDOUR_API AudioPlaylistImportHandler : public ElementImportHandler { public: typedef boost::shared_ptr<AudioPlaylistImporter> PlaylistPtr; @@ -57,7 +57,7 @@ class AudioPlaylistImportHandler : public ElementImportHandler AudioRegionImportHandler & region_handler; }; -class UnusedAudioPlaylistImportHandler : public AudioPlaylistImportHandler +class LIBARDOUR_API UnusedAudioPlaylistImportHandler : public AudioPlaylistImportHandler { public: UnusedAudioPlaylistImportHandler (XMLTree const & source, Session & session, AudioRegionImportHandler & region_handler) : @@ -65,7 +65,7 @@ class UnusedAudioPlaylistImportHandler : public AudioPlaylistImportHandler std::string get_info () const; }; -class AudioPlaylistImporter : public ElementImporter +class LIBARDOUR_API AudioPlaylistImporter : public ElementImporter { public: AudioPlaylistImporter (XMLTree const & source, Session & session, AudioPlaylistImportHandler & handler, XMLNode const & node); diff --git a/libs/ardour/ardour/audio_playlist_source.h b/libs/ardour/ardour/audio_playlist_source.h index c2e1e87f75..6a586fc30d 100644 --- a/libs/ardour/ardour/audio_playlist_source.h +++ b/libs/ardour/ardour/audio_playlist_source.h @@ -32,7 +32,7 @@ namespace ARDOUR { class AudioPlaylist; -class AudioPlaylistSource : public PlaylistSource, public AudioSource { +class LIBARDOUR_API AudioPlaylistSource : public PlaylistSource, public AudioSource { public: virtual ~AudioPlaylistSource (); diff --git a/libs/ardour/ardour/audio_port.h b/libs/ardour/ardour/audio_port.h index f87b134e9e..ca5f183a13 100644 --- a/libs/ardour/ardour/audio_port.h +++ b/libs/ardour/ardour/audio_port.h @@ -26,7 +26,7 @@ namespace ARDOUR { -class AudioPort : public Port +class LIBARDOUR_API AudioPort : public Port { public: ~AudioPort (); diff --git a/libs/ardour/ardour/audio_region_importer.h b/libs/ardour/ardour/audio_region_importer.h index b3bcb05668..d1a965a5ee 100644 --- a/libs/ardour/ardour/audio_region_importer.h +++ b/libs/ardour/ardour/audio_region_importer.h @@ -39,7 +39,7 @@ class Region; class Session; class Source; -class AudioRegionImportHandler : public ElementImportHandler +class LIBARDOUR_API AudioRegionImportHandler : public ElementImportHandler { public: // Inerface implementation @@ -69,7 +69,7 @@ class AudioRegionImportHandler : public ElementImportHandler IdMap id_map; }; -class AudioRegionImporter : public ElementImporter +class LIBARDOUR_API AudioRegionImporter : public ElementImporter { public: AudioRegionImporter (XMLTree const & source, Session & session, AudioRegionImportHandler & handler, XMLNode const & node); diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index ada58e8ebe..1ecec88f89 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -31,7 +31,7 @@ class AudioPlaylist; class RouteGroup; class AudioFileSource; -class AudioTrack : public Track +class LIBARDOUR_API AudioTrack : public Track { public: AudioTrack (Session&, std::string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal); diff --git a/libs/ardour/ardour/audio_track_importer.h b/libs/ardour/ardour/audio_track_importer.h index 683417de24..58789177e3 100644 --- a/libs/ardour/ardour/audio_track_importer.h +++ b/libs/ardour/ardour/audio_track_importer.h @@ -34,7 +34,7 @@ namespace ARDOUR { class AudioPlaylistImportHandler; class AudioPlaylistImporter; -class AudioTrackImportHandler : public ElementImportHandler +class LIBARDOUR_API AudioTrackImportHandler : public ElementImportHandler { public: AudioTrackImportHandler (XMLTree const & source, Session & session, AudioPlaylistImportHandler & pl_handler); @@ -46,7 +46,7 @@ class AudioTrackImportHandler : public ElementImportHandler }; -class AudioTrackImporter : public ElementImporter +class LIBARDOUR_API AudioTrackImporter : public ElementImporter { public: AudioTrackImporter (XMLTree const & source, diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index 007390b34a..07f41f5526 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -41,14 +41,14 @@ class CAComponent; class CAAudioUnit; class CAComponentDescription; -struct AudioBufferList; +struct LIBARDOUR_API AudioBufferList; namespace ARDOUR { class AudioEngine; class Session; -struct AUParameterDescriptor : public Plugin::ParameterDescriptor { +struct LIBARDOUR_API AUParameterDescriptor : public Plugin::ParameterDescriptor { // additional fields to make operations more efficient AudioUnitParameterID id; AudioUnitScope scope; @@ -58,7 +58,7 @@ struct AUParameterDescriptor : public Plugin::ParameterDescriptor { AudioUnitParameterUnit unit; }; -class AUPlugin : public ARDOUR::Plugin +class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin { public: AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> comp); @@ -221,11 +221,11 @@ class AUPlugin : public ARDOUR::Plugin typedef boost::shared_ptr<AUPlugin> AUPluginPtr; -struct AUPluginCachedInfo { +struct LIBARDOUR_API AUPluginCachedInfo { std::vector<std::pair<int,int> > io_configs; }; -class AUPluginInfo : public PluginInfo { +class LIBARDOUR_API AUPluginInfo : public PluginInfo { public: AUPluginInfo (boost::shared_ptr<CAComponentDescription>); ~AUPluginInfo (); diff --git a/libs/ardour/ardour/audioanalyser.h b/libs/ardour/ardour/audioanalyser.h index f525cbd99f..6a9738eb5a 100644 --- a/libs/ardour/ardour/audioanalyser.h +++ b/libs/ardour/ardour/audioanalyser.h @@ -25,7 +25,8 @@ #include <ostream> #include <fstream> #include <boost/utility.hpp> -#include <vamp-sdk/Plugin.h> +#include "vamp-sdk/Plugin.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { @@ -33,7 +34,7 @@ namespace ARDOUR { class Readable; class Session; -class AudioAnalyser : public boost::noncopyable { +class LIBARDOUR_API AudioAnalyser : public boost::noncopyable { public: typedef Vamp::Plugin AnalysisPlugin; diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index 09f2ac04f8..75954e6ca9 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -39,6 +39,7 @@ #include "ardour/ardour.h" #include "ardour/data_type.h" #include "ardour/session_handle.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/chan_count.h" #include "ardour/port_manager.h" @@ -59,7 +60,7 @@ class ProcessThread; class AudioBackend; class AudioBackendInfo; -class AudioEngine : public SessionHandlePtr, public PortManager +class LIBARDOUR_API AudioEngine : public SessionHandlePtr, public PortManager { public: diff --git a/libs/ardour/ardour/audiofile_tagger.h b/libs/ardour/ardour/audiofile_tagger.h index 656626a5f3..88789f9036 100644 --- a/libs/ardour/ardour/audiofile_tagger.h +++ b/libs/ardour/ardour/audiofile_tagger.h @@ -27,13 +27,15 @@ #include <taglib/taglib.h> #include <taglib/xiphcomment.h> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { class SessionMetadata; /// Class with static functions for tagging audiofiles -class AudiofileTagger +class LIBARDOUR_API AudiofileTagger { public: diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index c5fd7b3af2..53819c1c9e 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -27,7 +27,7 @@ namespace ARDOUR { -struct SoundFileInfo { +struct LIBARDOUR_API SoundFileInfo { float samplerate; uint16_t channels; int64_t length; @@ -35,7 +35,7 @@ struct SoundFileInfo { int64_t timecode; }; -class AudioFileSource : public AudioSource, public FileSource { +class LIBARDOUR_API AudioFileSource : public AudioSource, public FileSource { public: virtual ~AudioFileSource (); @@ -64,6 +64,7 @@ public: virtual void clear_capture_marks() {} virtual bool one_of_several_channels () const { return false; } + virtual void flush () = 0; virtual int update_header (framepos_t when, struct tm&, time_t) = 0; virtual int flush_header () = 0; diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h index 478d4872cd..c4196dc3b6 100644 --- a/libs/ardour/ardour/audioplaylist.h +++ b/libs/ardour/ardour/audioplaylist.h @@ -29,13 +29,11 @@ namespace ARDOUR { class Session; -class Region; class AudioRegion; class Source; - class AudioPlaylist; -class AudioPlaylist : public ARDOUR::Playlist +class LIBARDOUR_API AudioPlaylist : public ARDOUR::Playlist { public: AudioPlaylist (Session&, const XMLNode&, bool hidden = false); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 83cd227bce..c3e9eec1f9 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -40,17 +40,17 @@ class PlaylistReadTest; namespace ARDOUR { namespace Properties { - extern PBD::PropertyDescriptor<bool> envelope_active; - extern PBD::PropertyDescriptor<bool> default_fade_in; - extern PBD::PropertyDescriptor<bool> default_fade_out; - extern PBD::PropertyDescriptor<bool> fade_in_active; - extern PBD::PropertyDescriptor<bool> fade_out_active; - extern PBD::PropertyDescriptor<float> scale_amplitude; - extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > fade_in; - extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > inverse_fade_in; - extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > fade_out; - extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > inverse_fade_out; - extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > envelope; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> envelope_active; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> default_fade_in; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> default_fade_out; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> fade_in_active; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> fade_out_active; + LIBARDOUR_API extern PBD::PropertyDescriptor<float> scale_amplitude; + LIBARDOUR_API extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > fade_in; + LIBARDOUR_API extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > inverse_fade_in; + LIBARDOUR_API extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > fade_out; + LIBARDOUR_API extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > inverse_fade_out; + LIBARDOUR_API extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > envelope; } class Playlist; @@ -59,7 +59,7 @@ class Filter; class AudioSource; -class AudioRegion : public Region +class LIBARDOUR_API AudioRegion : public Region { public: static void make_property_quarks (); @@ -94,7 +94,7 @@ class AudioRegion : public Region virtual framecnt_t read_peaks (PeakData *buf, framecnt_t npeaks, framecnt_t offset, framecnt_t cnt, - uint32_t chan_n=0, double samples_per_unit= 1.0) const; + uint32_t chan_n=0, double frames_per_pixel = 1.0) const; /* Readable interface */ @@ -238,9 +238,9 @@ class AudioRegion : public Region /* access from C objects */ extern "C" { - int region_read_peaks_from_c (void *arg, uint32_t npeaks, uint32_t start, uint32_t length, intptr_t data, uint32_t n_chan, double samples_per_unit); - uint32_t region_length_from_c (void *arg); - uint32_t sourcefile_length_from_c (void *arg, double); + LIBARDOUR_API int region_read_peaks_from_c (void *arg, uint32_t npeaks, uint32_t start, uint32_t length, intptr_t data, uint32_t n_chan, double samples_per_unit); + LIBARDOUR_API uint32_t region_length_from_c (void *arg); + LIBARDOUR_API uint32_t sourcefile_length_from_c (void *arg, double); } #endif /* __ardour_audio_region_h__ */ diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index d5c85a6bf8..910e03170d 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -38,7 +38,7 @@ namespace ARDOUR { -class AudioSource : virtual public Source, +class LIBARDOUR_API AudioSource : virtual public Source, public ARDOUR::Readable, public boost::enable_shared_from_this<ARDOUR::AudioSource> { diff --git a/libs/ardour/ardour/auditioner.h b/libs/ardour/ardour/auditioner.h index 7e772fe194..26e395f93e 100644 --- a/libs/ardour/ardour/auditioner.h +++ b/libs/ardour/ardour/auditioner.h @@ -33,7 +33,7 @@ class Session; class AudioRegion; class AudioPlaylist; -class Auditioner : public AudioTrack +class LIBARDOUR_API Auditioner : public AudioTrack { public: Auditioner (Session&); diff --git a/libs/ardour/ardour/auto_bundle.h b/libs/ardour/ardour/auto_bundle.h index d97080c089..703aa8e73d 100644 --- a/libs/ardour/ardour/auto_bundle.h +++ b/libs/ardour/ardour/auto_bundle.h @@ -26,7 +26,7 @@ namespace ARDOUR { -class AutoBundle : public Bundle { +class LIBARDOUR_API AutoBundle : public Bundle { public: AutoBundle (bool i = true); diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h index b10b8eb2bc..11fb48904c 100644 --- a/libs/ardour/ardour/automatable.h +++ b/libs/ardour/ardour/automatable.h @@ -26,6 +26,7 @@ #include <boost/shared_ptr.hpp> #include "pbd/signals.h" #include "evoral/ControlSet.hpp" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" class XMLNode; @@ -38,7 +39,7 @@ class AutomationControl; /* The inherited ControlSet is virtual because AutomatableSequence inherits * from this AND EvoralSequence, which is also a ControlSet */ -class Automatable : virtual public Evoral::ControlSet +class LIBARDOUR_API Automatable : virtual public Evoral::ControlSet { public: Automatable(Session&); diff --git a/libs/ardour/ardour/automatable_sequence.h b/libs/ardour/ardour/automatable_sequence.h index 730ea33a7c..b0003189a4 100644 --- a/libs/ardour/ardour/automatable_sequence.h +++ b/libs/ardour/ardour/automatable_sequence.h @@ -27,7 +27,7 @@ namespace ARDOUR { /** Contains notes and controllers */ template<typename T> -class AutomatableSequence : public Automatable, public Evoral::Sequence<T> { +class /*LIBARDOUR_API*/ AutomatableSequence : public Automatable, public Evoral::Sequence<T> { public: AutomatableSequence(Session& s) : Evoral::ControlSet() diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h index 10194b3f9b..aeee9dab30 100644 --- a/libs/ardour/ardour/automation_control.h +++ b/libs/ardour/ardour/automation_control.h @@ -26,6 +26,8 @@ #include "pbd/controllable.h" #include "evoral/Control.hpp" + +#include "ardour/libardour_visibility.h" #include "ardour/automation_list.h" namespace ARDOUR { @@ -36,7 +38,7 @@ class Automatable; /** A PBD::Controllable with associated automation data (AutomationList) */ -class AutomationControl : public PBD::Controllable, public Evoral::Control, public boost::enable_shared_from_this<AutomationControl> +class LIBARDOUR_API AutomationControl : public PBD::Controllable, public Evoral::Control, public boost::enable_shared_from_this<AutomationControl> { public: AutomationControl(ARDOUR::Session&, diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h index 71eddda6dd..6e7b0007cd 100644 --- a/libs/ardour/ardour/automation_list.h +++ b/libs/ardour/ardour/automation_list.h @@ -40,7 +40,7 @@ namespace ARDOUR { class AutomationList; /** A SharedStatefulProperty for AutomationLists */ -class AutomationListProperty : public PBD::SharedStatefulProperty<AutomationList> +class LIBARDOUR_API AutomationListProperty : public PBD::SharedStatefulProperty<AutomationList> { public: AutomationListProperty (PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > d, Ptr p) @@ -59,7 +59,7 @@ private: AutomationListProperty& operator= (AutomationListProperty const &); }; -class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlList +class LIBARDOUR_API AutomationList : public PBD::StatefulDestructible, public Evoral::ControlList { public: AutomationList (Evoral::Parameter id); diff --git a/libs/ardour/ardour/automation_watch.h b/libs/ardour/ardour/automation_watch.h index f3e343468d..db6474c062 100644 --- a/libs/ardour/ardour/automation_watch.h +++ b/libs/ardour/ardour/automation_watch.h @@ -30,7 +30,7 @@ namespace ARDOUR { class AutomationControl; -class AutomationWatch : public sigc::trackable, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList { +class LIBARDOUR_API AutomationWatch : public sigc::trackable, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList { public: static AutomationWatch& instance(); diff --git a/libs/ardour/ardour/backend_search_path.h b/libs/ardour/ardour/backend_search_path.h index 2adc22bd6f..e8a5082c71 100644 --- a/libs/ardour/ardour/backend_search_path.h +++ b/libs/ardour/ardour/backend_search_path.h @@ -32,7 +32,7 @@ namespace ARDOUR { * contain the user and system directories which may contain audio/MIDI * backends. */ - PBD::SearchPath backend_search_path (); + PBD::Searchpath backend_search_path (); } // namespace ARDOUR diff --git a/libs/ardour/ardour/beats_frames_converter.h b/libs/ardour/ardour/beats_frames_converter.h index e331b8411d..2e170d278a 100644 --- a/libs/ardour/ardour/beats_frames_converter.h +++ b/libs/ardour/ardour/beats_frames_converter.h @@ -20,6 +20,7 @@ */ #include "evoral/TimeConverter.hpp" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #ifndef __ardour_beats_frames_converter_h__ @@ -33,7 +34,7 @@ class TempoMap; * from some origin (supplied to the constructor in frames), and converts * them to the opposite unit, taking tempo changes into account. */ -class BeatsFramesConverter : public Evoral::TimeConverter<double,framepos_t> { +class LIBARDOUR_API BeatsFramesConverter : public Evoral::TimeConverter<double,framepos_t> { public: BeatsFramesConverter (TempoMap& tempo_map, framepos_t origin) : Evoral::TimeConverter<double, framepos_t> (origin) diff --git a/libs/ardour/ardour/broadcast_info.h b/libs/ardour/ardour/broadcast_info.h index 0e87d6e6df..97f86dd133 100644 --- a/libs/ardour/ardour/broadcast_info.h +++ b/libs/ardour/ardour/broadcast_info.h @@ -23,6 +23,7 @@ #include <string> +#include "ardour/libardour_visibility.h" #include "audiographer/broadcast_info.h" namespace ARDOUR @@ -30,7 +31,7 @@ namespace ARDOUR class Session; -class BroadcastInfo : public AudioGrapher::BroadcastInfo +class LIBARDOUR_API BroadcastInfo : public AudioGrapher::BroadcastInfo { public: BroadcastInfo (); diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h index 0d0f5d3758..d6f333a5a1 100644 --- a/libs/ardour/ardour/buffer.h +++ b/libs/ardour/ardour/buffer.h @@ -23,6 +23,7 @@ #include <boost/utility.hpp> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/data_type.h" @@ -38,7 +39,7 @@ namespace ARDOUR { * * To actually read/write buffer contents, use the appropriate derived class. */ -class Buffer : public boost::noncopyable +class LIBARDOUR_API Buffer : public boost::noncopyable { public: virtual ~Buffer() {} diff --git a/libs/ardour/ardour/buffer_manager.h b/libs/ardour/ardour/buffer_manager.h index fccd981fba..f5a3935ead 100644 --- a/libs/ardour/ardour/buffer_manager.h +++ b/libs/ardour/ardour/buffer_manager.h @@ -32,7 +32,7 @@ namespace ARDOUR { class ThreadBuffers; -class BufferManager +class LIBARDOUR_API BufferManager { public: static void init (uint32_t); diff --git a/libs/ardour/ardour/buffer_set.h b/libs/ardour/ardour/buffer_set.h index 5f8553218b..34e26d5b3a 100644 --- a/libs/ardour/ardour/buffer_set.h +++ b/libs/ardour/ardour/buffer_set.h @@ -27,6 +27,7 @@ #include <vector> #include "ardour/chan_count.h" #include "ardour/data_type.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #if defined VST_SUPPORT || defined LXVST_SUPPORT @@ -61,7 +62,7 @@ class PortSet; * others the form of their output (eg what they did to the BufferSet). * Setting the use counts is realtime safe. */ -class BufferSet +class LIBARDOUR_API BufferSet { public: BufferSet(); diff --git a/libs/ardour/ardour/bundle.h b/libs/ardour/ardour/bundle.h index 02845481b6..ef2247f12b 100644 --- a/libs/ardour/ardour/bundle.h +++ b/libs/ardour/ardour/bundle.h @@ -40,7 +40,7 @@ class AudioEngine; * `Channel' is a rather overloaded term but I can't think of a better * one right now. */ -class Bundle : public PBD::ScopedConnectionList +class LIBARDOUR_API Bundle : public PBD::ScopedConnectionList { public: @@ -149,7 +149,7 @@ class Bundle : public PBD::ScopedConnectionList Change _pending_change; }; -class BundleChannel +class LIBARDOUR_API BundleChannel { public: BundleChannel () : channel (-1) {} diff --git a/libs/ardour/ardour/butler.h b/libs/ardour/ardour/butler.h index cdd48c3e3a..efdaad1621 100644 --- a/libs/ardour/ardour/butler.h +++ b/libs/ardour/ardour/butler.h @@ -20,13 +20,22 @@ #ifndef __ardour_butler_h__ #define __ardour_butler_h__ +#include <pthread.h> + #include <glibmm/threads.h> +#ifdef PLATFORM_WINDOWS +#include "pbd/glib_semaphore.h" +#endif + #include "pbd/ringbuffer.h" #include "pbd/pool.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/session_handle.h" + + namespace ARDOUR { /** @@ -36,7 +45,7 @@ namespace ARDOUR { * are empty they are deleted. */ -class Butler : public SessionHandleRef +class LIBARDOUR_API Butler : public SessionHandleRef { public: Butler (Session& session); @@ -71,15 +80,43 @@ class Butler : public SessionHandleRef Glib::Threads::Cond paused; bool should_run; mutable gint should_do_transport_work; - int request_pipe[2]; framecnt_t audio_dstream_capture_buffer_size; framecnt_t audio_dstream_playback_buffer_size; uint32_t midi_dstream_buffer_size; RingBuffer<CrossThreadPool*> pool_trash; +#ifdef PLATFORM_WINDOWS + PBD::atomic_counter m_request_state; + PBD::GlibSemaphore m_request_sem; +#else + int request_pipe[2]; +#endif + private: void empty_pool_trash (); void config_changed (std::string); + +#ifndef PLATFORM_WINDOWS + int setup_request_pipe (); +#endif + + /** + * return true if there are requests to be processed + */ + bool wait_for_requests (); + + /** + * Remove request from butler request queue + * + * return true if there was another request and req is valid + */ + bool dequeue_request (Request::Type& req); + + /** + * Add request to butler thread request queue + */ + void queue_request (Request::Type r); + }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/caimportable.h b/libs/ardour/ardour/caimportable.h index 1ed8676ee6..211329b8c6 100644 --- a/libs/ardour/ardour/caimportable.h +++ b/libs/ardour/ardour/caimportable.h @@ -21,6 +21,7 @@ #define __ardour_ca_importable_source_h__ #include "pbd/failed_constructor.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/importable_source.h" @@ -28,7 +29,7 @@ namespace ARDOUR { -class CAImportableSource : public ImportableSource { +class LIBARDOUR_API CAImportableSource : public ImportableSource { public: CAImportableSource (const std::string& path); virtual ~CAImportableSource(); diff --git a/libs/ardour/ardour/capturing_processor.h b/libs/ardour/ardour/capturing_processor.h index 5b9ea51557..9a91e6d02f 100644 --- a/libs/ardour/ardour/capturing_processor.h +++ b/libs/ardour/ardour/capturing_processor.h @@ -24,7 +24,7 @@ namespace ARDOUR { -class CapturingProcessor : public Processor +class LIBARDOUR_API CapturingProcessor : public Processor { public: CapturingProcessor (Session & session); diff --git a/libs/ardour/ardour/chan_count.h b/libs/ardour/ardour/chan_count.h index c4f3caef6b..9f9fd07543 100644 --- a/libs/ardour/ardour/chan_count.h +++ b/libs/ardour/ardour/chan_count.h @@ -26,6 +26,10 @@ #include "pbd/xml++.h" #include "ardour/data_type.h" +#ifdef INFINITE +#undef INFINITE +#endif + namespace ARDOUR { @@ -34,7 +38,7 @@ namespace ARDOUR { * Operators are defined so this may safely be used as if it were a simple * (single-typed) integer count of channels. */ -class ChanCount { +class LIBARDOUR_API ChanCount { public: ChanCount(const XMLNode& node); ChanCount() { reset(); } diff --git a/libs/ardour/ardour/chan_mapping.h b/libs/ardour/ardour/chan_mapping.h index 5b63844f66..ebb7be402a 100644 --- a/libs/ardour/ardour/chan_mapping.h +++ b/libs/ardour/ardour/chan_mapping.h @@ -34,7 +34,7 @@ namespace ARDOUR { /** A mapping from one set of channels to another * (e.g. how to 'connect' two BufferSets). */ -class ChanMapping { +class LIBARDOUR_API ChanMapping { public: ChanMapping() {} ChanMapping(ARDOUR::ChanCount identity); diff --git a/libs/ardour/ardour/click.h b/libs/ardour/ardour/click.h index 1047540a74..7fc6d21f73 100644 --- a/libs/ardour/ardour/click.h +++ b/libs/ardour/ardour/click.h @@ -23,12 +23,13 @@ #include <list> #include "pbd/pool.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/io.h" namespace ARDOUR { -class Click { +class LIBARDOUR_API Click { public: framepos_t start; framecnt_t duration; @@ -49,7 +50,7 @@ private: static Pool pool; }; -class ClickIO : public IO +class LIBARDOUR_API ClickIO : public IO { public: ClickIO (Session& s, const std::string& name) : IO (s, name, IO::Output) {} diff --git a/libs/ardour/ardour/comparable_shared_ptr.h b/libs/ardour/ardour/comparable_shared_ptr.h index 5ff19af419..f5e9cd346a 100644 --- a/libs/ardour/ardour/comparable_shared_ptr.h +++ b/libs/ardour/ardour/comparable_shared_ptr.h @@ -21,10 +21,12 @@ #ifndef __ardour_comparable_shared_ptr_h__ #define __ardour_comparable_shared_ptr_h__ +#include "ardour/libardour_visibility.h" + namespace ARDOUR { template<typename T> -class ComparableSharedPtr : public boost::shared_ptr<T> +class /*LIBARDOUR_API*/ ComparableSharedPtr : public boost::shared_ptr<T> , public boost::less_than_comparable<ComparableSharedPtr<T> > { public: diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index 14a43e160c..f8e512e458 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -29,7 +29,7 @@ class XMLNode; namespace ARDOUR { -class Configuration : public PBD::Stateful +class LIBARDOUR_API Configuration : public PBD::Stateful { public: Configuration(); diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h index a7fe8def48..7a83c34c3f 100644 --- a/libs/ardour/ardour/configuration_variable.h +++ b/libs/ardour/ardour/configuration_variable.h @@ -25,12 +25,13 @@ #include "pbd/xml++.h" #include "pbd/convert.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/utils.h" namespace ARDOUR { -class ConfigVariableBase { +class LIBARDOUR_API ConfigVariableBase { public: ConfigVariableBase (std::string str) : _name (str) {} @@ -51,7 +52,7 @@ class ConfigVariableBase { }; template<class T> -class ConfigVariable : public ConfigVariableBase +class /*LIBARDOUR_API*/ ConfigVariable : public ConfigVariableBase { public: @@ -91,7 +92,7 @@ class ConfigVariable : public ConfigVariableBase /** Specialisation of ConfigVariable for std::string to cope with whitespace properly */ template<> -class ConfigVariable<std::string> : public ConfigVariableBase +class /*LIBARDOUR_API*/ ConfigVariable<std::string> : public ConfigVariableBase { public: @@ -126,7 +127,7 @@ class ConfigVariable<std::string> : public ConfigVariableBase }; template<> -class ConfigVariable<bool> : public ConfigVariableBase +class /*LIBARDOUR_API*/ ConfigVariable<bool> : public ConfigVariableBase { public: @@ -163,7 +164,7 @@ class ConfigVariable<bool> : public ConfigVariableBase }; template<class T> -class ConfigVariableWithMutation : public ConfigVariable<T> +class /*LIBARDOUR_API*/ ConfigVariableWithMutation : public ConfigVariable<T> { public: ConfigVariableWithMutation (std::string name, T val, T (*m)(T)) @@ -192,7 +193,7 @@ class ConfigVariableWithMutation : public ConfigVariable<T> }; template<> -class ConfigVariableWithMutation<std::string> : public ConfigVariable<std::string> +class /*LIBARDOUR_API*/ ConfigVariableWithMutation<std::string> : public ConfigVariable<std::string> { public: ConfigVariableWithMutation (std::string name, std::string val, std::string (*m)(std::string)) diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h index 7d3d4872e6..0c8c9014f0 100644 --- a/libs/ardour/ardour/control_protocol_manager.h +++ b/libs/ardour/ardour/control_protocol_manager.h @@ -35,7 +35,7 @@ class ControlProtocol; class ControlProtocolDescriptor; class Session; -class ControlProtocolInfo { +class LIBARDOUR_API ControlProtocolInfo { public: ControlProtocolDescriptor* descriptor; ControlProtocol* protocol; @@ -52,7 +52,7 @@ public: ~ControlProtocolInfo() { delete state; } }; -class ControlProtocolManager : public PBD::Stateful, public ARDOUR::SessionHandlePtr +class LIBARDOUR_API ControlProtocolManager : public PBD::Stateful, public ARDOUR::SessionHandlePtr { public: ~ControlProtocolManager (); diff --git a/libs/ardour/ardour/control_protocol_search_path.h b/libs/ardour/ardour/control_protocol_search_path.h index 8795f4501a..4fe790ef80 100644 --- a/libs/ardour/ardour/control_protocol_search_path.h +++ b/libs/ardour/ardour/control_protocol_search_path.h @@ -25,15 +25,15 @@ namespace ARDOUR { /** - * return a SearchPath containing directories in which to look for + * return a Searchpath containing directories in which to look for * control surface plugins. * - * If ARDOUR_SURFACES_PATH is defined then the SearchPath returned + * If ARDOUR_SURFACES_PATH is defined then the Searchpath returned * will contain only those directories specified in it, otherwise it will * contain the user and system directories which may contain control * surface plugins. */ - PBD::SearchPath control_protocol_search_path (); + PBD::Searchpath control_protocol_search_path (); } // namespace ARDOUR diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h index 820fa0b9d8..f12a67ded7 100644 --- a/libs/ardour/ardour/coreaudiosource.h +++ b/libs/ardour/ardour/coreaudiosource.h @@ -28,7 +28,7 @@ using namespace std; namespace ARDOUR { -class CoreAudioSource : public AudioFileSource { +class LIBARDOUR_API CoreAudioSource : public AudioFileSource { public: CoreAudioSource (ARDOUR::Session&, const XMLNode&); CoreAudioSource (ARDOUR::Session&, const string& path, int chn, Flag); @@ -43,6 +43,8 @@ class CoreAudioSource : public AudioFileSource { void set_header_timeline_position () {}; bool clamped_at_unity () const { return false; } + void flush () {} + static int get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg); protected: diff --git a/libs/ardour/ardour/cycle_timer.h b/libs/ardour/ardour/cycle_timer.h index 35cc2a4c73..cab389ee69 100644 --- a/libs/ardour/ardour/cycle_timer.h +++ b/libs/ardour/ardour/cycle_timer.h @@ -24,12 +24,13 @@ #include <iostream> #include <cstdlib> +#include "ardour/libardour_visibility.h" #include "ardour/cycles.h" #include "ardour/debug.h" float get_mhz (); -class CycleTimer { +class LIBARDOUR_API CycleTimer { private: static float cycles_per_usec; #ifndef NDEBUG @@ -48,6 +49,8 @@ class CycleTimer { } _entry = get_cycles(); } +#else + (void) name; #endif } @@ -61,7 +64,7 @@ class CycleTimer { } }; -class StoringTimer +class LIBARDOUR_API StoringTimer { public: StoringTimer (int); diff --git a/libs/ardour/ardour/cycles.h b/libs/ardour/ardour/cycles.h index 01e1d55221..dc1095db7b 100644 --- a/libs/ardour/ardour/cycles.h +++ b/libs/ardour/ardour/cycles.h @@ -216,7 +216,10 @@ static inline cycles_t get_cycles (void) /* debian: sparc, arm, m68k */ +#ifndef COMPILER_MSVC +/* GRRR... Annoyingly, #warning aborts the compilation for MSVC !! */ #warning You are compiling libardour on a platform for which ardour/cycles.h needs work +#endif #include <sys/time.h> diff --git a/libs/ardour/ardour/data_type.h b/libs/ardour/ardour/data_type.h index b4129e2629..2a4514a5cf 100644 --- a/libs/ardour/ardour/data_type.h +++ b/libs/ardour/ardour/data_type.h @@ -24,6 +24,8 @@ #include <stdint.h> #include <glib.h> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { /** A type of Data Ardour is capable of processing. @@ -32,7 +34,7 @@ namespace ARDOUR { * other type representations, simple comparison between then, etc. This code * is deliberately 'ugly' so other code doesn't have to be. */ -class DataType +class LIBARDOUR_API DataType { public: /** Numeric symbol for this DataType. diff --git a/libs/ardour/ardour/debug.h b/libs/ardour/ardour/debug.h index 5811f7a484..d5d81b8772 100644 --- a/libs/ardour/ardour/debug.h +++ b/libs/ardour/ardour/debug.h @@ -24,46 +24,48 @@ #include <sstream> +#include "ardour/libardour_visibility.h" #include "pbd/debug.h" namespace PBD { namespace DEBUG { - extern uint64_t MidiSourceIO; - extern uint64_t MidiPlaylistIO; - extern uint64_t MidiDiskstreamIO; - extern uint64_t SnapBBT; - extern uint64_t Configuration; - extern uint64_t Latency; - extern uint64_t Processors; - extern uint64_t ProcessThreads; - extern uint64_t Graph; - extern uint64_t Destruction; - extern uint64_t MTC; - extern uint64_t LTC; - extern uint64_t Transport; - extern uint64_t Slave; - extern uint64_t SessionEvents; - extern uint64_t MidiIO; - extern uint64_t MackieControl; - extern uint64_t MidiClock; - extern uint64_t Monitor; - extern uint64_t Solo; - extern uint64_t AudioPlayback; - extern uint64_t Panning; - extern uint64_t LV2; - extern uint64_t CaptureAlignment; - extern uint64_t PluginManager; - extern uint64_t AudioUnits; - extern uint64_t ControlProtocols; - extern uint64_t CycleTimers; - extern uint64_t MidiTrackers; - extern uint64_t Layering; - extern uint64_t TempoMath; - extern uint64_t TempoMap; - extern uint64_t OrderKeys; - extern uint64_t Automation; - extern uint64_t WiimoteControl; - extern uint64_t Ports; + LIBARDOUR_API extern uint64_t MidiSourceIO; + LIBARDOUR_API extern uint64_t MidiPlaylistIO; + LIBARDOUR_API extern uint64_t MidiDiskstreamIO; + LIBARDOUR_API extern uint64_t SnapBBT; + LIBARDOUR_API extern uint64_t Configuration; + LIBARDOUR_API extern uint64_t Latency; + LIBARDOUR_API extern uint64_t Peaks; + LIBARDOUR_API extern uint64_t Processors; + LIBARDOUR_API extern uint64_t ProcessThreads; + LIBARDOUR_API extern uint64_t Graph; + LIBARDOUR_API extern uint64_t Destruction; + LIBARDOUR_API extern uint64_t MTC; + LIBARDOUR_API extern uint64_t LTC; + LIBARDOUR_API extern uint64_t Transport; + LIBARDOUR_API extern uint64_t Slave; + LIBARDOUR_API extern uint64_t SessionEvents; + LIBARDOUR_API extern uint64_t MidiIO; + LIBARDOUR_API extern uint64_t MackieControl; + LIBARDOUR_API extern uint64_t MidiClock; + LIBARDOUR_API extern uint64_t Monitor; + LIBARDOUR_API extern uint64_t Solo; + LIBARDOUR_API extern uint64_t AudioPlayback; + LIBARDOUR_API extern uint64_t Panning; + LIBARDOUR_API extern uint64_t LV2; + LIBARDOUR_API extern uint64_t CaptureAlignment; + LIBARDOUR_API extern uint64_t PluginManager; + LIBARDOUR_API extern uint64_t AudioUnits; + LIBARDOUR_API extern uint64_t ControlProtocols; + LIBARDOUR_API extern uint64_t CycleTimers; + LIBARDOUR_API extern uint64_t MidiTrackers; + LIBARDOUR_API extern uint64_t Layering; + LIBARDOUR_API extern uint64_t TempoMath; + LIBARDOUR_API extern uint64_t TempoMap; + LIBARDOUR_API extern uint64_t OrderKeys; + LIBARDOUR_API extern uint64_t Automation; + LIBARDOUR_API extern uint64_t WiimoteControl; + LIBARDOUR_API extern uint64_t Ports; } } diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h index 4a6d4368a6..e19eef719f 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -21,6 +21,7 @@ #include <string> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/chan_count.h" #include "ardour/io_processor.h" @@ -34,7 +35,7 @@ class PannerShell; class Panner; class Pannable; -class Delivery : public IOProcessor +class LIBARDOUR_API Delivery : public IOProcessor { public: enum Role { diff --git a/libs/ardour/ardour/directory_names.h b/libs/ardour/ardour/directory_names.h index 935cdd977b..17532e2a3a 100644 --- a/libs/ardour/ardour/directory_names.h +++ b/libs/ardour/ardour/directory_names.h @@ -21,24 +21,28 @@ #ifndef __ardour_directory_names_h__ #define __ardour_directory_names_h__ +#include "ardour/libardour_visibility.h" + namespace ARDOUR { -extern const char* const old_sound_dir_name; -extern const char* const sound_dir_name; -extern const char* const midi_dir_name; -extern const char* const midi_patch_dir_name; -extern const char* const video_dir_name; -extern const char* const dead_dir_name; -extern const char* const interchange_dir_name; -extern const char* const peak_dir_name; -extern const char* const export_dir_name; -extern const char* const export_formats_dir_name; -extern const char* const templates_dir_name; -extern const char* const route_templates_dir_name; -extern const char* const surfaces_dir_name; -extern const char* const user_config_dir_name; -extern const char* const panner_dir_name; -extern const char* const backend_dir_name; + LIBARDOUR_API extern const char* const old_sound_dir_name; + LIBARDOUR_API extern const char* const sound_dir_name; + LIBARDOUR_API extern const char* const ladspa_dir_name; + LIBARDOUR_API extern const char* const midi_dir_name; + LIBARDOUR_API extern const char* const midi_patch_dir_name; + LIBARDOUR_API extern const char* const video_dir_name; + LIBARDOUR_API extern const char* const dead_dir_name; + LIBARDOUR_API extern const char* const interchange_dir_name; + LIBARDOUR_API extern const char* const peak_dir_name; + LIBARDOUR_API extern const char* const export_dir_name; + LIBARDOUR_API extern const char* const export_formats_dir_name; + LIBARDOUR_API extern const char* const templates_dir_name; + LIBARDOUR_API extern const char* const route_templates_dir_name; + LIBARDOUR_API extern const char* const surfaces_dir_name; + LIBARDOUR_API extern const char* const ladspa_dir_name; + LIBARDOUR_API extern const char* const user_config_dir_name; + LIBARDOUR_API extern const char* const panner_dir_name; + LIBARDOUR_API extern const char* const backend_dir_name; }; diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index 7a4bccbb46..5bd18663b8 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -34,6 +34,7 @@ #include "ardour/ardour.h" #include "ardour/chan_count.h" #include "ardour/session_object.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/utils.h" #include "ardour/public_diskstream.h" @@ -54,7 +55,7 @@ class BufferSet; /** Parent class for classes which can stream data to and from disk. * These are used by Tracks to get playback and put recorded data. */ -class Diskstream : public SessionObject, public PublicDiskstream +class LIBARDOUR_API Diskstream : public SessionObject, public PublicDiskstream { public: enum Flag { diff --git a/libs/ardour/ardour/element_import_handler.h b/libs/ardour/ardour/element_import_handler.h index be2e3fafb0..32898ec9de 100644 --- a/libs/ardour/ardour/element_import_handler.h +++ b/libs/ardour/ardour/element_import_handler.h @@ -27,6 +27,9 @@ #include <boost/shared_ptr.hpp> +#include "ardour/libardour_visibility.h" +#include "pbd/libpbd_visibility.h" + class XMLTree; namespace ARDOUR { @@ -35,7 +38,7 @@ class Session; class ElementImporter; /// Virtual interface class for element import handlers -class ElementImportHandler +class LIBARDOUR_API ElementImportHandler { public: typedef boost::shared_ptr<ElementImporter> ElementPtr; diff --git a/libs/ardour/ardour/element_importer.h b/libs/ardour/ardour/element_importer.h index 8c25fd380d..b6d6ff7166 100644 --- a/libs/ardour/ardour/element_importer.h +++ b/libs/ardour/ardour/element_importer.h @@ -25,6 +25,7 @@ #include <utility> #include "pbd/signals.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" class XMLTree; @@ -34,7 +35,7 @@ class Session; class ImportStatus; /// Virtual interface class for element importers -class ElementImporter +class LIBARDOUR_API ElementImporter { public: diff --git a/libs/ardour/ardour/event_type_map.h b/libs/ardour/ardour/event_type_map.h index 02852e9711..fbfd9ec73c 100644 --- a/libs/ardour/ardour/event_type_map.h +++ b/libs/ardour/ardour/event_type_map.h @@ -25,12 +25,14 @@ #include "evoral/TypeMap.hpp" #include "evoral/ControlList.hpp" +#include "ardour/libardour_visibility.h" + namespace ARDOUR { /** This is the interface Ardour provides to Evoral about what * parameter and event types/ranges/names etc. to use. */ -class EventTypeMap : public Evoral::TypeMap { +class LIBARDOUR_API EventTypeMap : public Evoral::TypeMap { public: bool type_is_midi(uint32_t type) const; uint8_t parameter_midi_type(const Evoral::Parameter& param) const; diff --git a/libs/ardour/ardour/export_channel.h b/libs/ardour/ardour/export_channel.h index f3244095a3..894406874e 100644 --- a/libs/ardour/ardour/export_channel.h +++ b/libs/ardour/ardour/export_channel.h @@ -40,7 +40,7 @@ class AudioRegion; class CapturingProcessor; /// Export channel base class interface for different source types -class ExportChannel : public boost::less_than_comparable<ExportChannel> +class LIBARDOUR_API ExportChannel : public boost::less_than_comparable<ExportChannel> { public: @@ -62,7 +62,7 @@ class ExportChannel : public boost::less_than_comparable<ExportChannel> }; /// Basic export channel that reads from AudioPorts -class PortExportChannel : public ExportChannel +class LIBARDOUR_API PortExportChannel : public ExportChannel { public: typedef std::set<boost::weak_ptr<AudioPort> > PortSet; @@ -89,7 +89,7 @@ class PortExportChannel : public ExportChannel /// Handles RegionExportChannels and does actual reading from region -class RegionExportChannelFactory +class LIBARDOUR_API RegionExportChannelFactory { public: enum Type { @@ -128,7 +128,7 @@ class RegionExportChannelFactory }; /// Export channel that reads from region channel -class RegionExportChannel : public ExportChannel +class LIBARDOUR_API RegionExportChannel : public ExportChannel { friend class RegionExportChannelFactory; @@ -152,7 +152,7 @@ class RegionExportChannel : public ExportChannel }; /// Export channel for exporting from different positions in a route -class RouteExportChannel : public ExportChannel +class LIBARDOUR_API RouteExportChannel : public ExportChannel { class ProcessorRemover; // fwd declaration diff --git a/libs/ardour/ardour/export_channel_configuration.h b/libs/ardour/ardour/export_channel_configuration.h index b625be9dc3..4cab886c88 100644 --- a/libs/ardour/ardour/export_channel_configuration.h +++ b/libs/ardour/ardour/export_channel_configuration.h @@ -37,7 +37,7 @@ namespace ARDOUR class Session; -class ExportChannelConfiguration : public boost::enable_shared_from_this<ExportChannelConfiguration> +class LIBARDOUR_API ExportChannelConfiguration : public boost::enable_shared_from_this<ExportChannelConfiguration> { private: diff --git a/libs/ardour/ardour/export_failed.h b/libs/ardour/ardour/export_failed.h index 16687826b1..f1fd57ab4b 100644 --- a/libs/ardour/ardour/export_failed.h +++ b/libs/ardour/ardour/export_failed.h @@ -24,10 +24,12 @@ #include <exception> #include <string> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { -class ExportFailed : public std::exception +class LIBARDOUR_API ExportFailed : public std::exception { public: ExportFailed (std::string const &); diff --git a/libs/ardour/ardour/export_filename.h b/libs/ardour/ardour/export_filename.h index 994f584e8d..7eacc11b90 100644 --- a/libs/ardour/ardour/export_filename.h +++ b/libs/ardour/ardour/export_filename.h @@ -34,7 +34,7 @@ namespace ARDOUR class Session; -class ExportFilename { +class LIBARDOUR_API ExportFilename { public: enum DateFormat { diff --git a/libs/ardour/ardour/export_format_base.h b/libs/ardour/ardour/export_format_base.h index a21c977833..7f09d148fe 100644 --- a/libs/ardour/ardour/export_format_base.h +++ b/libs/ardour/ardour/export_format_base.h @@ -30,6 +30,7 @@ #include <samplerate.h> #include "pbd/signals.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "audiographer/general/sample_format_converter.h" @@ -37,7 +38,7 @@ namespace ARDOUR { -class ExportFormatBase { +class LIBARDOUR_API ExportFormatBase { public: enum Type { @@ -113,7 +114,7 @@ class ExportFormatBase { }; /// Class for managing selection and compatibility states - class SelectableCompatible { + class LIBARDOUR_API SelectableCompatible { public: SelectableCompatible () : _selected (false), _compatible (true) { } diff --git a/libs/ardour/ardour/export_format_compatibility.h b/libs/ardour/ardour/export_format_compatibility.h index a220e4e4a2..6f6e367ae0 100644 --- a/libs/ardour/ardour/export_format_compatibility.h +++ b/libs/ardour/ardour/export_format_compatibility.h @@ -28,7 +28,7 @@ namespace ARDOUR { /// Allows adding to all sets. A format should be able to test if it is compatible with this -class ExportFormatCompatibility : public ExportFormatBase, public ExportFormatBase::SelectableCompatible { +class LIBARDOUR_API ExportFormatCompatibility : public ExportFormatBase, public ExportFormatBase::SelectableCompatible { private: public: diff --git a/libs/ardour/ardour/export_format_manager.h b/libs/ardour/ardour/export_format_manager.h index 2b5d0ad804..9a95111509 100644 --- a/libs/ardour/ardour/export_format_manager.h +++ b/libs/ardour/ardour/export_format_manager.h @@ -39,7 +39,7 @@ class ExportFormatCompatibility; class ExportFormatSpecification; class AnyTime; -class ExportFormatManager : public PBD::ScopedConnectionList +class LIBARDOUR_API ExportFormatManager : public PBD::ScopedConnectionList { public: diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h index fc03eb94b0..1593990d35 100644 --- a/libs/ardour/ardour/export_format_specification.h +++ b/libs/ardour/ardour/export_format_specification.h @@ -25,6 +25,7 @@ #include "pbd/uuid.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/export_format_base.h" @@ -37,7 +38,7 @@ class ExportFormat; class ExportFormatCompatibility; class Session; -class ExportFormatSpecification : public ExportFormatBase { +class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase { private: diff --git a/libs/ardour/ardour/export_formats.h b/libs/ardour/ardour/export_formats.h index 0e9a93ff96..076bb90d3d 100644 --- a/libs/ardour/ardour/export_formats.h +++ b/libs/ardour/ardour/export_formats.h @@ -33,13 +33,13 @@ namespace ARDOUR { -class ExportFormatIncompatible : public failed_constructor { +class LIBARDOUR_API ExportFormatIncompatible : public failed_constructor { public: virtual const char *what() const throw() { return "Export format constructor failed: Format incompatible with system"; } }; /// Base class for formats -class ExportFormat : public ExportFormatBase, public ExportFormatBase::SelectableCompatible { +class LIBARDOUR_API ExportFormat : public ExportFormatBase, public ExportFormatBase::SelectableCompatible { public: ExportFormat () {}; @@ -86,7 +86,7 @@ class ExportFormat : public ExportFormatBase, public ExportFormatBase::Selectabl }; /// Class to be inherited by export formats that have a selectable sample format -class HasSampleFormat : public PBD::ScopedConnectionList { +class LIBARDOUR_API HasSampleFormat : public PBD::ScopedConnectionList { public: class SampleFormatState : public ExportFormatBase::SelectableCompatible { @@ -156,7 +156,7 @@ class HasSampleFormat : public PBD::ScopedConnectionList { ExportFormatBase::SampleFormatSet & _sample_formats; }; -class ExportFormatLinear : public ExportFormat, public HasSampleFormat { +class LIBARDOUR_API ExportFormatLinear : public ExportFormat, public HasSampleFormat { public: ExportFormatLinear (std::string name, FormatId format_id); @@ -174,7 +174,7 @@ class ExportFormatLinear : public ExportFormat, public HasSampleFormat { SampleFormat _default_sample_format; }; -class ExportFormatOggVorbis : public ExportFormat { +class LIBARDOUR_API ExportFormatOggVorbis : public ExportFormat { public: ExportFormatOggVorbis (); ~ExportFormatOggVorbis () {}; @@ -185,7 +185,7 @@ class ExportFormatOggVorbis : public ExportFormat { virtual bool supports_tagging () const { return true; } }; -class ExportFormatFLAC : public ExportFormat, public HasSampleFormat { +class LIBARDOUR_API ExportFormatFLAC : public ExportFormat, public HasSampleFormat { public: ExportFormatFLAC (); ~ExportFormatFLAC () {}; @@ -198,7 +198,7 @@ class ExportFormatFLAC : public ExportFormat, public HasSampleFormat { virtual bool supports_tagging () const { return true; } }; -class ExportFormatBWF : public ExportFormat, public HasSampleFormat { +class LIBARDOUR_API ExportFormatBWF : public ExportFormat, public HasSampleFormat { public: ExportFormatBWF (); ~ExportFormatBWF () {}; diff --git a/libs/ardour/ardour/export_formats_search_path.h b/libs/ardour/ardour/export_formats_search_path.h index 7b6fcea09b..771c6f9bd3 100644 --- a/libs/ardour/ardour/export_formats_search_path.h +++ b/libs/ardour/ardour/export_formats_search_path.h @@ -24,10 +24,10 @@ namespace ARDOUR { /** - * return a SearchPath containing directories in which to look for + * return a Searchpath containing directories in which to look for * export_formats. */ - PBD::SearchPath export_formats_search_path (); + PBD::Searchpath export_formats_search_path (); } // namespace ARDOUR diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h index 07e866475a..40960b2b38 100644 --- a/libs/ardour/ardour/export_graph_builder.h +++ b/libs/ardour/ardour/export_graph_builder.h @@ -48,7 +48,7 @@ namespace ARDOUR class ExportTimespan; class Session; -class ExportGraphBuilder +class LIBARDOUR_API ExportGraphBuilder { private: typedef ExportHandler::FileSpec FileSpec; diff --git a/libs/ardour/ardour/export_handler.h b/libs/ardour/ardour/export_handler.h index d4dd5627f7..1bc80a80e9 100644 --- a/libs/ardour/ardour/export_handler.h +++ b/libs/ardour/ardour/export_handler.h @@ -29,6 +29,7 @@ #include "ardour/export_pointers.h" #include "ardour/session.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace AudioGrapher { @@ -45,7 +46,7 @@ class ExportFilename; class ExportGraphBuilder; class Location; -class ExportElementFactory +class LIBARDOUR_API ExportElementFactory { public: @@ -67,7 +68,7 @@ class ExportElementFactory Session & session; }; -class ExportHandler : public ExportElementFactory +class LIBARDOUR_API ExportHandler : public ExportElementFactory { public: struct FileSpec { diff --git a/libs/ardour/ardour/export_pointers.h b/libs/ardour/ardour/export_pointers.h index edd7f91325..ee29f0ee4c 100644 --- a/libs/ardour/ardour/export_pointers.h +++ b/libs/ardour/ardour/export_pointers.h @@ -25,6 +25,7 @@ #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> +#include "ardour/libardour_visibility.h" #include "ardour/comparable_shared_ptr.h" namespace AudioGrapher { diff --git a/libs/ardour/ardour/export_preset.h b/libs/ardour/ardour/export_preset.h index b24cc70dcf..b11ab75bab 100644 --- a/libs/ardour/ardour/export_preset.h +++ b/libs/ardour/ardour/export_preset.h @@ -26,12 +26,14 @@ #include "pbd/uuid.h" #include "pbd/xml++.h" +#include "ardour/libardour_visibility.h" + namespace ARDOUR { class Session; -class ExportPreset { +class LIBARDOUR_API ExportPreset { public: ExportPreset (std::string filename, Session & s); ~ExportPreset (); diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index 424e0fe163..2757795ff3 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -35,6 +35,7 @@ #include "ardour/filesystem_paths.h" #include "ardour/location.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/export_handler.h" @@ -46,7 +47,7 @@ class Location; class Session; /// Manages (de)serialization of export profiles and related classes -class ExportProfileManager +class LIBARDOUR_API ExportProfileManager { public: @@ -102,7 +103,7 @@ class ExportProfileManager std::vector<std::string> find_file (std::string const & pattern); std::string export_config_dir; - PBD::SearchPath search_path; + PBD::Searchpath search_path; /* Timespans */ public: diff --git a/libs/ardour/ardour/export_status.h b/libs/ardour/ardour/export_status.h index 31027269f8..6a5be177e4 100644 --- a/libs/ardour/ardour/export_status.h +++ b/libs/ardour/ardour/export_status.h @@ -23,6 +23,7 @@ #include <stdint.h> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "pbd/signals.h" @@ -30,7 +31,7 @@ namespace ARDOUR { -class ExportStatus { +class LIBARDOUR_API ExportStatus { public: ExportStatus (); void init (); diff --git a/libs/ardour/ardour/export_timespan.h b/libs/ardour/ardour/export_timespan.h index 5cb32dbb1a..754335ba48 100644 --- a/libs/ardour/ardour/export_timespan.h +++ b/libs/ardour/ardour/export_timespan.h @@ -25,6 +25,7 @@ #include <boost/shared_ptr.hpp> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR @@ -34,7 +35,7 @@ class ExportStatus; class ExportChannel; class ExportTempFile; -class ExportTimespan +class LIBARDOUR_API ExportTimespan { private: typedef boost::shared_ptr<ExportStatus> ExportStatusPtr; diff --git a/libs/ardour/ardour/file_source.h b/libs/ardour/ardour/file_source.h index 5898d04f0a..4b1dbf2b6c 100644 --- a/libs/ardour/ardour/file_source.h +++ b/libs/ardour/ardour/file_source.h @@ -28,7 +28,7 @@ namespace ARDOUR { -class MissingSource : public std::exception +class LIBARDOUR_API MissingSource : public std::exception { public: MissingSource (const std::string& p, DataType t) throw () @@ -42,7 +42,7 @@ class MissingSource : public std::exception }; /** A source associated with a file on disk somewhere */ -class FileSource : virtual public Source { +class LIBARDOUR_API FileSource : virtual public Source { public: virtual ~FileSource () {} @@ -79,7 +79,7 @@ public: virtual void set_path (const std::string&); - static PBD::Signal3<int,std::string,std::string,std::vector<std::string> > AmbiguousFileName; + static PBD::Signal2<int,std::string,std::vector<std::string> > AmbiguousFileName; protected: FileSource (Session& session, DataType type, diff --git a/libs/ardour/ardour/filename_extensions.h b/libs/ardour/ardour/filename_extensions.h index a7c9274c4a..c0725932fa 100644 --- a/libs/ardour/ardour/filename_extensions.h +++ b/libs/ardour/ardour/filename_extensions.h @@ -21,17 +21,19 @@ #ifndef __ardour_filename_extensions_h__ #define __ardour_filename_extensions_h__ +#include "ardour/libardour_visibility.h" + namespace ARDOUR { -extern const char* const template_suffix; -extern const char* const statefile_suffix; -extern const char* const pending_suffix; -extern const char* const peakfile_suffix; -extern const char* const backup_suffix; -extern const char* const temp_suffix; -extern const char* const history_suffix; -extern const char* const export_preset_suffix; -extern const char* const export_format_suffix; + LIBARDOUR_API extern const char* const template_suffix; + LIBARDOUR_API extern const char* const statefile_suffix; + LIBARDOUR_API extern const char* const pending_suffix; + LIBARDOUR_API extern const char* const peakfile_suffix; + LIBARDOUR_API extern const char* const backup_suffix; + LIBARDOUR_API extern const char* const temp_suffix; + LIBARDOUR_API extern const char* const history_suffix; + LIBARDOUR_API extern const char* const export_preset_suffix; + LIBARDOUR_API extern const char* const export_format_suffix; } diff --git a/libs/ardour/ardour/filesystem_paths.h b/libs/ardour/ardour/filesystem_paths.h index cfeb633597..0bf25c5153 100644 --- a/libs/ardour/ardour/filesystem_paths.h +++ b/libs/ardour/ardour/filesystem_paths.h @@ -22,6 +22,8 @@ #include "pbd/search_path.h" +#include "ardour/libardour_visibility.h" + namespace ARDOUR { /** @@ -29,26 +31,26 @@ namespace ARDOUR { * configuration files. * @post user_config_directory() exists */ - std::string user_config_directory (); + LIBARDOUR_API std::string user_config_directory (); /** * @return the path to the directory that contains the system wide ardour * modules. */ - std::string ardour_dll_directory (); + LIBARDOUR_API std::string ardour_dll_directory (); /** * @return the search path to be used when looking for per-system * configuration files. This may include user configuration files. */ - PBD::SearchPath ardour_config_search_path (); + LIBARDOUR_API PBD::Searchpath ardour_config_search_path (); /** * @return the search path to be used when looking for data files * that could be shared by systems (h/w and configuration independent * files, such as icons, XML files, etc) */ - PBD::SearchPath ardour_data_search_path (); + LIBARDOUR_API PBD::Searchpath ardour_data_search_path (); } // namespace ARDOUR diff --git a/libs/ardour/ardour/filter.h b/libs/ardour/ardour/filter.h index a9cdc893a6..2b6476c49f 100644 --- a/libs/ardour/ardour/filter.h +++ b/libs/ardour/ardour/filter.h @@ -23,6 +23,7 @@ #include <vector> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { @@ -31,7 +32,7 @@ class Region; class Session; class Progress; -class Filter { +class LIBARDOUR_API Filter { public: virtual ~Filter() {} diff --git a/libs/ardour/ardour/graph.h b/libs/ardour/ardour/graph.h index 763723c792..b433580a54 100644 --- a/libs/ardour/ardour/graph.h +++ b/libs/ardour/ardour/graph.h @@ -33,6 +33,7 @@ #include "pbd/semutils.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/audio_backend.h" #include "ardour/session_handle.h" @@ -52,7 +53,7 @@ typedef boost::shared_ptr<GraphNode> node_ptr_t; typedef std::list< node_ptr_t > node_list_t; typedef std::set< node_ptr_t > node_set_t; -class Graph : public SessionHandleRef +class LIBARDOUR_API Graph : public SessionHandleRef { public: Graph (Session & session); diff --git a/libs/ardour/ardour/graphnode.h b/libs/ardour/ardour/graphnode.h index 9e0182300f..55867eac4c 100644 --- a/libs/ardour/ardour/graphnode.h +++ b/libs/ardour/ardour/graphnode.h @@ -38,7 +38,7 @@ typedef std::set< node_ptr_t > node_set_t; typedef std::list< node_ptr_t > node_list_t; /** A node on our processing graph, ie a Route */ -class GraphNode +class LIBARDOUR_API GraphNode { public: GraphNode( boost::shared_ptr<Graph> Graph ); diff --git a/libs/ardour/ardour/iec1ppmdsp.h b/libs/ardour/ardour/iec1ppmdsp.h index 0fe11681b1..b6f1501db7 100644 --- a/libs/ardour/ardour/iec1ppmdsp.h +++ b/libs/ardour/ardour/iec1ppmdsp.h @@ -20,8 +20,9 @@ #ifndef __IEC1PPMDSP_H #define __IEC1PPMDSP_H +#include "ardour/libardour_visibility.h" -class Iec1ppmdsp +class LIBARDOUR_API Iec1ppmdsp { public: diff --git a/libs/ardour/ardour/iec2ppmdsp.h b/libs/ardour/ardour/iec2ppmdsp.h index 8e26dd9e74..6a3852da1d 100644 --- a/libs/ardour/ardour/iec2ppmdsp.h +++ b/libs/ardour/ardour/iec2ppmdsp.h @@ -20,8 +20,9 @@ #ifndef __IEC2PPMDSP_H #define __IEC2PPMDSP_H +#include "ardour/libardour_visibility.h" -class Iec2ppmdsp +class LIBARDOUR_API Iec2ppmdsp { public: diff --git a/libs/ardour/ardour/import_status.h b/libs/ardour/ardour/import_status.h index c261b7a960..4dbf8f8456 100644 --- a/libs/ardour/ardour/import_status.h +++ b/libs/ardour/ardour/import_status.h @@ -26,11 +26,12 @@ #include <stdint.h> #include "ardour/interthread_info.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { -class ImportStatus : public InterThreadInfo { +class LIBARDOUR_API ImportStatus : public InterThreadInfo { public: std::string doing_what; diff --git a/libs/ardour/ardour/importable_source.h b/libs/ardour/ardour/importable_source.h index fc695d88c1..9463f0b28b 100644 --- a/libs/ardour/ardour/importable_source.h +++ b/libs/ardour/ardour/importable_source.h @@ -21,11 +21,12 @@ #define __ardour_importable_source_h__ #include "pbd/failed_constructor.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { -class ImportableSource { +class LIBARDOUR_API ImportableSource { public: ImportableSource () {} virtual ~ImportableSource() {} diff --git a/libs/ardour/ardour/instrument_info.h b/libs/ardour/ardour/instrument_info.h index 8691db24e5..745e4803c0 100644 --- a/libs/ardour/ardour/instrument_info.h +++ b/libs/ardour/ardour/instrument_info.h @@ -28,19 +28,22 @@ #include "evoral/Parameter.hpp" +#include "midi++/libmidi_visibility.h" +#include "ardour/libardour_visibility.h" + namespace MIDI { -namespace Name { -class ChannelNameSet; -class Patch; -typedef std::list<boost::shared_ptr<Patch> > PatchNameList; -} + namespace Name { + class ChannelNameSet; + class Patch; + typedef std::list<boost::shared_ptr<Patch> > PatchNameList; + } } namespace ARDOUR { class Processor; -class InstrumentInfo { +class LIBARDOUR_API InstrumentInfo { public: InstrumentInfo(); ~InstrumentInfo (); diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h index 4d2b32f031..d12b330e37 100644 --- a/libs/ardour/ardour/internal_return.h +++ b/libs/ardour/ardour/internal_return.h @@ -29,7 +29,7 @@ namespace ARDOUR { class InternalSend; -class InternalReturn : public Return +class LIBARDOUR_API InternalReturn : public Return { public: InternalReturn (Session&); diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h index 09b26d57d5..9bfbc4c659 100644 --- a/libs/ardour/ardour/internal_send.h +++ b/libs/ardour/ardour/internal_send.h @@ -25,7 +25,7 @@ namespace ARDOUR { -class InternalSend : public Send +class LIBARDOUR_API InternalSend : public Send { public: InternalSend (Session&, boost::shared_ptr<Pannable>, boost::shared_ptr<MuteMaster>, boost::shared_ptr<Route> send_to, Delivery::Role role); diff --git a/libs/ardour/ardour/interpolation.h b/libs/ardour/ardour/interpolation.h index a4a332c8a2..64b0431e0f 100644 --- a/libs/ardour/ardour/interpolation.h +++ b/libs/ardour/ardour/interpolation.h @@ -20,6 +20,7 @@ #include <math.h> #include <samplerate.h> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #ifndef __interpolation_h__ @@ -27,7 +28,7 @@ namespace ARDOUR { -class Interpolation { +class LIBARDOUR_API Interpolation { protected: double _speed; double _target_speed; @@ -57,12 +58,12 @@ public: } }; -class LinearInterpolation : public Interpolation { +class LIBARDOUR_API LinearInterpolation : public Interpolation { public: framecnt_t interpolate (int channel, framecnt_t nframes, Sample* input, Sample* output); }; -class CubicInterpolation : public Interpolation { +class LIBARDOUR_API CubicInterpolation : public Interpolation { public: framecnt_t interpolate (int channel, framecnt_t nframes, Sample* input, Sample* output); }; diff --git a/libs/ardour/ardour/interthread_info.h b/libs/ardour/ardour/interthread_info.h index 01cacf437c..49055de5d0 100644 --- a/libs/ardour/ardour/interthread_info.h +++ b/libs/ardour/ardour/interthread_info.h @@ -22,6 +22,7 @@ #include <pthread.h> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/process_thread.h" @@ -29,7 +30,7 @@ namespace ARDOUR { class InterThreadInfo { public: - InterThreadInfo () : done (false), cancel (false), progress (0), thread (0) {} + InterThreadInfo () : done (false), cancel (false), progress (0), thread () {} volatile bool done; volatile bool cancel; diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index adad0c753f..1688a2a36d 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -40,6 +40,7 @@ #include "ardour/latent.h" #include "ardour/port_set.h" #include "ardour/session_object.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/utils.h" #include "ardour/buffer_set.h" @@ -64,7 +65,7 @@ class UserBundle; * An IO can contain ports of varying types, making routes/inserts/etc with * varied combinations of types (eg MIDI and audio) possible. */ -class IO : public SessionObject, public Latent +class LIBARDOUR_API IO : public SessionObject, public Latent { public: static const std::string state_node_name; diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index 7adfab2225..a2735453a7 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -40,7 +40,7 @@ class Route; /** A mixer strip element (Processor) with 1 or 2 IO elements. */ -class IOProcessor : public Processor +class LIBARDOUR_API IOProcessor : public Processor { public: IOProcessor (Session&, bool with_input, bool with_output, diff --git a/libs/ardour/ardour/jack_utils.h b/libs/ardour/ardour/jack_utils.h new file mode 100644 index 0000000000..40eb30f9ea --- /dev/null +++ b/libs/ardour/ardour/jack_utils.h @@ -0,0 +1,253 @@ +/* + Copyright (C) 2011 Tim Mayberry + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <stdint.h> + +#include <vector> +#include <map> +#include <string> + +namespace ARDOUR { + + // Names for the drivers on all possible systems + extern const char * const portaudio_driver_name; + extern const char * const coreaudio_driver_name; + extern const char * const alsa_driver_name; + extern const char * const oss_driver_name; + extern const char * const freebob_driver_name; + extern const char * const ffado_driver_name; + extern const char * const netjack_driver_name; + extern const char * const dummy_driver_name; + + /** + * Get a list of possible JACK audio driver names based on platform + */ + void get_jack_audio_driver_names (std::vector<std::string>& driver_names); + + /** + * Get the default JACK audio driver based on platform + */ + void get_jack_default_audio_driver_name (std::string& driver_name); + + /** + * Get a list of possible JACK midi driver names based on platform + */ + void get_jack_midi_system_names (const std::string& driver, std::vector<std::string>& driver_names); + + /** + * Get the default JACK midi driver based on platform + */ + void get_jack_default_midi_system_name (const std::string& driver_name, std::string& midi_system); + + /** + * Get a list of possible samplerates supported be JACK + */ + void get_jack_sample_rate_strings (std::vector<std::string>& sample_rates); + + /** + * @return The default samplerate + */ + std::string get_jack_default_sample_rate (); + + /** + * @return true if sample rate string was able to be converted + */ + bool get_jack_sample_rate_value_from_string (const std::string& srs, uint32_t& srv); + + /** + * Get a list of possible period sizes supported be JACK + */ + void get_jack_period_size_strings (std::vector<std::string>& samplerates); + + /** + * @return The default period size + */ + std::string get_jack_default_period_size (); + + /** + * @return true if period size string was able to be converted + */ + bool get_jack_period_size_value_from_string (const std::string& pss, uint32_t& psv); + + /** + * These are driver specific I think, so it may require a driver arg + * in future + */ + void get_jack_dither_mode_strings (const std::string& driver, std::vector<std::string>& dither_modes); + + /** + * @return The default dither mode + */ + std::string get_jack_default_dither_mode (const std::string& driver); + + /** + * @return Estimate of latency + * + * API matches current use in GUI + */ + std::string get_jack_latency_string (std::string samplerate, float periods, std::string period_size); + + /** + * @return true if a JACK server is running + */ + bool jack_server_running (); + + /** + * Key being a readable name to display in a GUI + * Value being name used in a jack commandline + */ + typedef std::map<std::string, std::string> device_map_t; + + /** + * Use library specific code to find out what what devices exist for a given + * driver that might work in JACK. There is no easy way to find out what + * modules the JACK server supports so guess based on platform. For instance + * portaudio is cross-platform but we only return devices if built for + * windows etc + */ + void get_jack_alsa_device_names (device_map_t& devices); + void get_jack_portaudio_device_names (device_map_t& devices); + void get_jack_coreaudio_device_names (device_map_t& devices); + void get_jack_oss_device_names (device_map_t& devices); + void get_jack_freebob_device_names (device_map_t& devices); + void get_jack_ffado_device_names (device_map_t& devices); + void get_jack_netjack_device_names (device_map_t& devices); + void get_jack_dummy_device_names (device_map_t& devices); + + /* + * @return true if there were devices found for the driver + * + * @param driver The driver name returned by get_jack_audio_driver_names + * @param devices The map used to insert the drivers into, devices will be cleared before + * adding the available drivers + */ + bool get_jack_device_names_for_audio_driver (const std::string& driver, device_map_t& devices); + + /* + * @return a list of readable device names for a specific driver. + */ + std::vector<std::string> get_jack_device_names_for_audio_driver (const std::string& driver); + + /** + * @return true if the driver supports playback and recording + * on separate devices + */ + bool get_jack_audio_driver_supports_two_devices (const std::string& driver); + + bool get_jack_audio_driver_supports_latency_adjustment (const std::string& driver); + + bool get_jack_audio_driver_supports_setting_period_count (const std::string& driver); + + /** + * The possible names to use to try and find servers, this includes + * any file extensions like .exe on Windows + * + * @return true if the JACK application names for this platform could be guessed + */ + bool get_jack_server_application_names (std::vector<std::string>& server_names); + + /** + * Sets the PATH environment variable to contain directories likely to contain + * JACK servers so that if the JACK server is auto-started it can find the server + * executable. + * + * This is only modifies PATH on the mac at the moment. + */ + void set_path_env_for_jack_autostart (const std::vector<std::string>&); + + /** + * Get absolute paths to directories that might contain JACK servers on the system + * + * @return true if !server_paths.empty() + */ + bool get_jack_server_dir_paths (std::vector<std::string>& server_dir_paths); + + /** + * Get absolute paths to JACK servers on the system + * + * @return true if a server was found + */ + bool get_jack_server_paths (const std::vector<std::string>& server_dir_paths, + const std::vector<std::string>& server_names, + std::vector<std::string>& server_paths); + + + bool get_jack_server_paths (std::vector<std::string>& server_paths); + + /** + * Get absolute path to default JACK server + */ + bool get_jack_default_server_path (std::string& server_path); + + /** + * @return The name of the jack server config file + */ + std::string get_jack_server_config_file_name (); + + std::string get_jack_server_user_config_dir_path (); + + std::string get_jack_server_user_config_file_path (); + + bool write_jack_config_file (const std::string& config_file_path, const std::string& command_line); + + struct JackCommandLineOptions { + + // see implementation for defaults + JackCommandLineOptions (); + + //operator bool + //operator ostream + + std::string server_path; + uint32_t timeout; + bool no_mlock; + uint32_t ports_max; + bool realtime; + uint32_t priority; + bool unlock_gui_libs; + bool verbose; + bool temporary; + bool playback_only; + bool capture_only; + std::string driver; + std::string input_device; + std::string output_device; + uint32_t num_periods; + uint32_t period_size; + uint32_t samplerate; + uint32_t input_latency; + uint32_t output_latency; + bool hardware_metering; + bool hardware_monitoring; + std::string dither_mode; + bool force16_bit; + bool soft_mode; + std::string midi_driver; + }; + + /** + * @return true if able to build a valid command line based on options + */ + bool get_jack_command_line_string (const JackCommandLineOptions& options, std::string& command_line); + + /** + * We don't need this at the moment because the gui stores all its settings + */ + //std::string get_jack_command_line_from_config_file (const std::string& config_file_path); +} diff --git a/libs/ardour/ardour/kmeterdsp.h b/libs/ardour/ardour/kmeterdsp.h index 69d1215b98..7fe2b9d11b 100644 --- a/libs/ardour/ardour/kmeterdsp.h +++ b/libs/ardour/ardour/kmeterdsp.h @@ -20,7 +20,9 @@ #ifndef __KMETERDSP_H #define __KMETERDSP_H -class Kmeterdsp +#include "ardour/libardour_visibility.h" + +class LIBARDOUR_API Kmeterdsp { public: diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index 6853a1dc36..a3b99575fe 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -23,8 +23,8 @@ #include <set> #include <vector> #include <string> -#include <dlfcn.h> +#include <glibmm/module.h> #include "pbd/stateful.h" @@ -36,10 +36,10 @@ namespace ARDOUR { class AudioEngine; class Session; -class LadspaPlugin : public ARDOUR::Plugin +class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin { public: - LadspaPlugin (void *module, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, framecnt_t sample_rate); + LadspaPlugin (std::string module_path, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, framecnt_t sample_rate); LadspaPlugin (const LadspaPlugin &); ~LadspaPlugin (); @@ -122,7 +122,8 @@ class LadspaPlugin : public ARDOUR::Plugin void connect_port (uint32_t port, float *ptr) { _descriptor->connect_port (_handle, port, ptr); } private: - void* _module; + std::string _module_path; + Glib::Module* _module; const LADSPA_Descriptor* _descriptor; LADSPA_Handle _handle; framecnt_t _sample_rate; @@ -134,7 +135,7 @@ class LadspaPlugin : public ARDOUR::Plugin void find_presets (); - void init (void *mod, uint32_t index, framecnt_t rate); + void init (std::string module_path, uint32_t index, framecnt_t rate); void run_in_place (pframes_t nsamples); void latency_compute_run (); int set_state_2X (const XMLNode&, int version); @@ -146,7 +147,7 @@ class LadspaPlugin : public ARDOUR::Plugin void add_state (XMLNode *) const; }; -class LadspaPluginInfo : public PluginInfo { +class LIBARDOUR_API LadspaPluginInfo : public PluginInfo { public: LadspaPluginInfo (); ~LadspaPluginInfo () { }; diff --git a/libs/ardour/ardour/ladspa_search_path.h b/libs/ardour/ardour/ladspa_search_path.h new file mode 100644 index 0000000000..bc184b5248 --- /dev/null +++ b/libs/ardour/ardour/ladspa_search_path.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2011 Tim Mayberry + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef ARDOUR_LADSPA_SEARCH_PATH_INCLUDED +#define ARDOUR_LADSPA_SEARCH_PATH_INCLUDED + +#include "pbd/search_path.h" + +namespace ARDOUR { + + /** + * return a Searchpath containing directories in which to look for + * LADSPA plugins. + * + * If LADSPA_PATH is defined then the Searchpath returned + * will contain the directories specified in it as well as the + * user and system directories. + */ + PBD::Searchpath ladspa_search_path (); + +} // namespace ARDOUR + +#endif diff --git a/libs/ardour/ardour/latent.h b/libs/ardour/ardour/latent.h index c6e81c17a2..bd639a8651 100644 --- a/libs/ardour/ardour/latent.h +++ b/libs/ardour/ardour/latent.h @@ -20,11 +20,12 @@ #ifndef __ardour_latent_h__ #define __ardour_latent_h__ +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { -class Latent { +class LIBARDOUR_API Latent { public: Latent() : _user_latency (0) {} virtual ~Latent() {} diff --git a/libs/ardour/ardour/libardour_visibility.h b/libs/ardour/ardour/libardour_visibility.h new file mode 100644 index 0000000000..917307732c --- /dev/null +++ b/libs/ardour/ardour/libardour_visibility.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2013 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __libardour_libardour_visibility_h__ +#define __libardour_libardour_visibility_h__ + +#if defined(COMPILER_MSVC) + #define LIBARDOUR_DLL_IMPORT __declspec(dllimport) + #define LIBARDOUR_DLL_EXPORT __declspec(dllexport) + #define LIBARDOUR_DLL_LOCAL +#else + #define LIBARDOUR_DLL_IMPORT __attribute__ ((visibility ("default"))) + #define LIBARDOUR_DLL_EXPORT __attribute__ ((visibility ("default"))) + #define LIBARDOUR_DLL_LOCAL __attribute__ ((visibility ("hidden"))) +#endif + +#ifdef LIBARDOUR_STATIC // libardour is not a DLL +#define LIBARDOUR_API +#define LIBARDOUR_LOCAL +#else + #ifdef LIBARDOUR_DLL_EXPORTS // defined if we are building the libardour DLL (instead of using it) + #define LIBARDOUR_API LIBARDOUR_DLL_EXPORT + #else + #define LIBARDOUR_API LIBARDOUR_DLL_IMPORT + #endif + #define LIBARDOUR_LOCAL LIBARDOUR_DLL_LOCAL +#endif + +#endif /* __libardour_libardour_visibility_h__ */ diff --git a/libs/ardour/ardour/linux_vst_support.h b/libs/ardour/ardour/linux_vst_support.h index c99c4a8cb3..cb18a0b1d4 100644 --- a/libs/ardour/ardour/linux_vst_support.h +++ b/libs/ardour/ardour/linux_vst_support.h @@ -25,44 +25,46 @@ #include <pthread.h> #include <stdio.h> +#include "ardour/libardour_visibility.h" #include "ardour/vst_types.h" /******************************************************************************************/ /*VSTFX - an engine to manage native linux VST plugins - derived from FST for Windows VSTs*/ /******************************************************************************************/ -extern void (*vstfx_error_callback)(const char *msg); +LIBARDOUR_API extern void (*vstfx_error_callback)(const char *msg); -void vstfx_set_error_function (void (*func)(const char *)); +LIBARDOUR_API void vstfx_set_error_function (void (*func)(const char *)); -void vstfx_error (const char *fmt, ...); +LIBARDOUR_API void vstfx_error (const char *fmt, ...); /*API to vstfx*/ -extern int vstfx_launch_editor (VSTState *); -extern int vstfx_init (void *); -extern void vstfx_exit (); -extern VSTHandle * vstfx_load (const char*); -extern int vstfx_unload (VSTHandle *); -extern VSTState * vstfx_instantiate (VSTHandle *, audioMasterCallback, void *); -extern void vstfx_close (VSTState*); +LIBARDOUR_API extern int vstfx_launch_editor (VSTState *); +LIBARDOUR_API extern int vstfx_init (void *); +LIBARDOUR_API extern void vstfx_exit (); +LIBARDOUR_API extern VSTHandle * vstfx_load (const char*); +LIBARDOUR_API extern int vstfx_unload (VSTHandle *); -extern int vstfx_create_editor (VSTState *); -extern int vstfx_run_editor (VSTState *); -extern void vstfx_destroy_editor (VSTState *); +LIBARDOUR_API extern VSTState * vstfx_instantiate (VSTHandle *, audioMasterCallback, void *); +LIBARDOUR_API extern void vstfx_close (VSTState*); -extern VSTInfo * vstfx_get_info (char *); -extern void vstfx_free_info (VSTInfo *); -extern void vstfx_event_loop_remove_plugin (VSTState *); -extern int vstfx_call_dispatcher (VSTState *, int, int, int, void *, float); +LIBARDOUR_API extern int vstfx_create_editor (VSTState *); +LIBARDOUR_API extern int vstfx_run_editor (VSTState *); +LIBARDOUR_API extern void vstfx_destroy_editor (VSTState *); + +LIBARDOUR_API extern VSTInfo * vstfx_get_info (char *); +LIBARDOUR_API extern void vstfx_free_info (VSTInfo *); +LIBARDOUR_API extern void vstfx_event_loop_remove_plugin (VSTState *); +LIBARDOUR_API extern int vstfx_call_dispatcher (VSTState *, int, int, int, void *, float); /** Load a plugin state from a file.**/ -extern int vstfx_load_state (VSTState* vstfx, char * filename); +LIBARDOUR_API extern int vstfx_load_state (VSTState* vstfx, char * filename); /** Save a plugin state to a file.**/ -extern bool vstfx_save_state (VSTState* vstfx, char * filename); +LIBARDOUR_API extern bool vstfx_save_state (VSTState* vstfx, char * filename); #endif /* __vstfx_h__ */ diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index bb42df1b58..b0956eea36 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -38,7 +38,7 @@ namespace ARDOUR { -class Location : public SessionHandleRef, public PBD::StatefulDestructible +class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDestructible { public: enum Flags { @@ -131,7 +131,7 @@ class Location : public SessionHandleRef, public PBD::StatefulDestructible void recompute_bbt_from_frames (); }; -class Locations : public SessionHandleRef, public PBD::StatefulDestructible +class LIBARDOUR_API Locations : public SessionHandleRef, public PBD::StatefulDestructible { public: typedef std::list<Location *> LocationList; diff --git a/libs/ardour/ardour/location_importer.h b/libs/ardour/ardour/location_importer.h index 332c5ae685..574b948062 100644 --- a/libs/ardour/ardour/location_importer.h +++ b/libs/ardour/ardour/location_importer.h @@ -33,14 +33,14 @@ namespace ARDOUR { class Location; class Session; -class LocationImportHandler : public ElementImportHandler +class LIBARDOUR_API LocationImportHandler : public ElementImportHandler { public: LocationImportHandler (XMLTree const & source, Session & session); std::string get_info () const; }; -class LocationImporter : public ElementImporter +class LIBARDOUR_API LocationImporter : public ElementImporter { public: LocationImporter (XMLTree const & source, Session & session, LocationImportHandler & handler, XMLNode const & node); diff --git a/libs/ardour/ardour/logcurve.h b/libs/ardour/ardour/logcurve.h index 4c91ad9a79..2585da66c8 100644 --- a/libs/ardour/ardour/logcurve.h +++ b/libs/ardour/ardour/logcurve.h @@ -25,7 +25,7 @@ namespace ARDOUR { -class LogCurve { +class LIBARDOUR_API LogCurve { public: LogCurve (float steepness = 0.2, uint32_t len = 0) { l = len; @@ -102,7 +102,7 @@ class LogCurve { uint32_t l; }; -class LogCurveIn : public LogCurve +class LIBARDOUR_API LogCurveIn : public LogCurve { public: LogCurveIn (float steepness = 0.2, uint32_t len = 0) @@ -117,7 +117,7 @@ class LogCurveIn : public LogCurve } }; -class LogCurveOut : public LogCurve +class LIBARDOUR_API LogCurveOut : public LogCurve { public: LogCurveOut (float steepness = 0.2, uint32_t len = 0) diff --git a/libs/ardour/ardour/lv2_bundled_search_path.h b/libs/ardour/ardour/lv2_bundled_search_path.h index f5780c5e0e..9314ee27d4 100644 --- a/libs/ardour/ardour/lv2_bundled_search_path.h +++ b/libs/ardour/ardour/lv2_bundled_search_path.h @@ -25,10 +25,10 @@ namespace ARDOUR { /** - * return a SearchPath containing directories in which to look for + * return a Searchpath containing directories in which to look for * lv2 plugins. */ - PBD::SearchPath lv2_bundled_search_path (); + PBD::Searchpath lv2_bundled_search_path (); } // namespace ARDOUR diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index 56aa9dc7cf..034101ee41 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -29,6 +29,8 @@ #include "ardour/worker.h" #include "pbd/ringbuffer.h" +typedef struct LV2_Evbuf_Impl LV2_Evbuf; + namespace ARDOUR { // a callback function for lilv_state_new_from_instance(). friend of LV2Plugin @@ -41,7 +43,7 @@ const void* lv2plugin_get_port_value(const char* port_symbol, class AudioEngine; class Session; -class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee +class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee { public: LV2Plugin (ARDOUR::AudioEngine& engine, @@ -270,7 +272,7 @@ class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee }; -class LV2PluginInfo : public PluginInfo { +class LIBARDOUR_API LV2PluginInfo : public PluginInfo { public: LV2PluginInfo (const void* c_plugin); ~LV2PluginInfo (); diff --git a/libs/ardour/ardour/lxvst_plugin.h b/libs/ardour/ardour/lxvst_plugin.h index 58bc626d32..f1a50b2f30 100644 --- a/libs/ardour/ardour/lxvst_plugin.h +++ b/libs/ardour/ardour/lxvst_plugin.h @@ -30,7 +30,7 @@ namespace ARDOUR { class AudioEngine; class Session; -class LXVSTPlugin : public VSTPlugin +class LIBARDOUR_API LXVSTPlugin : public VSTPlugin { public: LXVSTPlugin (AudioEngine &, Session &, VSTHandle *); @@ -40,7 +40,7 @@ class LXVSTPlugin : public VSTPlugin std::string state_node_name () const { return "lxvst"; } }; -class LXVSTPluginInfo : public PluginInfo +class LIBARDOUR_API LXVSTPluginInfo : public PluginInfo { public: LXVSTPluginInfo (); diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h index df1e381bb4..8ed1ade50d 100644 --- a/libs/ardour/ardour/meter.h +++ b/libs/ardour/ardour/meter.h @@ -20,6 +20,7 @@ #define __ardour_meter_h__ #include <vector> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/processor.h" #include "pbd/fastlog.h" @@ -35,7 +36,7 @@ class BufferSet; class ChanCount; class Session; -class Metering { +class LIBARDOUR_API Metering { public: static void update_meters (); static PBD::Signal0<void> Meter; @@ -47,7 +48,7 @@ class Metering { /** Meters peaks on the input and stores them for access. */ -class PeakMeter : public Processor { +class LIBARDOUR_API PeakMeter : public Processor { public: PeakMeter(Session& s, const std::string& name); ~PeakMeter(); diff --git a/libs/ardour/ardour/midi_automation_list_binder.h b/libs/ardour/ardour/midi_automation_list_binder.h index 89c6cdb90b..241c4e7320 100644 --- a/libs/ardour/ardour/midi_automation_list_binder.h +++ b/libs/ardour/ardour/midi_automation_list_binder.h @@ -27,7 +27,7 @@ class MidiSource; class AutomationList; /** A class for late-binding a MidiSource and a Parameter to an AutomationList */ -class MidiAutomationListBinder : public MementoCommandBinder<ARDOUR::AutomationList> +class LIBARDOUR_API MidiAutomationListBinder : public MementoCommandBinder<ARDOUR::AutomationList> { public: MidiAutomationListBinder (boost::shared_ptr<ARDOUR::MidiSource>, Evoral::Parameter); diff --git a/libs/ardour/ardour/midi_buffer.h b/libs/ardour/ardour/midi_buffer.h index 781396a598..0a799c41ab 100644 --- a/libs/ardour/ardour/midi_buffer.h +++ b/libs/ardour/ardour/midi_buffer.h @@ -29,7 +29,7 @@ namespace ARDOUR { /** Buffer containing 8-bit unsigned char (MIDI) data. */ -class MidiBuffer : public Buffer +class LIBARDOUR_API MidiBuffer : public Buffer { public: typedef framepos_t TimeType; diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index b1c126b339..e3f2673871 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -52,7 +52,7 @@ class SMFSource; class Send; class Session; -class MidiDiskstream : public Diskstream +class LIBARDOUR_API MidiDiskstream : public Diskstream { public: MidiDiskstream (Session &, const string& name, Diskstream::Flag f = Recordable); diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 3ecfca7d1c..dc1c7af0e9 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -27,10 +27,12 @@ #include <boost/utility.hpp> #include <glibmm/threads.h> #include "pbd/command.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/midi_buffer.h" #include "ardour/midi_ring_buffer.h" #include "ardour/automatable_sequence.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "evoral/Note.hpp" #include "evoral/Sequence.hpp" @@ -47,7 +49,7 @@ class MidiSource; * Because of this MIDI controllers and automatable controllers/widgets/etc * are easily interchangeable. */ -class MidiModel : public AutomatableSequence<Evoral::MusicalTime> { +class LIBARDOUR_API MidiModel : public AutomatableSequence<Evoral::MusicalTime> { public: typedef Evoral::MusicalTime TimeType; @@ -56,7 +58,7 @@ public: NoteMode note_mode() const { return (percussive() ? Percussive : Sustained); } void set_note_mode(NoteMode mode) { set_percussive(mode == Percussive); }; - class DiffCommand : public Command { + class LIBARDOUR_API DiffCommand : public Command { public: DiffCommand (boost::shared_ptr<MidiModel> m, const std::string& name); @@ -77,7 +79,7 @@ public: }; - class NoteDiffCommand : public DiffCommand { + class LIBARDOUR_API NoteDiffCommand : public DiffCommand { public: NoteDiffCommand (boost::shared_ptr<MidiModel> m, const std::string& name) : DiffCommand (m, name) {} @@ -143,7 +145,7 @@ public: }; /* Currently this class only supports changes of sys-ex time, but could be expanded */ - class SysExDiffCommand : public DiffCommand { + class LIBARDOUR_API SysExDiffCommand : public DiffCommand { public: SysExDiffCommand (boost::shared_ptr<MidiModel> m, const XMLNode& node); @@ -178,7 +180,7 @@ public: Change unmarshal_change (XMLNode *); }; - class PatchChangeDiffCommand : public DiffCommand { + class LIBARDOUR_API PatchChangeDiffCommand : public DiffCommand { public: PatchChangeDiffCommand (boost::shared_ptr<MidiModel>, const std::string &); PatchChangeDiffCommand (boost::shared_ptr<MidiModel>, const XMLNode &); @@ -220,6 +222,8 @@ public: uint8_t new_program; int new_bank; }; + + Change() : patch_id (-1) {} }; typedef std::list<Change> ChangeList; diff --git a/libs/ardour/ardour/midi_operator.h b/libs/ardour/ardour/midi_operator.h index c5def76384..00678a2831 100644 --- a/libs/ardour/ardour/midi_operator.h +++ b/libs/ardour/ardour/midi_operator.h @@ -32,7 +32,7 @@ namespace ARDOUR { class MidiModel; -class MidiOperator { +class LIBARDOUR_API MidiOperator { public: MidiOperator () {} virtual ~MidiOperator() {} diff --git a/libs/ardour/ardour/midi_patch_manager.h b/libs/ardour/ardour/midi_patch_manager.h index 77e63a2791..cd898aa00f 100644 --- a/libs/ardour/ardour/midi_patch_manager.h +++ b/libs/ardour/ardour/midi_patch_manager.h @@ -35,7 +35,7 @@ namespace MIDI namespace Name { -class MidiPatchManager : public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr +class LIBARDOUR_API MidiPatchManager : public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr { /// Singleton private: diff --git a/libs/ardour/ardour/midi_patch_search_path.h b/libs/ardour/ardour/midi_patch_search_path.h index 5d27823461..168e75af4a 100644 --- a/libs/ardour/ardour/midi_patch_search_path.h +++ b/libs/ardour/ardour/midi_patch_search_path.h @@ -24,15 +24,15 @@ namespace ARDOUR { /** - * return a SearchPath containing directories in which to look for + * return a Searchpath containing directories in which to look for * MIDI patch files ("*.midnam") aka MIDNAM files * - * If ARDOUR_MIDI_PATCH_PATH is defined then the SearchPath returned + * If ARDOUR_MIDI_PATCH_PATH is defined then the Searchpath returned * will contain only those directories specified in it, otherwise it will * contain the user and system directories which may contain control * surface plugins. */ - PBD::SearchPath midi_patch_search_path (); + PBD::Searchpath midi_patch_search_path (); } // namespace ARDOUR diff --git a/libs/ardour/ardour/midi_playlist.h b/libs/ardour/ardour/midi_playlist.h index 543e1b353f..b118214c9e 100644 --- a/libs/ardour/ardour/midi_playlist.h +++ b/libs/ardour/ardour/midi_playlist.h @@ -32,12 +32,11 @@ namespace ARDOUR { class Session; -class Region; class MidiRegion; class Source; template<typename T> class MidiRingBuffer; -class MidiPlaylist : public ARDOUR::Playlist +class LIBARDOUR_API MidiPlaylist : public ARDOUR::Playlist { public: MidiPlaylist (Session&, const XMLNode&, bool hidden = false); diff --git a/libs/ardour/ardour/midi_playlist_source.h b/libs/ardour/ardour/midi_playlist_source.h index 5e3bb0de67..7a61f5aa02 100644 --- a/libs/ardour/ardour/midi_playlist_source.h +++ b/libs/ardour/ardour/midi_playlist_source.h @@ -32,7 +32,7 @@ namespace ARDOUR { class MidiPlaylist; -class MidiPlaylistSource : public MidiSource, public PlaylistSource { +class LIBARDOUR_API MidiPlaylistSource : public MidiSource, public PlaylistSource { public: virtual ~MidiPlaylistSource (); diff --git a/libs/ardour/ardour/midi_port.h b/libs/ardour/ardour/midi_port.h index 00617d90ec..cc9fee1b15 100644 --- a/libs/ardour/ardour/midi_port.h +++ b/libs/ardour/ardour/midi_port.h @@ -31,7 +31,7 @@ namespace ARDOUR { class MidiEngine; -class MidiPort : public Port { +class LIBARDOUR_API MidiPort : public Port { public: ~MidiPort(); diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index daca7a243d..b326bb30d8 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -34,9 +34,9 @@ namespace ARDOUR { property, but it allows us to signal changes to the MidiModel used by the MidiRegion */ - extern PBD::PropertyDescriptor<void*> midi_data; - extern PBD::PropertyDescriptor<Evoral::MusicalTime> start_beats; - extern PBD::PropertyDescriptor<Evoral::MusicalTime> length_beats; + LIBARDOUR_API extern PBD::PropertyDescriptor<void*> midi_data; + LIBARDOUR_API extern PBD::PropertyDescriptor<Evoral::MusicalTime> start_beats; + LIBARDOUR_API extern PBD::PropertyDescriptor<Evoral::MusicalTime> length_beats; } } @@ -53,9 +53,10 @@ class MidiFilter; class MidiModel; class MidiSource; class MidiStateTracker; + template<typename T> class MidiRingBuffer; -class MidiRegion : public Region +class LIBARDOUR_API MidiRegion : public Region { public: static void make_property_quarks (); diff --git a/libs/ardour/ardour/midi_ring_buffer.h b/libs/ardour/ardour/midi_ring_buffer.h index d5c9947b9a..78d14b9185 100644 --- a/libs/ardour/ardour/midi_ring_buffer.h +++ b/libs/ardour/ardour/midi_ring_buffer.h @@ -24,6 +24,7 @@ #include "evoral/EventRingBuffer.hpp" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/midi_state_tracker.h" @@ -40,7 +41,7 @@ class MidiBuffer; * [timestamp][type][size][size bytes of raw MIDI][timestamp][type][size](etc...) */ template<typename T> -class MidiRingBuffer : public Evoral::EventRingBuffer<T> { +class /*LIBARDOUR_API*/ MidiRingBuffer : public Evoral::EventRingBuffer<T> { public: /** @param size Size in bytes. */ diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index a5aac8859b..ba50102ec9 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -36,10 +36,11 @@ namespace ARDOUR { class MidiStateTracker; class MidiModel; + template<typename T> class MidiRingBuffer; /** Source for MIDI data */ -class MidiSource : virtual public Source, public boost::enable_shared_from_this<MidiSource> +class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_shared_from_this<MidiSource> { public: typedef double TimeType; diff --git a/libs/ardour/ardour/midi_state_tracker.h b/libs/ardour/ardour/midi_state_tracker.h index 24d3ab73a1..046e77f38c 100644 --- a/libs/ardour/ardour/midi_state_tracker.h +++ b/libs/ardour/ardour/midi_state_tracker.h @@ -27,12 +27,13 @@ template <typename T> class EventSink; } namespace ARDOUR { + class MidiSource; /** Tracks played notes, so they can be resolved in potential stuck note * situations (e.g. looping, transport stop, etc). */ -class MidiStateTracker +class LIBARDOUR_API MidiStateTracker { public: MidiStateTracker(); diff --git a/libs/ardour/ardour/midi_stretch.h b/libs/ardour/ardour/midi_stretch.h index 42b201b55a..b6f6ac5073 100644 --- a/libs/ardour/ardour/midi_stretch.h +++ b/libs/ardour/ardour/midi_stretch.h @@ -25,7 +25,7 @@ namespace ARDOUR { -class MidiStretch : public Filter { +class LIBARDOUR_API MidiStretch : public Filter { public: MidiStretch (ARDOUR::Session&, const TimeFXRequest&); ~MidiStretch (); diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index 3b75c0a51b..cf6d3f7b64 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -20,6 +20,8 @@ #ifndef __ardour_midi_track_h__ #define __ardour_midi_track_h__ +#include "pbd/ffs.h" + #include "ardour/track.h" #include "ardour/midi_ring_buffer.h" @@ -33,7 +35,7 @@ class RouteGroup; class SMFSource; class Session; -class MidiTrack : public Track +class LIBARDOUR_API MidiTrack : public Track { public: MidiTrack (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal); @@ -183,7 +185,7 @@ private: /* if mode is ForceChannel, force mask to the lowest set channel or 1 if no * channels are set. */ -#define force_mask(mode,mask) (((mode) == ForceChannel) ? (((mask) ? (1<<(ffs((mask))-1)) : 1)) : mask) +#define force_mask(mode,mask) (((mode) == ForceChannel) ? (((mask) ? (1<<(PBD::ffs((mask))-1)) : 1)) : mask) void _set_playback_channel_mode(ChannelMode mode, uint16_t mask) { mask = force_mask (mode, mask); diff --git a/libs/ardour/ardour/midi_ui.h b/libs/ardour/ardour/midi_ui.h index 9e46f226f7..85a8a15e21 100644 --- a/libs/ardour/ardour/midi_ui.h +++ b/libs/ardour/ardour/midi_ui.h @@ -22,6 +22,7 @@ #include <list> +#define ABSTRACT_UI_EXPORTS #include "pbd/abstract_ui.h" #include "pbd/signals.h" #include "pbd/stacktrace.h" @@ -37,13 +38,13 @@ class AsyncMIDIPort; certain types of requests to the MIDI UI */ -struct MidiUIRequest : public BaseUI::BaseRequestObject { +struct LIBARDOUR_API MidiUIRequest : public BaseUI::BaseRequestObject { public: MidiUIRequest () { } ~MidiUIRequest() { } }; -class MidiControlUI : public AbstractUI<MidiUIRequest> +class LIBARDOUR_API MidiControlUI : public AbstractUI<MidiUIRequest> { public: MidiControlUI (Session& s); diff --git a/libs/ardour/ardour/midiport_manager.h b/libs/ardour/ardour/midiport_manager.h index 9f93c43d5a..b5b46e8510 100644 --- a/libs/ardour/ardour/midiport_manager.h +++ b/libs/ardour/ardour/midiport_manager.h @@ -29,6 +29,7 @@ #include "midi++/types.h" #include "midi++/port.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { @@ -36,7 +37,7 @@ namespace ARDOUR { class MidiPort; class Port; -class MidiPortManager { +class LIBARDOUR_API MidiPortManager { public: MidiPortManager(); virtual ~MidiPortManager (); diff --git a/libs/ardour/ardour/mix.h b/libs/ardour/ardour/mix.h index 1c3fb6e5c4..3cd9a3e60f 100644 --- a/libs/ardour/ardour/mix.h +++ b/libs/ardour/ardour/mix.h @@ -19,6 +19,7 @@ #ifndef __ardour_mix_h__ #define __ardour_mix_h__ +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/utils.h" @@ -26,39 +27,39 @@ extern "C" { /* SSE functions */ -float x86_sse_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current); -void x86_sse_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); -void x86_sse_mix_buffers_with_gain(ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); -void x86_sse_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); + LIBARDOUR_API float x86_sse_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current); + LIBARDOUR_API void x86_sse_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); + LIBARDOUR_API void x86_sse_mix_buffers_with_gain(ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); + LIBARDOUR_API void x86_sse_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); } -void x86_sse_find_peaks (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float *min, float *max); +LIBARDOUR_API void x86_sse_find_peaks (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float *min, float *max); /* debug wrappers for SSE functions */ -float debug_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current); -void debug_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); -void debug_mix_buffers_with_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); -void debug_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); +LIBARDOUR_API float debug_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current); +LIBARDOUR_API void debug_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); +LIBARDOUR_API void debug_mix_buffers_with_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); +LIBARDOUR_API void debug_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); #endif #if defined (__APPLE__) -float veclib_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current); -void veclib_find_peaks (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float *min, float *max); -void veclib_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); -void veclib_mix_buffers_with_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); -void veclib_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); +LIBARDOUR_API float veclib_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current); +LIBARDOUR_API void veclib_find_peaks (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float *min, float *max); +LIBARDOUR_API void veclib_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); +LIBARDOUR_API void veclib_mix_buffers_with_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); +LIBARDOUR_API void veclib_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); #endif /* non-optimized functions */ -float default_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current); -void default_find_peaks (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float *min, float *max); -void default_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); -void default_mix_buffers_with_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); -void default_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); +LIBARDOUR_API float default_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current); +LIBARDOUR_API void default_find_peaks (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float *min, float *max); +LIBARDOUR_API void default_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); +LIBARDOUR_API void default_mix_buffers_with_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); +LIBARDOUR_API void default_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); #endif /* __ardour_mix_h__ */ diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h index 64d3b86bfb..33b3e9c366 100644 --- a/libs/ardour/ardour/monitor_processor.h +++ b/libs/ardour/ardour/monitor_processor.h @@ -28,6 +28,7 @@ #include "pbd/compose.h" #include "pbd/controllable.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/processor.h" @@ -38,7 +39,7 @@ namespace ARDOUR { class Session; template<typename T> -class MPControl : public PBD::Controllable { +class /*LIBARDOUR_API*/ MPControl : public PBD::Controllable { public: MPControl (T initial, const std::string& name, PBD::Controllable::Flag flag, float lower = 0.0f, float upper = 1.0f) @@ -104,7 +105,7 @@ protected: T _upper; }; -class MonitorProcessor : public Processor +class LIBARDOUR_API MonitorProcessor : public Processor { public: MonitorProcessor (Session&); diff --git a/libs/ardour/ardour/movable.h b/libs/ardour/ardour/movable.h index d68d7620ba..df63987f4f 100644 --- a/libs/ardour/ardour/movable.h +++ b/libs/ardour/ardour/movable.h @@ -22,7 +22,7 @@ namespace ARDOUR { -class Movable { +class LIBARDOUR_API Movable { public: Movable() {} diff --git a/libs/ardour/ardour/msvc_libardour.h b/libs/ardour/ardour/msvc_libardour.h new file mode 100644 index 0000000000..f8edcdd3cb --- /dev/null +++ b/libs/ardour/ardour/msvc_libardour.h @@ -0,0 +1,73 @@ +/* + Copyright (C) 2009 John Emmas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ +#ifndef __msvc_libardour_h__ +#define __msvc_libardour_h__ + +#include <ardour/libardour_visibility.h> +#include <limits.h> + +#ifndef _MAX_PATH +#define _MAX_PATH 260 +#endif +#ifndef PATH_MAX +#define PATH_MAX _MAX_PATH +#endif + +#define LIBARDOUR_APICALLTYPE __cdecl + +namespace ARDOUR { + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +// LIBARDOUR_API char* LIBARDOUR_APICALLTYPE placeholder_for_non_msvc_specific_function(s); + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +} // namespace ARDOUR + +#ifdef COMPILER_MSVC +#include <rpc.h> +//#include <io.h> + +#ifndef __THROW +#define __THROW throw() +#endif +#include <ardourext/sys/time.h> + +namespace ARDOUR { + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +LIBARDOUR_API int LIBARDOUR_APICALLTYPE symlink(const char *dest, const char *shortcut, const char *working_directory = 0); +LIBARDOUR_API int LIBARDOUR_APICALLTYPE readlink(const char *__restrict shortcut, char *__restrict buf, size_t bufsize); + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +} // namespace ARDOUR + +#endif // COMPILER_MSVC +#endif // __mavc_libardour_h__ diff --git a/libs/ardour/ardour/mtdm.h b/libs/ardour/ardour/mtdm.h index b46e53c0a2..b57df7254a 100644 --- a/libs/ardour/ardour/mtdm.h +++ b/libs/ardour/ardour/mtdm.h @@ -21,7 +21,9 @@ #include <stddef.h> -class MTDM +#include "ardour/libardour_visibility.h" + +class LIBARDOUR_API MTDM { public: diff --git a/libs/ardour/ardour/mute_master.h b/libs/ardour/ardour/mute_master.h index 460c7bf48b..8a83352a5b 100644 --- a/libs/ardour/ardour/mute_master.h +++ b/libs/ardour/ardour/mute_master.h @@ -31,7 +31,7 @@ namespace ARDOUR { class Session; -class MuteMaster : public SessionHandleRef, public PBD::Stateful +class LIBARDOUR_API MuteMaster : public SessionHandleRef, public PBD::Stateful { public: /** deliveries to mute when the channel is "muted" */ diff --git a/libs/ardour/ardour/onset_detector.h b/libs/ardour/ardour/onset_detector.h index 6604a3a362..40eac9b465 100644 --- a/libs/ardour/ardour/onset_detector.h +++ b/libs/ardour/ardour/onset_detector.h @@ -27,7 +27,7 @@ namespace ARDOUR { class AudioSource; class Session; -class OnsetDetector : public AudioAnalyser +class LIBARDOUR_API OnsetDetector : public AudioAnalyser { public: OnsetDetector (float sample_rate); diff --git a/libs/ardour/ardour/operations.h b/libs/ardour/ardour/operations.h index dd6329d7b9..d113c621c2 100644 --- a/libs/ardour/ardour/operations.h +++ b/libs/ardour/ardour/operations.h @@ -17,6 +17,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "ardour/libardour_visibility.h" + /** These are GQuarks for a subset of UI operations. We use these * so that the undo system can be queried to find out what operations * are currently in progress, by calling Session::current_operations(). @@ -27,19 +29,19 @@ namespace Operations { - extern GQuark capture; - extern GQuark paste; - extern GQuark duplicate_region; - extern GQuark insert_file; - extern GQuark insert_region; - extern GQuark drag_region_brush; - extern GQuark region_drag; - extern GQuark selection_grab; - extern GQuark region_fill; - extern GQuark fill_selection; - extern GQuark create_region; - extern GQuark region_copy; - extern GQuark fixed_time_region_copy; + LIBARDOUR_API extern GQuark capture; + LIBARDOUR_API extern GQuark paste; + LIBARDOUR_API extern GQuark duplicate_region; + LIBARDOUR_API extern GQuark insert_file; + LIBARDOUR_API extern GQuark insert_region; + LIBARDOUR_API extern GQuark drag_region_brush; + LIBARDOUR_API extern GQuark region_drag; + LIBARDOUR_API extern GQuark selection_grab; + LIBARDOUR_API extern GQuark region_fill; + LIBARDOUR_API extern GQuark fill_selection; + LIBARDOUR_API extern GQuark create_region; + LIBARDOUR_API extern GQuark region_copy; + LIBARDOUR_API extern GQuark fixed_time_region_copy; }; diff --git a/libs/ardour/ardour/pan_controllable.h b/libs/ardour/ardour/pan_controllable.h index be0c9260c0..9abbec42ab 100644 --- a/libs/ardour/ardour/pan_controllable.h +++ b/libs/ardour/ardour/pan_controllable.h @@ -34,7 +34,7 @@ namespace ARDOUR { class Session; class Pannable; -class PanControllable : public AutomationControl +class LIBARDOUR_API PanControllable : public AutomationControl { public: PanControllable (Session& s, std::string name, Pannable* o, Evoral::Parameter param) diff --git a/libs/ardour/ardour/pannable.h b/libs/ardour/ardour/pannable.h index 0d5200b685..62c9cd123b 100644 --- a/libs/ardour/ardour/pannable.h +++ b/libs/ardour/ardour/pannable.h @@ -36,7 +36,7 @@ class Session; class AutomationControl; class Panner; -class Pannable : public PBD::Stateful, public Automatable, public SessionHandleRef +class LIBARDOUR_API Pannable : public PBD::Stateful, public Automatable, public SessionHandleRef { public: Pannable (Session& s); diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 18e3e8045a..211ad0ca8e 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -30,10 +30,23 @@ #include "pbd/signals.h" #include "pbd/stateful.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/automation_control.h" #include "ardour/automatable.h" + +/* This section is for actual panners to use. They will include this file, + * declare ARDOURPANNER_DLL_EXPORTS during compilation, and ... voila. + */ + +#ifdef ARDOURPANNER_DLL_EXPORTS // defined if we are building a panner implementation + #define ARDOURPANNER_API LIBARDOUR_DLL_EXPORT + #else + #define ARDOURPANNER_API LIBARDOUR_DLL_IMPORT + #endif +#define ARDOURPANNER_LOCAL LIBARDOUR_DLL_LOCAL + namespace ARDOUR { class Session; @@ -42,7 +55,7 @@ class BufferSet; class AudioBuffer; class Speakers; -class Panner : public PBD::Stateful, public PBD::ScopedConnectionList +class LIBARDOUR_API Panner : public PBD::Stateful, public PBD::ScopedConnectionList { public: Panner (boost::shared_ptr<Pannable>); @@ -175,7 +188,7 @@ protected: } // namespace extern "C" { -struct PanPluginDescriptor { +struct LIBARDOUR_API PanPluginDescriptor { std::string name; std::string panner_uri; std::string gui_uri; diff --git a/libs/ardour/ardour/panner_manager.h b/libs/ardour/ardour/panner_manager.h index 4a29e1c36b..73d667424f 100644 --- a/libs/ardour/ardour/panner_manager.h +++ b/libs/ardour/ardour/panner_manager.h @@ -20,7 +20,10 @@ #ifndef __ardour_panner_manager_h__ #define __ardour_panner_manager_h__ -#include <dlfcn.h> +#include <map> +#include <string> +#include <glibmm/module.h> + #include "ardour/panner.h" #include "ardour/session_handle.h" @@ -28,21 +31,22 @@ namespace ARDOUR { typedef std::map<std::string,std::string> PannerUriMap; -struct PannerInfo { +struct LIBARDOUR_API PannerInfo { + PanPluginDescriptor descriptor; - void* module; + Glib::Module* module; - PannerInfo (PanPluginDescriptor& d, void* handle) + PannerInfo (PanPluginDescriptor& d, Glib::Module* m) : descriptor (d) - , module (handle) + , module (m) {} ~PannerInfo () { - dlclose (module); + delete module; } }; -class PannerManager : public ARDOUR::SessionHandlePtr +class LIBARDOUR_API PannerManager : public ARDOUR::SessionHandlePtr { public: ~PannerManager (); diff --git a/libs/ardour/ardour/panner_search_path.h b/libs/ardour/ardour/panner_search_path.h index 889b9efb23..23004223b4 100644 --- a/libs/ardour/ardour/panner_search_path.h +++ b/libs/ardour/ardour/panner_search_path.h @@ -24,15 +24,15 @@ namespace ARDOUR { /** - * return a SearchPath containing directories in which to look for + * return a Searchpath containing directories in which to look for * panner plugins. * - * If ARDOUR_PANNER_PATH is defined then the SearchPath returned + * If ARDOUR_PANNER_PATH is defined then the Searchpath returned * will contain only those directories specified in it, otherwise it will * contain the user and system directories which may contain control * surface plugins. */ - PBD::SearchPath panner_search_path (); + PBD::Searchpath panner_search_path (); } // namespace ARDOUR diff --git a/libs/ardour/ardour/panner_shell.h b/libs/ardour/ardour/panner_shell.h index 60db264b4d..02f80c7b28 100644 --- a/libs/ardour/ardour/panner_shell.h +++ b/libs/ardour/ardour/panner_shell.h @@ -30,6 +30,7 @@ #include "pbd/cartesian.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/session_object.h" @@ -46,7 +47,7 @@ class Pannable; /** Class to manage panning by instantiating and controlling * an appropriate Panner object for a given in/out configuration. */ -class PannerShell : public SessionObject +class LIBARDOUR_API PannerShell : public SessionObject { public: PannerShell (std::string name, Session&, boost::shared_ptr<Pannable>, bool is_send = false); diff --git a/libs/ardour/ardour/peak.h b/libs/ardour/ardour/peak.h index ab99889dd3..9c871a9e35 100644 --- a/libs/ardour/ardour/peak.h +++ b/libs/ardour/ardour/peak.h @@ -21,6 +21,7 @@ #define __ardour_peak_h__ #include <cmath> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/utils.h" diff --git a/libs/ardour/ardour/pi_controller.h b/libs/ardour/ardour/pi_controller.h index bcbc81701a..8daf7a7068 100644 --- a/libs/ardour/ardour/pi_controller.h +++ b/libs/ardour/ardour/pi_controller.h @@ -19,9 +19,10 @@ #ifndef __libardour_pi_controller__ #define __libardour_pi_controller__ +#include "ardour/libardour_visibility.h" #include "ardour/types.h" -class PIController { +class LIBARDOUR_API PIController { public: PIController (double resample_factor, int fir_size); ~PIController(); @@ -54,7 +55,7 @@ public: #define ESTIMATOR_SIZE 16 -class PIChaser { +class LIBARDOUR_API PIChaser { public: PIChaser(); ~PIChaser(); diff --git a/libs/ardour/ardour/pitch.h b/libs/ardour/ardour/pitch.h index 961609938c..4c8db5fb80 100644 --- a/libs/ardour/ardour/pitch.h +++ b/libs/ardour/ardour/pitch.h @@ -37,7 +37,7 @@ namespace ARDOUR { namespace ARDOUR { -class Pitch : public RBEffect { +class LIBARDOUR_API Pitch : public RBEffect { public: Pitch (ARDOUR::Session&, TimeFXRequest&); ~Pitch () {} @@ -49,7 +49,7 @@ class Pitch : public RBEffect { namespace ARDOUR { -class Pitch : public Filter { +class LIBARDOUR_API Pitch : public Filter { public: Pitch (ARDOUR::Session&, TimeFXRequest&); ~Pitch () {} diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 754e48cc25..5629a04629 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -41,13 +41,13 @@ #include "evoral/types.hpp" #include "ardour/ardour.h" +#include "ardour/region.h" #include "ardour/session_object.h" #include "ardour/data_type.h" namespace ARDOUR { class Session; -class Region; class Playlist; class Crossfade; @@ -55,10 +55,10 @@ namespace Properties { /* fake the type, since regions are handled by SequenceProperty which doesn't care about such things. */ - extern PBD::PropertyDescriptor<bool> regions; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> regions; } -class RegionListProperty : public PBD::SequenceProperty<std::list<boost::shared_ptr<Region> > > +class LIBARDOUR_API RegionListProperty : public PBD::SequenceProperty<std::list<boost::shared_ptr<Region> > > { public: RegionListProperty (Playlist&); @@ -78,7 +78,7 @@ class RegionListProperty : public PBD::SequenceProperty<std::list<boost::shared_ Playlist& _playlist; }; -class Playlist : public SessionObject , public boost::enable_shared_from_this<Playlist> +class LIBARDOUR_API Playlist : public SessionObject , public boost::enable_shared_from_this<Playlist> { public: static void make_property_quarks (); diff --git a/libs/ardour/ardour/playlist_factory.h b/libs/ardour/ardour/playlist_factory.h index 8b5d9d6a23..505836234b 100644 --- a/libs/ardour/ardour/playlist_factory.h +++ b/libs/ardour/ardour/playlist_factory.h @@ -28,7 +28,7 @@ namespace ARDOUR { class Session; -class PlaylistFactory { +class LIBARDOUR_API PlaylistFactory { public: static PBD::Signal2<void,boost::shared_ptr<Playlist>, bool> PlaylistCreated; diff --git a/libs/ardour/ardour/playlist_source.h b/libs/ardour/ardour/playlist_source.h index 71802fddb6..55cc1f6b59 100644 --- a/libs/ardour/ardour/playlist_source.h +++ b/libs/ardour/ardour/playlist_source.h @@ -31,7 +31,7 @@ namespace ARDOUR { class Playlist; -class PlaylistSource : virtual public Source { +class LIBARDOUR_API PlaylistSource : virtual public Source { public: virtual ~PlaylistSource (); diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 1bc7dc5afd..a69b87efbd 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -32,6 +32,7 @@ #include "ardour/cycles.h" #include "ardour/latent.h" #include "ardour/plugin_insert.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/midi_state_tracker.h" @@ -49,7 +50,7 @@ class Plugin; typedef boost::shared_ptr<Plugin> PluginPtr; -class PluginInfo { +class LIBARDOUR_API PluginInfo { public: PluginInfo () { } virtual ~PluginInfo () { } @@ -87,7 +88,7 @@ class PluginInfo { typedef boost::shared_ptr<PluginInfo> PluginInfoPtr; typedef std::list<PluginInfoPtr> PluginInfoList; -class Plugin : public PBD::StatefulDestructible, public Latent +class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent { public: Plugin (ARDOUR::AudioEngine&, ARDOUR::Session&); diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 7d7e2e7269..627c847513 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -26,6 +26,7 @@ #include <boost/weak_ptr.hpp> #include "ardour/ardour.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/processor.h" #include "ardour/automation_control.h" @@ -40,7 +41,7 @@ class Plugin; /** Plugin inserts: send data through a plugin */ -class PluginInsert : public Processor +class LIBARDOUR_API PluginInsert : public Processor { public: PluginInsert (Session&, boost::shared_ptr<Plugin> = boost::shared_ptr<Plugin>()); diff --git a/libs/ardour/ardour/plugin_manager.h b/libs/ardour/ardour/plugin_manager.h index a7a5703690..bee1c68704 100644 --- a/libs/ardour/ardour/plugin_manager.h +++ b/libs/ardour/ardour/plugin_manager.h @@ -30,6 +30,7 @@ #include <set> #include <boost/utility.hpp> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/plugin.h" @@ -37,7 +38,7 @@ namespace ARDOUR { class Plugin; -class PluginManager : public boost::noncopyable { +class LIBARDOUR_API PluginManager : public boost::noncopyable { public: static PluginManager& instance(); @@ -51,7 +52,6 @@ class PluginManager : public boost::noncopyable { void refresh (); - int add_ladspa_directory (std::string dirpath); int add_windows_vst_directory (std::string dirpath); int add_lxvst_directory (std::string dirpath); @@ -103,7 +103,6 @@ class PluginManager : public boost::noncopyable { std::map<uint32_t, std::string> rdf_type; - std::string ladspa_path; std::string windows_vst_path; std::string lxvst_path; @@ -127,7 +126,6 @@ class PluginManager : public boost::noncopyable { int lxvst_discover_from_path (std::string path); int lxvst_discover (std::string path); - int ladspa_discover_from_path (std::string path); int ladspa_discover (std::string path); std::string get_ladspa_category (uint32_t id); diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index 77bf2b6f71..5fb9a7efc3 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -31,6 +31,7 @@ #include "ardour/data_type.h" #include "ardour/port_engine.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { @@ -38,7 +39,7 @@ namespace ARDOUR { class AudioEngine; class Buffer; -class Port : public boost::noncopyable +class LIBARDOUR_API Port : public boost::noncopyable { public: virtual ~Port (); diff --git a/libs/ardour/ardour/port_engine.h b/libs/ardour/ardour/port_engine.h index 68f8fe1232..62996b7cdf 100644 --- a/libs/ardour/ardour/port_engine.h +++ b/libs/ardour/ardour/port_engine.h @@ -26,6 +26,7 @@ #include <stdint.h> #include "ardour/data_type.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { @@ -74,7 +75,7 @@ class PortManager; * documentation, on which this entire object is based. */ -class PortEngine { +class LIBARDOUR_API PortEngine { public: PortEngine (PortManager& pm) : manager (pm) {} virtual ~PortEngine() {} diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index abd9fb73cc..327080984a 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -26,6 +26,7 @@ #include "ardour/ardour.h" #include "ardour/io_processor.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" class XMLNode; @@ -41,7 +42,7 @@ class Pannable; /** Port inserts: send output to a Jack port, pick up input at a Jack port */ -class PortInsert : public IOProcessor +class LIBARDOUR_API PortInsert : public IOProcessor { public: PortInsert (Session&, boost::shared_ptr<Pannable>, boost::shared_ptr<MuteMaster> mm); diff --git a/libs/ardour/ardour/port_manager.h b/libs/ardour/ardour/port_manager.h index ba15142d83..b36e98fe64 100644 --- a/libs/ardour/ardour/port_manager.h +++ b/libs/ardour/ardour/port_manager.h @@ -40,7 +40,7 @@ namespace ARDOUR { class PortEngine; class AudioBackend; -class PortManager +class LIBARDOUR_API PortManager { public: typedef std::map<std::string,boost::shared_ptr<Port> > Ports; diff --git a/libs/ardour/ardour/port_set.h b/libs/ardour/ardour/port_set.h index 690875cd86..cd76f75ee3 100644 --- a/libs/ardour/ardour/port_set.h +++ b/libs/ardour/ardour/port_set.h @@ -39,7 +39,7 @@ class MidiPort; * and once in a vector of all port (_all_ports). This is to speed up the * fairly common case of iterating over all ports. */ -class PortSet : public boost::noncopyable { +class LIBARDOUR_API PortSet : public boost::noncopyable { public: PortSet(); diff --git a/libs/ardour/ardour/process_thread.h b/libs/ardour/ardour/process_thread.h index f96595fbbf..779fdaea2d 100644 --- a/libs/ardour/ardour/process_thread.h +++ b/libs/ardour/ardour/process_thread.h @@ -23,6 +23,7 @@ #include <glibmm/threads.h> #include "ardour/chan_count.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { @@ -30,7 +31,7 @@ namespace ARDOUR { class ThreadBuffers; class BufferSet; -class ProcessThread +class LIBARDOUR_API ProcessThread { public: ProcessThread (); diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 18f13dbc78..85d466a169 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -30,6 +30,7 @@ #include "ardour/buffer_set.h" #include "ardour/latent.h" #include "ardour/session_object.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/automatable.h" @@ -41,7 +42,7 @@ class Session; class Route; /** A mixer strip element - plugin, send, meter, etc */ -class Processor : public SessionObject, public Automatable, public Latent +class LIBARDOUR_API Processor : public SessionObject, public Automatable, public Latent { public: static const std::string state_node_name; diff --git a/libs/ardour/ardour/profile.h b/libs/ardour/ardour/profile.h index 5d4e611833..9346138e00 100644 --- a/libs/ardour/ardour/profile.h +++ b/libs/ardour/ardour/profile.h @@ -23,9 +23,11 @@ #include <boost/dynamic_bitset.hpp> #include <stdint.h> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { -class RuntimeProfile { +class LIBARDOUR_API RuntimeProfile { public: enum Element { SmallScreen, @@ -51,7 +53,7 @@ private: }; -extern RuntimeProfile* Profile; +LIBARDOUR_API extern RuntimeProfile* Profile; }; // namespace ARDOUR diff --git a/libs/ardour/ardour/progress.h b/libs/ardour/ardour/progress.h index 10b7d75960..79043a31ee 100644 --- a/libs/ardour/ardour/progress.h +++ b/libs/ardour/ardour/progress.h @@ -22,10 +22,12 @@ #include <list> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { /** A class to handle reporting of progress of something */ -class Progress +class LIBARDOUR_API Progress { public: Progress (); diff --git a/libs/ardour/ardour/proxy_controllable.h b/libs/ardour/ardour/proxy_controllable.h index 169f60f9f5..066f2aac81 100644 --- a/libs/ardour/ardour/proxy_controllable.h +++ b/libs/ardour/ardour/proxy_controllable.h @@ -30,7 +30,7 @@ namespace ARDOUR { so that it can be used like a regular Controllable, bound to MIDI, OSC etc. */ -class ProxyControllable : public PBD::Controllable { +class LIBARDOUR_API ProxyControllable : public PBD::Controllable { public: ProxyControllable (const std::string& name, PBD::Controllable::Flag flags, boost::function1<bool,double> setter, diff --git a/libs/ardour/ardour/public_diskstream.h b/libs/ardour/ardour/public_diskstream.h index 125e1a21ce..5b5cd48231 100644 --- a/libs/ardour/ardour/public_diskstream.h +++ b/libs/ardour/ardour/public_diskstream.h @@ -27,7 +27,7 @@ class Source; class Location; /** Public interface to a Diskstream */ -class PublicDiskstream +class LIBARDOUR_API PublicDiskstream { public: virtual ~PublicDiskstream() {} diff --git a/libs/ardour/ardour/quantize.h b/libs/ardour/ardour/quantize.h index e56927767e..c41d172177 100644 --- a/libs/ardour/ardour/quantize.h +++ b/libs/ardour/ardour/quantize.h @@ -21,6 +21,7 @@ #ifndef __ardour_quantize_h__ #define __ardour_quantize_h__ +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/midi_operator.h" @@ -28,7 +29,7 @@ namespace ARDOUR { class Session; -class Quantize : public MidiOperator { +class LIBARDOUR_API Quantize : public MidiOperator { public: Quantize (ARDOUR::Session&, bool snap_start, bool snap_end, double start_grid, double end_grid, diff --git a/libs/ardour/ardour/rb_effect.h b/libs/ardour/ardour/rb_effect.h index 1d36f31332..6c10278fb3 100644 --- a/libs/ardour/ardour/rb_effect.h +++ b/libs/ardour/ardour/rb_effect.h @@ -27,7 +27,7 @@ namespace ARDOUR { class AudioRegion; -class RBEffect : public Filter { +class LIBARDOUR_API RBEffect : public Filter { public: RBEffect (ARDOUR::Session&, TimeFXRequest&); ~RBEffect (); diff --git a/libs/ardour/ardour/rc_configuration.h b/libs/ardour/ardour/rc_configuration.h index e2f68477a1..d85c723ff8 100644 --- a/libs/ardour/ardour/rc_configuration.h +++ b/libs/ardour/ardour/rc_configuration.h @@ -23,6 +23,7 @@ #include <map> #include <string> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/utils.h" #include "ardour/configuration.h" @@ -31,7 +32,7 @@ class XMLNode; namespace ARDOUR { -class RCConfiguration : public Configuration +class LIBARDOUR_API RCConfiguration : public Configuration { public: RCConfiguration(); @@ -83,8 +84,8 @@ class RCConfiguration : public Configuration }; /* XXX: rename this */ -extern RCConfiguration *Config; -extern gain_t speed_quietning; /* see comment in configuration.cc */ +LIBARDOUR_API extern RCConfiguration *Config; +LIBARDOUR_API extern gain_t speed_quietning; /* see comment in configuration.cc */ } // namespace ARDOUR diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index b92d0e152a..adae854ca7 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -157,6 +157,7 @@ CONFIG_VARIABLE (MeterLineUp, meter_line_up_din, "meter-line-up-din", MeteringLi CONFIG_VARIABLE (float, meter_peak, "meter-peak", 0.0f) CONFIG_VARIABLE (bool, meter_style_led, "meter-style-led", true) CONFIG_VARIABLE (bool, show_editor_meter, "show-editor-meter", true) +CONFIG_VARIABLE (double, waveform_clip_level, "waveform-clip-level", -0.0933967) /* units of dB */ /* miscellany */ @@ -191,7 +192,6 @@ CONFIG_VARIABLE (WaveformScale, waveform_scale, "waveform-scale", Linear) CONFIG_VARIABLE (WaveformShape, waveform_shape, "waveform-shape", Traditional) CONFIG_VARIABLE (bool, allow_special_bus_removal, "allow-special-bus-removal", false) CONFIG_VARIABLE (int32_t, processor_usage, "processor-usage", -1) -CONFIG_VARIABLE (bool, color_regions_using_track_color, "color-regions-using-track-color", false) CONFIG_VARIABLE (gain_t, max_gain, "max-gain", 2.0) /* +6.0dB */ CONFIG_VARIABLE (bool, update_editor_during_summary_drag, "update-editor-during-summary-drag", true) CONFIG_VARIABLE (bool, never_display_periodic_midi, "never-display-periodic-midi", true) diff --git a/libs/ardour/ardour/readable.h b/libs/ardour/ardour/readable.h index d184902deb..18190436df 100644 --- a/libs/ardour/ardour/readable.h +++ b/libs/ardour/ardour/readable.h @@ -20,11 +20,12 @@ #ifndef __ardour_readable_h__ #define __ardour_readable_h__ +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { -class Readable { +class LIBARDOUR_API Readable { public: Readable () {} virtual ~Readable() {} diff --git a/libs/ardour/ardour/recent_sessions.h b/libs/ardour/ardour/recent_sessions.h index 2951496849..03134da6d2 100644 --- a/libs/ardour/ardour/recent_sessions.h +++ b/libs/ardour/ardour/recent_sessions.h @@ -24,13 +24,15 @@ #include <utility> #include <string> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { typedef std::deque<std::pair<std::string,std::string> > RecentSessions; - int read_recent_sessions (RecentSessions& rs); - int store_recent_sessions (std::string name, std::string path); - int write_recent_sessions (RecentSessions& rs); - int remove_recent_sessions (const std::string& path); + LIBARDOUR_API int read_recent_sessions (RecentSessions& rs); + LIBARDOUR_API int store_recent_sessions (std::string name, std::string path); + LIBARDOUR_API int write_recent_sessions (RecentSessions& rs); + LIBARDOUR_API int remove_recent_sessions (const std::string& path); }; // namespace ARDOUR #endif // __ardour_recent_sessions_h__ diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 3ee829ed12..a66047a02a 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -38,35 +38,34 @@ class XMLNode; - namespace ARDOUR { namespace Properties { - extern PBD::PropertyDescriptor<bool> muted; - extern PBD::PropertyDescriptor<bool> opaque; - extern PBD::PropertyDescriptor<bool> locked; - extern PBD::PropertyDescriptor<bool> video_locked; - extern PBD::PropertyDescriptor<bool> automatic; - extern PBD::PropertyDescriptor<bool> whole_file; - extern PBD::PropertyDescriptor<bool> import; - extern PBD::PropertyDescriptor<bool> external; - extern PBD::PropertyDescriptor<bool> sync_marked; - extern PBD::PropertyDescriptor<bool> left_of_split; - extern PBD::PropertyDescriptor<bool> right_of_split; - extern PBD::PropertyDescriptor<bool> hidden; - extern PBD::PropertyDescriptor<bool> position_locked; - extern PBD::PropertyDescriptor<bool> valid_transients; - extern PBD::PropertyDescriptor<framepos_t> start; - extern PBD::PropertyDescriptor<framecnt_t> length; - extern PBD::PropertyDescriptor<framepos_t> position; - extern PBD::PropertyDescriptor<framecnt_t> sync_position; - extern PBD::PropertyDescriptor<layer_t> layer; - extern PBD::PropertyDescriptor<framepos_t> ancestral_start; - extern PBD::PropertyDescriptor<framecnt_t> ancestral_length; - extern PBD::PropertyDescriptor<float> stretch; - extern PBD::PropertyDescriptor<float> shift; - extern PBD::PropertyDescriptor<PositionLockStyle> position_lock_style; - extern PBD::PropertyDescriptor<uint64_t> layering_index; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> muted; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> opaque; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> locked; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> video_locked; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> automatic; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> whole_file; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> import; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> external; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> sync_marked; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> left_of_split; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> right_of_split; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> hidden; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> position_locked; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> valid_transients; + LIBARDOUR_API extern PBD::PropertyDescriptor<framepos_t> start; + LIBARDOUR_API extern PBD::PropertyDescriptor<framecnt_t> length; + LIBARDOUR_API extern PBD::PropertyDescriptor<framepos_t> position; + LIBARDOUR_API extern PBD::PropertyDescriptor<framecnt_t> sync_position; + LIBARDOUR_API extern PBD::PropertyDescriptor<layer_t> layer; + LIBARDOUR_API extern PBD::PropertyDescriptor<framepos_t> ancestral_start; + LIBARDOUR_API extern PBD::PropertyDescriptor<framecnt_t> ancestral_length; + LIBARDOUR_API extern PBD::PropertyDescriptor<float> stretch; + LIBARDOUR_API extern PBD::PropertyDescriptor<float> shift; + LIBARDOUR_API extern PBD::PropertyDescriptor<PositionLockStyle> position_lock_style; + LIBARDOUR_API extern PBD::PropertyDescriptor<uint64_t> layering_index; }; class Playlist; @@ -74,14 +73,14 @@ class Filter; class ExportSpecification; class Progress; -enum RegionEditState { +enum LIBARDOUR_API RegionEditState { EditChangesNothing = 0, EditChangesName = 1, EditChangesID = 2 }; -class Region +class LIBARDOUR_API Region : public SessionObject , public boost::enable_shared_from_this<Region> , public Readable @@ -220,7 +219,7 @@ class Region bool at_natural_position () const; void move_to_natural_position (); - void trim_start (framepos_t new_position); + void move_start (frameoffset_t distance); void trim_front (framepos_t new_position); void trim_end (framepos_t new_position); void trim_to (framepos_t position, framecnt_t length); diff --git a/libs/ardour/ardour/region_factory.h b/libs/ardour/ardour/region_factory.h index ed0c962d87..a9b73dc462 100644 --- a/libs/ardour/ardour/region_factory.h +++ b/libs/ardour/ardour/region_factory.h @@ -28,6 +28,7 @@ #include "pbd/property_list.h" #include "pbd/signals.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" class XMLNode; @@ -38,7 +39,7 @@ namespace ARDOUR { class Session; class AudioRegion; -class RegionFactory { +class LIBARDOUR_API RegionFactory { public: typedef std::map<PBD::ID,boost::shared_ptr<Region> > RegionMap; diff --git a/libs/ardour/ardour/region_sorters.h b/libs/ardour/ardour/region_sorters.h index baa3a3417d..9fd739a4da 100644 --- a/libs/ardour/ardour/region_sorters.h +++ b/libs/ardour/ardour/region_sorters.h @@ -24,13 +24,13 @@ namespace ARDOUR { -struct RegionSortByPosition { +struct LIBARDOUR_API RegionSortByPosition { bool operator() (boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) { return a->position() < b->position(); } }; -struct RegionSortByLayer { +struct LIBARDOUR_API RegionSortByLayer { bool operator() (boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) { return a->layer() < b->layer(); } diff --git a/libs/ardour/ardour/resampled_source.h b/libs/ardour/ardour/resampled_source.h index a36ad4331f..bb088f36fb 100644 --- a/libs/ardour/ardour/resampled_source.h +++ b/libs/ardour/ardour/resampled_source.h @@ -22,12 +22,13 @@ #include <samplerate.h> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/importable_source.h" namespace ARDOUR { -class ResampledImportableSource : public ImportableSource +class LIBARDOUR_API ResampledImportableSource : public ImportableSource { public: ResampledImportableSource (boost::shared_ptr<ImportableSource>, framecnt_t rate, SrcQuality); diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h index 6dcd6ac2fc..45bb5573b2 100644 --- a/libs/ardour/ardour/return.h +++ b/libs/ardour/ardour/return.h @@ -34,7 +34,7 @@ class Amp; class PeakMeter; -class Return : public IOProcessor +class LIBARDOUR_API Return : public IOProcessor { public: Return (Session&, bool internal = false); diff --git a/libs/ardour/ardour/reverse.h b/libs/ardour/ardour/reverse.h index edc72ce707..4c24a7c1cb 100644 --- a/libs/ardour/ardour/reverse.h +++ b/libs/ardour/ardour/reverse.h @@ -24,7 +24,7 @@ namespace ARDOUR { -class Reverse : public Filter { +class LIBARDOUR_API Reverse : public Filter { public: Reverse (ARDOUR::Session&); ~Reverse (); diff --git a/libs/ardour/ardour/revision.h b/libs/ardour/ardour/revision.h index 9eeb1e2a9a..69c7519e01 100644 --- a/libs/ardour/ardour/revision.h +++ b/libs/ardour/ardour/revision.h @@ -20,8 +20,15 @@ #ifndef __ardour_revision_h__ #define __ardour_revision_h__ +#include "ardour/libardour_visibility.h" + namespace ARDOUR { - extern const char* revision; + + extern LIBARDOUR_API const char* revision; + + extern "C" { + LIBARDOUR_API const char* get_ardour_revision(); + } } #endif diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 0d200ae44c..5cd17ee24e 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -43,6 +43,7 @@ #include "ardour/ardour.h" #include "ardour/instrument_info.h" #include "ardour/io.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/mute_master.h" #include "ardour/route_group_member.h" @@ -67,7 +68,7 @@ class Pannable; class CapturingProcessor; class InternalSend; -class Route : public SessionObject, public Automatable, public RouteGroupMember, public GraphNode, public boost::enable_shared_from_this<Route> +class LIBARDOUR_API Route : public SessionObject, public Automatable, public RouteGroupMember, public GraphNode, public boost::enable_shared_from_this<Route> { public: diff --git a/libs/ardour/ardour/route_graph.h b/libs/ardour/ardour/route_graph.h index 0b0af6c7dd..77e74ceafd 100644 --- a/libs/ardour/ardour/route_graph.h +++ b/libs/ardour/ardour/route_graph.h @@ -37,7 +37,7 @@ typedef boost::shared_ptr<Route> GraphVertex; * * This may be a premature optimisation... */ -class GraphEdges +class LIBARDOUR_API GraphEdges { public: typedef std::map<GraphVertex, std::set<GraphVertex> > EdgeMap; diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index 2f62193d83..763430e1f1 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -29,24 +29,25 @@ #include "pbd/stateful.h" #include "pbd/signals.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/session_object.h" namespace ARDOUR { namespace Properties { - extern PBD::PropertyDescriptor<bool> relative; - extern PBD::PropertyDescriptor<bool> active; - extern PBD::PropertyDescriptor<bool> gain; - extern PBD::PropertyDescriptor<bool> mute; - extern PBD::PropertyDescriptor<bool> solo; - extern PBD::PropertyDescriptor<bool> recenable; - extern PBD::PropertyDescriptor<bool> select; - extern PBD::PropertyDescriptor<bool> route_active; - extern PBD::PropertyDescriptor<bool> color; - extern PBD::PropertyDescriptor<bool> monitoring; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> relative; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> active; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> gain; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> mute; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> solo; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> recenable; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> select; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> route_active; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> color; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> monitoring; /* we use this, but its declared in region.cc */ - extern PBD::PropertyDescriptor<bool> hidden; + LIBARDOUR_API extern PBD::PropertyDescriptor<bool> hidden; }; class Route; @@ -54,7 +55,7 @@ class Track; class AudioTrack; class Session; -class RouteGroup : public SessionObject +class LIBARDOUR_API RouteGroup : public SessionObject { public: static void make_property_quarks(); diff --git a/libs/ardour/ardour/route_group_member.h b/libs/ardour/ardour/route_group_member.h index 2665c719e6..b0368cb240 100644 --- a/libs/ardour/ardour/route_group_member.h +++ b/libs/ardour/ardour/route_group_member.h @@ -26,7 +26,7 @@ namespace ARDOUR { class RouteGroup; -class RouteGroupMember +class LIBARDOUR_API RouteGroupMember { public: RouteGroupMember () : _route_group (0) {} diff --git a/libs/ardour/ardour/runtime_functions.h b/libs/ardour/ardour/runtime_functions.h index 8882d721d7..e1d6b99f61 100644 --- a/libs/ardour/ardour/runtime_functions.h +++ b/libs/ardour/ardour/runtime_functions.h @@ -20,6 +20,7 @@ #ifndef __ardour_runtime_functions_h__ #define __ardour_runtime_functions_h__ +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { @@ -30,11 +31,11 @@ namespace ARDOUR { typedef void (*mix_buffers_with_gain_t) (ARDOUR::Sample *, const ARDOUR::Sample *, pframes_t, float); typedef void (*mix_buffers_no_gain_t) (ARDOUR::Sample *, const ARDOUR::Sample *, pframes_t); - extern compute_peak_t compute_peak; - extern find_peaks_t find_peaks; - extern apply_gain_to_buffer_t apply_gain_to_buffer; - extern mix_buffers_with_gain_t mix_buffers_with_gain; - extern mix_buffers_no_gain_t mix_buffers_no_gain; + LIBARDOUR_API extern compute_peak_t compute_peak; + LIBARDOUR_API extern find_peaks_t find_peaks; + LIBARDOUR_API extern apply_gain_to_buffer_t apply_gain_to_buffer; + LIBARDOUR_API extern mix_buffers_with_gain_t mix_buffers_with_gain; + LIBARDOUR_API extern mix_buffers_no_gain_t mix_buffers_no_gain; } #endif /* __ardour_runtime_functions_h__ */ diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index 118110f05a..9b30dcf792 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -32,7 +32,7 @@ namespace ARDOUR { class PeakMeter; class Amp; -class Send : public Delivery +class LIBARDOUR_API Send : public Delivery { public: Send (Session&, boost::shared_ptr<Pannable> pannable, boost::shared_ptr<MuteMaster>, Delivery::Role r = Delivery::Send); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 9b4fbef774..7295828d2f 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -141,7 +141,7 @@ class WindowsVSTPlugin; extern void setup_enum_writer (); -class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager +class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager { public: enum RecordState { @@ -238,7 +238,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi return _bundles.reader (); } - struct RoutePublicOrderSorter { + struct LIBARDOUR_API RoutePublicOrderSorter { bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b); }; @@ -830,7 +830,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void request_resume_timecode_transmission (); bool timecode_transmission_suspended () const; - std::string source_search_path(DataType) const; + std::vector<std::string> source_search_path(DataType) const; void ensure_search_path_includes (const std::string& path, DataType type); std::list<std::string> unknown_processors () const; diff --git a/libs/ardour/ardour/session_configuration.h b/libs/ardour/ardour/session_configuration.h index 46d6defa7d..e72d19f322 100644 --- a/libs/ardour/ardour/session_configuration.h +++ b/libs/ardour/ardour/session_configuration.h @@ -24,7 +24,7 @@ namespace ARDOUR { -class SessionConfiguration : public Configuration +class LIBARDOUR_API SessionConfiguration : public Configuration { public: SessionConfiguration (); diff --git a/libs/ardour/ardour/session_directory.h b/libs/ardour/ardour/session_directory.h index a4c372d6ed..685f0870dd 100644 --- a/libs/ardour/ardour/session_directory.h +++ b/libs/ardour/ardour/session_directory.h @@ -22,9 +22,11 @@ #include <string> #include <vector> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { -class SessionDirectory +class LIBARDOUR_API SessionDirectory { public: diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h index ccec43d909..1283f32004 100644 --- a/libs/ardour/ardour/session_event.h +++ b/libs/ardour/ardour/session_event.h @@ -28,6 +28,7 @@ #include "pbd/ringbuffer.h" #include "pbd/event_loop.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { @@ -35,7 +36,7 @@ namespace ARDOUR { class Slave; class Region; -class SessionEvent { +class LIBARDOUR_API SessionEvent { public: enum Type { SetTransportSpeed, @@ -108,7 +109,7 @@ public: boost::shared_ptr<Region> region; - SessionEvent (Type t, Action a, framepos_t when, framepos_t where, double spd, bool yn = false, bool yn2 = false, bool yn3 = false) + SessionEvent (Type t, Action a, framepos_t when, framepos_t where, double spd, bool yn = false, bool yn2 = false, bool yn3 = false) : type (t) , action (a) , action_frame (when) diff --git a/libs/ardour/ardour/session_handle.h b/libs/ardour/ardour/session_handle.h index 0331970e5c..330f1805cd 100644 --- a/libs/ardour/ardour/session_handle.h +++ b/libs/ardour/ardour/session_handle.h @@ -22,10 +22,12 @@ #include "pbd/signals.h" +#include "ardour/libardour_visibility.h" + namespace ARDOUR { class Session; -class SessionHandleRef : public PBD::ScopedConnectionList +class LIBARDOUR_API SessionHandleRef : public PBD::ScopedConnectionList { public: SessionHandleRef (ARDOUR::Session& s); @@ -37,7 +39,7 @@ class SessionHandleRef : public PBD::ScopedConnectionList virtual void insanity_check (); }; -class SessionHandlePtr +class LIBARDOUR_API SessionHandlePtr { public: SessionHandlePtr (ARDOUR::Session* s); diff --git a/libs/ardour/ardour/session_metadata.h b/libs/ardour/ardour/session_metadata.h index c4341dbc61..b163e98f65 100644 --- a/libs/ardour/ardour/session_metadata.h +++ b/libs/ardour/ardour/session_metadata.h @@ -28,13 +28,15 @@ #include "pbd/statefuldestructible.h" #include "pbd/xml++.h" +#include "ardour/libardour_visibility.h" + namespace ARDOUR { /** Represents metadata associated to a Session * Metadata can be accessed and edited via this class. * Exported files can also be tagged with this data. */ -class SessionMetadata : public PBD::StatefulDestructible +class LIBARDOUR_API SessionMetadata : public PBD::StatefulDestructible { public: //singleton instance: diff --git a/libs/ardour/ardour/session_object.h b/libs/ardour/ardour/session_object.h index eacb0c49e9..ac74f07b77 100644 --- a/libs/ardour/ardour/session_object.h +++ b/libs/ardour/ardour/session_object.h @@ -31,7 +31,7 @@ namespace ARDOUR { namespace Properties { - extern PBD::PropertyDescriptor<std::string> name; + LIBARDOUR_API extern PBD::PropertyDescriptor<std::string> name; } class Session; @@ -40,7 +40,7 @@ class Session; expected to be destroyed before the session calls drop_references(). */ -class SessionObject : public SessionHandleRef, public PBD::StatefulDestructible +class LIBARDOUR_API SessionObject : public SessionHandleRef, public PBD::StatefulDestructible { public: static void make_property_quarks (); diff --git a/libs/ardour/ardour/session_playlists.h b/libs/ardour/ardour/session_playlists.h index 83dc8ee58c..e7ad1624dd 100644 --- a/libs/ardour/ardour/session_playlists.h +++ b/libs/ardour/ardour/session_playlists.h @@ -44,7 +44,7 @@ class Session; class Crossfade; class Track; -class SessionPlaylists : public PBD::ScopedConnectionList +class LIBARDOUR_API SessionPlaylists : public PBD::ScopedConnectionList { public: ~SessionPlaylists (); diff --git a/libs/ardour/ardour/session_state_utils.h b/libs/ardour/ardour/session_state_utils.h index 166b738d05..f35bbd0778 100644 --- a/libs/ardour/ardour/session_state_utils.h +++ b/libs/ardour/ardour/session_state_utils.h @@ -22,6 +22,8 @@ #include <vector> #include <string> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { /** @@ -32,7 +34,7 @@ namespace ARDOUR { * * @return true if successful, false otherwise. */ -bool create_backup_file (const std::string & file_path); +LIBARDOUR_API bool create_backup_file (const std::string & file_path); /** * Get the absolute paths to all state files in the directory @@ -41,8 +43,8 @@ bool create_backup_file (const std::string & file_path); * @param directory_path The absolute path to a directory. * @param result vector to contain resulting state files. */ -void get_state_files_in_directory (const std::string& directory_path, - std::vector<std::string>& result); +LIBARDOUR_API void get_state_files_in_directory (const std::string& directory_path, + std::vector<std::string>& result); /** * Given a vector of paths to files, return a vector containing @@ -52,7 +54,7 @@ void get_state_files_in_directory (const std::string& directory_path, * @return a vector containing a list of file names without any * filename extension. */ -std::vector<std::string> get_file_names_no_extension (const std::vector<std::string> & file_paths); +LIBARDOUR_API std::vector<std::string> get_file_names_no_extension (const std::vector<std::string> & file_paths); } // namespace ARDOUR diff --git a/libs/ardour/ardour/session_utils.h b/libs/ardour/ardour/session_utils.h index ab24e976b2..bd9cc92267 100644 --- a/libs/ardour/ardour/session_utils.h +++ b/libs/ardour/ardour/session_utils.h @@ -23,9 +23,11 @@ #include <string> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { -int find_session (std::string str, std::string& path, std::string& snapshot, bool& isnew); + LIBARDOUR_API extern int find_session (std::string str, std::string& path, std::string& snapshot, bool& isnew); }; diff --git a/libs/ardour/ardour/silentfilesource.h b/libs/ardour/ardour/silentfilesource.h index 5cdade3751..cf6462247a 100644 --- a/libs/ardour/ardour/silentfilesource.h +++ b/libs/ardour/ardour/silentfilesource.h @@ -25,13 +25,14 @@ namespace ARDOUR { -class SilentFileSource : public AudioFileSource { +class LIBARDOUR_API SilentFileSource : public AudioFileSource { public: int update_header (framepos_t /*when*/, struct tm&, time_t) { return 0; } int flush_header () { return 0; } float sample_rate () const { return _sample_rate; } void set_length (framecnt_t len) { _length = len; } + void flush () {} bool destructive() const { return false; } bool can_be_analysed() const { return false; } @@ -59,7 +60,7 @@ protected: void set_header_timeline_position () {} int read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t /*start*/, framecnt_t /*cnt*/, - double /*samples_per_unit*/, framecnt_t /*fpp*/) const { + double /*frames_per_pixel*/, framecnt_t /*fpp*/) const { memset (peaks, 0, sizeof (PeakData) * npeaks); return 0; } diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 364929eaab..7e80055f94 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -31,6 +31,7 @@ #include "timecode/time.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "midi++/parser.h" #include "midi++/types.h" @@ -59,7 +60,7 @@ class MidiPort; * Therefore it is rather that class, that makes ARDOUR a slave by connecting it * to its external time master. */ -class Slave { +class LIBARDOUR_API Slave { public: Slave() { } virtual ~Slave() {} @@ -180,7 +181,7 @@ class Slave { }; /// We need this wrapper for testability, it's just too hard to mock up a session class -class ISlaveSessionProxy { +class LIBARDOUR_API ISlaveSessionProxy { public: virtual ~ISlaveSessionProxy() {} virtual TempoMap& tempo_map() const { return *((TempoMap *) 0); } @@ -200,7 +201,7 @@ class ISlaveSessionProxy { /// The Session Proxy for use in real Ardour -class SlaveSessionProxy : public ISlaveSessionProxy { +class LIBARDOUR_API SlaveSessionProxy : public ISlaveSessionProxy { Session& session; public: @@ -219,7 +220,7 @@ class SlaveSessionProxy : public ISlaveSessionProxy { void request_transport_speed (double speed); }; -struct SafeTime { +struct LIBARDOUR_API SafeTime { volatile int guard1; framepos_t position; framepos_t timestamp; @@ -235,7 +236,7 @@ struct SafeTime { } }; -class TimecodeSlave : public Slave { +class LIBARDOUR_API TimecodeSlave : public Slave { public: TimecodeSlave () {} @@ -252,7 +253,7 @@ class TimecodeSlave : public Slave { bool timecode_negative_offset; }; -class MTC_Slave : public TimecodeSlave { +class LIBARDOUR_API MTC_Slave : public TimecodeSlave { public: MTC_Slave (Session&, MidiPort&); ~MTC_Slave (); @@ -336,7 +337,7 @@ class MTC_Slave : public TimecodeSlave { void parameter_changed(std::string const & p); }; -class LTC_Slave : public TimecodeSlave { +class LIBARDOUR_API LTC_Slave : public TimecodeSlave { public: LTC_Slave (Session&); ~LTC_Slave (); @@ -404,7 +405,7 @@ public: double b, c; ///< DLL filter coefficients }; -class MIDIClock_Slave : public Slave { +class LIBARDOUR_API MIDIClock_Slave : public Slave { public: MIDIClock_Slave (Session&, MidiPort&, int ppqn = 24); @@ -490,7 +491,7 @@ class MIDIClock_Slave : public Slave { bool _starting; }; -class Engine_Slave : public Slave +class LIBARDOUR_API Engine_Slave : public Slave { public: Engine_Slave (AudioEngine&); diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h index ca337a62c2..82e6252b45 100644 --- a/libs/ardour/ardour/smf_source.h +++ b/libs/ardour/ardour/smf_source.h @@ -34,7 +34,7 @@ namespace ARDOUR { template<typename T> class MidiRingBuffer; /** Standard Midi File (Type 0) Source */ -class SMFSource : public MidiSource, public FileSource, public Evoral::SMF { +class LIBARDOUR_API SMFSource : public MidiSource, public FileSource, public Evoral::SMF { public: /** Constructor for existing external-to-session files */ SMFSource (Session& session, const std::string& path, diff --git a/libs/ardour/ardour/sndfileimportable.h b/libs/ardour/ardour/sndfileimportable.h index 8612e264c4..10c429c545 100644 --- a/libs/ardour/ardour/sndfileimportable.h +++ b/libs/ardour/ardour/sndfileimportable.h @@ -22,12 +22,13 @@ #include <boost/shared_ptr.hpp> #include <sndfile.h> +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/importable_source.h" namespace ARDOUR { -class SndFileImportableSource : public ImportableSource { +class LIBARDOUR_API SndFileImportableSource : public ImportableSource { public: SndFileImportableSource (const std::string& path); virtual ~SndFileImportableSource(); diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 3f63f1c598..25b8f003b2 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -28,7 +28,7 @@ namespace ARDOUR { -class SndFileSource : public AudioFileSource { +class LIBARDOUR_API SndFileSource : public AudioFileSource { public: /** Constructor to be called for existing external-to-session files */ SndFileSource (Session&, const std::string& path, int chn, Flag flags); @@ -46,6 +46,7 @@ class SndFileSource : public AudioFileSource { float sample_rate () const; int update_header (framepos_t when, struct tm&, time_t); int flush_header (); + void flush (); framepos_t natural_position () const; diff --git a/libs/ardour/ardour/soundseq.h b/libs/ardour/ardour/soundseq.h index ff8e96ad8f..02425a71cf 100644 --- a/libs/ardour/ardour/soundseq.h +++ b/libs/ardour/ardour/soundseq.h @@ -26,21 +26,21 @@ namespace ARDOUR { typedef gint16 peak_datum; -struct peak_data_t { +struct LIBARDOUR_API peak_data_t { peak_datum min; peak_datum max; }; const uint32_t frames_per_peak = 2048; -class Sound : public EDL::Piece { +class LIBARDOUR_API Sound : public EDL::Piece { public: int peak (peak_data_t& pk, uint32_t start, uint32_t cnt); int read_peaks (peak_data_t *, uint32_t npeaks, uint32_t start, uint32_t cnt); int build_peak (uint32_t first_frame, uint32_t cnt); }; -class SoundPlaylist : public EDL::Playlist { +class LIBARDOUR_API SoundPlaylist : public EDL::Playlist { public: int read_peaks (peak_data_t *, uint32_t npeaks, uint32_t start, uint32_t cnt); }; diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index 5e851702d4..78b3cfaa21 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -36,7 +36,7 @@ namespace ARDOUR { class Session; -class Source : public SessionObject +class LIBARDOUR_API Source : public SessionObject { public: enum Flag { diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index c94f783b44..4ef2cd60ee 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -36,7 +36,7 @@ class Session; class AudioSource; class Playlist; -class SourceFactory { +class LIBARDOUR_API SourceFactory { public: static void init (); diff --git a/libs/ardour/ardour/speaker.h b/libs/ardour/ardour/speaker.h index 3deeb8b0d9..c643eb5d02 100644 --- a/libs/ardour/ardour/speaker.h +++ b/libs/ardour/ardour/speaker.h @@ -22,9 +22,11 @@ #include "pbd/cartesian.h" #include "pbd/signals.h" +#include "ardour/libardour_visibility.h" + namespace ARDOUR { -class Speaker { +class LIBARDOUR_API Speaker { public: Speaker (int, const PBD::AngularVector& position); Speaker (const Speaker &); diff --git a/libs/ardour/ardour/speakers.h b/libs/ardour/ardour/speakers.h index dbe4ef180e..cde2c40dbb 100644 --- a/libs/ardour/ardour/speakers.h +++ b/libs/ardour/ardour/speakers.h @@ -31,7 +31,7 @@ class XMLNode; namespace ARDOUR { -class Speakers : public PBD::Stateful { +class LIBARDOUR_API Speakers : public PBD::Stateful { public: Speakers (); Speakers (const Speakers&); diff --git a/libs/ardour/ardour/spline.h b/libs/ardour/ardour/spline.h index 6a12e96d52..475441fd44 100644 --- a/libs/ardour/ardour/spline.h +++ b/libs/ardour/ardour/spline.h @@ -28,7 +28,7 @@ extern "C" { typedef struct _spline Spline; typedef struct _spline_point SplinePoint; -struct _spline_point +struct LIBARDOUR_API _spline_point { float x; float y; @@ -45,7 +45,7 @@ void spline_fill (Spline *, float x0, float x1, float *vec, uint32_t veclen); float spline_get_max_x (Spline *); float spline_get_min_x (Spline *); -struct _spline +struct LIBARDOUR_API _spline { float *deriv2; float *x; diff --git a/libs/ardour/ardour/stretch.h b/libs/ardour/ardour/stretch.h index 066ed7861a..edca5fc44b 100644 --- a/libs/ardour/ardour/stretch.h +++ b/libs/ardour/ardour/stretch.h @@ -33,7 +33,7 @@ namespace ARDOUR { -class RBStretch : public RBEffect { +class LIBARDOUR_API RBStretch : public RBEffect { public: RBStretch (ARDOUR::Session&, TimeFXRequest&); ~RBStretch() {} @@ -47,7 +47,7 @@ class RBStretch : public RBEffect { namespace ARDOUR { -class STStretch : public Filter { +class LIBARDOUR_API STStretch : public Filter { public: STStretch (ARDOUR::Session&, TimeFXRequest&); ~STStretch (); diff --git a/libs/ardour/ardour/strip_silence.h b/libs/ardour/ardour/strip_silence.h index eed4320173..59f4ea0a57 100644 --- a/libs/ardour/ardour/strip_silence.h +++ b/libs/ardour/ardour/strip_silence.h @@ -22,7 +22,7 @@ namespace ARDOUR { /// A filter to strip silence from regions -class StripSilence : public Filter +class LIBARDOUR_API StripSilence : public Filter { public: StripSilence (Session &, const AudioIntervalMap&, framecnt_t fade_length); diff --git a/libs/ardour/ardour/tape_file_matcher.h b/libs/ardour/ardour/tape_file_matcher.h index 6c8392f46f..623bd406a8 100644 --- a/libs/ardour/ardour/tape_file_matcher.h +++ b/libs/ardour/ardour/tape_file_matcher.h @@ -23,9 +23,11 @@ #include <regex.h> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { -class TapeFileMatcher +class LIBARDOUR_API TapeFileMatcher { public: diff --git a/libs/ardour/ardour/template_utils.h b/libs/ardour/ardour/template_utils.h index e01a62bbd1..dc56c53c44 100644 --- a/libs/ardour/ardour/template_utils.h +++ b/libs/ardour/ardour/template_utils.h @@ -24,23 +24,25 @@ #include <string> #include <vector> +#include "ardour/libardour_visibility.h" + namespace ARDOUR { - std::string system_template_directory (); - std::string system_route_template_directory (); + LIBARDOUR_API std::string system_template_directory (); + LIBARDOUR_API std::string system_route_template_directory (); - std::string user_template_directory (); - std::string user_route_template_directory (); + LIBARDOUR_API std::string user_template_directory (); + LIBARDOUR_API std::string user_route_template_directory (); - struct TemplateInfo { + struct LIBARDOUR_API TemplateInfo { std::string name; std::string path; }; - void find_route_templates (std::vector<TemplateInfo>& template_names); - void find_session_templates (std::vector<TemplateInfo>& template_names); + LIBARDOUR_API void find_route_templates (std::vector<TemplateInfo>& template_names); + LIBARDOUR_API void find_session_templates (std::vector<TemplateInfo>& template_names); - std::string session_template_dir_to_file (std::string const &); + LIBARDOUR_API std::string session_template_dir_to_file (std::string const &); } // namespace ARDOUR diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index bedc825288..8fa5ed45a0 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -45,7 +45,7 @@ class Meter; class TempoMap; /** Tempo, the speed at which musical time progresses (BPM). */ -class Tempo { +class LIBARDOUR_API Tempo { public: Tempo (double bpm, double type=4.0) // defaulting to quarter note : _beats_per_minute (bpm), _note_type(type) {} @@ -62,7 +62,7 @@ class Tempo { }; /** Meter, or time signature (beats per bar, and which note type is a beat). */ -class Meter { +class LIBARDOUR_API Meter { public: Meter (double dpb, double bt) : _divisions_per_bar (dpb), _note_type (bt) {} @@ -87,7 +87,7 @@ class Meter { }; /** A section of timeline with a certain Tempo or Meter. */ -class MetricSection { +class LIBARDOUR_API MetricSection { public: MetricSection (const Timecode::BBT_Time& start) : _start (start), _frame (0), _movable (true) {} @@ -123,7 +123,7 @@ class MetricSection { }; /** A section of timeline with a certain Meter. */ -class MeterSection : public MetricSection, public Meter { +class LIBARDOUR_API MeterSection : public MetricSection, public Meter { public: MeterSection (const Timecode::BBT_Time& start, double bpb, double note_type) : MetricSection (start), Meter (bpb, note_type) {} @@ -137,7 +137,7 @@ class MeterSection : public MetricSection, public Meter { }; /** A section of timeline with a certain Tempo. */ -class TempoSection : public MetricSection, public Tempo { +class LIBARDOUR_API TempoSection : public MetricSection, public Tempo { public: TempoSection (const Timecode::BBT_Time& start, double qpm, double note_type) : MetricSection (start), Tempo (qpm, note_type), _bar_offset (-1.0) {} @@ -170,7 +170,7 @@ typedef std::list<MetricSection*> Metrics; /** Helper class to keep track of the Meter *AND* Tempo in effect at a given point in time. */ -class TempoMetric { +class LIBARDOUR_API TempoMetric { public: TempoMetric (const Meter& m, const Tempo& t) : _meter (&m), _tempo (&t), _frame (0) {} @@ -205,7 +205,7 @@ class TempoMetric { Timecode::BBT_Time _start; }; -class TempoMap : public PBD::StatefulDestructible +class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible { public: TempoMap (framecnt_t frame_rate); diff --git a/libs/ardour/ardour/tempo_map_importer.h b/libs/ardour/ardour/tempo_map_importer.h index 57c7402781..28a65218c7 100644 --- a/libs/ardour/ardour/tempo_map_importer.h +++ b/libs/ardour/ardour/tempo_map_importer.h @@ -32,14 +32,14 @@ namespace ARDOUR { class Session; -class TempoMapImportHandler : public ElementImportHandler +class LIBARDOUR_API TempoMapImportHandler : public ElementImportHandler { public: TempoMapImportHandler (XMLTree const & source, Session & session); std::string get_info () const; }; -class TempoMapImporter : public ElementImporter +class LIBARDOUR_API TempoMapImporter : public ElementImporter { private: typedef boost::shared_ptr<XMLNode> XMLNodePtr; diff --git a/libs/ardour/ardour/thread_buffers.h b/libs/ardour/ardour/thread_buffers.h index 9d92454887..f30476a474 100644 --- a/libs/ardour/ardour/thread_buffers.h +++ b/libs/ardour/ardour/thread_buffers.h @@ -23,13 +23,14 @@ #include <glibmm/threads.h> #include "ardour/chan_count.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" namespace ARDOUR { class BufferSet; -class ThreadBuffers { +class LIBARDOUR_API ThreadBuffers { public: ThreadBuffers (); ~ThreadBuffers (); diff --git a/libs/ardour/ardour/ticker.h b/libs/ardour/ardour/ticker.h index 7f0d1987fc..0e5c3c80f4 100644 --- a/libs/ardour/ardour/ticker.h +++ b/libs/ardour/ardour/ticker.h @@ -23,6 +23,7 @@ #include "pbd/signals.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" #include "ardour/session_handle.h" @@ -35,7 +36,7 @@ namespace ARDOUR { class Session; class MidiPort; -class MidiClockTicker : public SessionHandlePtr, boost::noncopyable +class LIBARDOUR_API MidiClockTicker : public SessionHandlePtr, boost::noncopyable { public: MidiClockTicker (); diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index bdf420763b..2a6d3f7ad4 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -35,7 +35,7 @@ class Region; class Diskstream; class IO; -class Track : public Route, public PublicDiskstream +class LIBARDOUR_API Track : public Route, public PublicDiskstream { public: Track (Session&, std::string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO); diff --git a/libs/ardour/ardour/transient_detector.h b/libs/ardour/ardour/transient_detector.h index 322e4cbc75..0e07c5851a 100644 --- a/libs/ardour/ardour/transient_detector.h +++ b/libs/ardour/ardour/transient_detector.h @@ -28,7 +28,7 @@ class AudioSource; class Readable; class Session; -class TransientDetector : public AudioAnalyser +class LIBARDOUR_API TransientDetector : public AudioAnalyser { public: TransientDetector (float sample_rate); diff --git a/libs/ardour/ardour/trimmable.h b/libs/ardour/ardour/trimmable.h index 071e3d151a..07e2c809a3 100644 --- a/libs/ardour/ardour/trimmable.h +++ b/libs/ardour/ardour/trimmable.h @@ -22,7 +22,7 @@ namespace ARDOUR { -class Trimmable { +class LIBARDOUR_API Trimmable { public: Trimmable() {} virtual ~Trimmable() {} diff --git a/libs/ardour/ardour/unknown_processor.h b/libs/ardour/ardour/unknown_processor.h index 61a5734df2..50234e8294 100644 --- a/libs/ardour/ardour/unknown_processor.h +++ b/libs/ardour/ardour/unknown_processor.h @@ -39,7 +39,7 @@ namespace ARDOUR { * session on a machine without a particular plugin will not corrupt * the session. */ -class UnknownProcessor : public Processor +class LIBARDOUR_API UnknownProcessor : public Processor { public: UnknownProcessor (Session &, XMLNode const &); diff --git a/libs/ardour/ardour/uri_map.h b/libs/ardour/ardour/uri_map.h index 18008f0df2..a948ea4002 100644 --- a/libs/ardour/ardour/uri_map.h +++ b/libs/ardour/ardour/uri_map.h @@ -28,6 +28,8 @@ #include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h" #include "lv2/lv2plug.in/ns/ext/urid/urid.h" +#include "ardour/libardour_visibility.h" + namespace ARDOUR { /** Implementation of the LV2 uri-map and urid extensions. @@ -35,7 +37,7 @@ namespace ARDOUR { * This just uses a pair of std::map and is not so great in the space overhead * department, but it's fast enough and not really performance critical anyway. */ -class URIMap : public boost::noncopyable { +class LIBARDOUR_API URIMap : public boost::noncopyable { public: URIMap(); diff --git a/libs/ardour/ardour/user_bundle.h b/libs/ardour/ardour/user_bundle.h index 5ecfe521f5..4ff435ef35 100644 --- a/libs/ardour/ardour/user_bundle.h +++ b/libs/ardour/ardour/user_bundle.h @@ -29,7 +29,7 @@ namespace ARDOUR { class Session; -class UserBundle : public Bundle, public PBD::Stateful { +class LIBARDOUR_API UserBundle : public Bundle, public PBD::Stateful { public: UserBundle (std::string const &); diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 4bf97fd2e5..6dba01c797 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -32,18 +32,19 @@ #include <CoreFoundation/CoreFoundation.h> #endif /* __APPLE__ */ +#include "ardour/libardour_visibility.h" #include "ardour/ardour.h" #include "ardour/data_type.h" #include "ardour/dB.h" class XMLNode; -std::string legalize_for_path (const std::string& str); -std::string legalize_for_universal_path (const std::string& str); -std::string legalize_for_uri (const std::string& str); -std::string legalize_for_path_2X (const std::string& str); -XMLNode* find_named_node (const XMLNode& node, std::string name); -std::string bool_as_string (bool); +LIBARDOUR_API std::string legalize_for_path (const std::string& str); +LIBARDOUR_API std::string legalize_for_universal_path (const std::string& str); +LIBARDOUR_API std::string legalize_for_uri (const std::string& str); +LIBARDOUR_API std::string legalize_for_path_2X (const std::string& str); +LIBARDOUR_API XMLNode* find_named_node (const XMLNode& node, std::string name); +LIBARDOUR_API std::string bool_as_string (bool); static inline float f_max(float x, float a) { x -= a; @@ -54,23 +55,23 @@ static inline float f_max(float x, float a) { return (x); } -std::string bump_name_once(const std::string& s, char delimiter); +LIBARDOUR_API std::string bump_name_once(const std::string& s, char delimiter); -int cmp_nocase (const std::string& s, const std::string& s2); -int cmp_nocase_utf8 (const std::string& s1, const std::string& s2); +LIBARDOUR_API int cmp_nocase (const std::string& s, const std::string& s2); +LIBARDOUR_API int cmp_nocase_utf8 (const std::string& s1, const std::string& s2); -int touch_file(std::string path); +LIBARDOUR_API int touch_file(std::string path); -std::string region_name_from_path (std::string path, bool strip_channels, bool add_channel_suffix = false, uint32_t total = 0, uint32_t this_one = 0); -bool path_is_paired (std::string path, std::string& pair_base); +LIBARDOUR_API std::string region_name_from_path (std::string path, bool strip_channels, bool add_channel_suffix = false, uint32_t total = 0, uint32_t this_one = 0); +LIBARDOUR_API bool path_is_paired (std::string path, std::string& pair_base); -void compute_equal_power_fades (ARDOUR::framecnt_t nframes, float* in, float* out); +LIBARDOUR_API void compute_equal_power_fades (ARDOUR::framecnt_t nframes, float* in, float* out); -const char* sync_source_to_string (ARDOUR::SyncSource src, bool sh = false); -ARDOUR::SyncSource string_to_sync_source (std::string str); +LIBARDOUR_API const char* sync_source_to_string (ARDOUR::SyncSource src, bool sh = false); +LIBARDOUR_API ARDOUR::SyncSource string_to_sync_source (std::string str); -const char* edit_mode_to_string (ARDOUR::EditMode); -ARDOUR::EditMode string_to_edit_mode (std::string); +LIBARDOUR_API const char* edit_mode_to_string (ARDOUR::EditMode); +LIBARDOUR_API ARDOUR::EditMode string_to_edit_mode (std::string); #undef OLD_GAIN_MATH #define OLD_GAIN_MATH @@ -142,8 +143,8 @@ slider_position_to_gain (double pos) } #undef OLD_GAIN_MATH -double gain_to_slider_position_with_max (double g, double max_gain = 2.0); -double slider_position_to_gain_with_max (double g, double max_gain = 2.0); +LIBARDOUR_API double gain_to_slider_position_with_max (double g, double max_gain = 2.0); +LIBARDOUR_API double slider_position_to_gain_with_max (double g, double max_gain = 2.0); /* I don't really like hard-coding these falloff rates here * Probably should use a map of some kind that could be configured @@ -160,17 +161,17 @@ double slider_position_to_gain_with_max (double g, double max_gain = 2.0); #define METER_FALLOFF_FASTER 46.0f #define METER_FALLOFF_FASTEST 70.0f -float meter_falloff_to_float (ARDOUR::MeterFalloff); -ARDOUR::MeterFalloff meter_falloff_from_float (float); -float meter_falloff_to_db_per_sec (float); +LIBARDOUR_API float meter_falloff_to_float (ARDOUR::MeterFalloff); +LIBARDOUR_API ARDOUR::MeterFalloff meter_falloff_from_float (float); +LIBARDOUR_API float meter_falloff_to_db_per_sec (float); -const char* native_header_format_extension (ARDOUR::HeaderFormat, const ARDOUR::DataType& type); -bool matching_unsuffixed_filename_exists_in (const std::string& dir, const std::string& name); +LIBARDOUR_API const char* native_header_format_extension (ARDOUR::HeaderFormat, const ARDOUR::DataType& type); +LIBARDOUR_API bool matching_unsuffixed_filename_exists_in (const std::string& dir, const std::string& name); -uint32_t how_many_dsp_threads (); +LIBARDOUR_API uint32_t how_many_dsp_threads (); #if __APPLE__ -std::string CFStringRefToStdString(CFStringRef stringRef); +LIBARDOUR_API std::string CFStringRefToStdString(CFStringRef stringRef); #endif // __APPLE__ #endif /* __ardour_utils_h__ */ diff --git a/libs/ardour/ardour/visibility.h b/libs/ardour/ardour/visibility.h deleted file mode 100644 index 09287b877d..0000000000 --- a/libs/ardour/ardour/visibility.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2013 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __libardour_visibility_h__ -#define __libardour_visibility_h__ - -/* _WIN32 is defined by most compilers targetting Windows, but within the - * ardour source tree, we also define COMPILER_MSVC or COMPILER_MINGW depending - * on how a Windows build is built. - */ - -#if defined _WIN32 || defined __CYGWIN__ || defined(COMPILER_MSVC) || defined(COMPILER_MINGW) - #define LIBARDOUR_HELPER_DLL_IMPORT __declspec(dllimport) - #define LIBARDOUR_HELPER_DLL_EXPORT __declspec(dllexport) - #define LIBARDOUR_HELPER_DLL_LOCAL -#else - #if __GNUC__ >= 4 - #define LIBARDOUR_HELPER_DLL_IMPORT __attribute__ ((visibility ("default"))) - #define LIBARDOUR_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) - #define LIBARDOUR_HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden"))) - #else - #define LIBARDOUR_HELPER_DLL_IMPORT - #define LIBARDOUR_HELPER_DLL_EXPORT - #define LIBARDOUR_HELPER_DLL_LOCAL - #endif -#endif - -#endif /* __libardour_visibility_h__ */ diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 7ca973cbb7..942f7192db 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -32,7 +32,7 @@ typedef struct _VSTState VSTState; namespace ARDOUR { /** Parent class for VST plugins of both Windows and Linux varieties */ -class VSTPlugin : public Plugin +class LIBARDOUR_API VSTPlugin : public Plugin { public: VSTPlugin (AudioEngine &, Session &, VSTHandle *); diff --git a/libs/ardour/ardour/vst_types.h b/libs/ardour/ardour/vst_types.h index d185d62606..47308aff73 100644 --- a/libs/ardour/ardour/vst_types.h +++ b/libs/ardour/ardour/vst_types.h @@ -20,9 +20,10 @@ #ifndef __ardour_vst_types_h__ #define __ardour_vst_types_h__ +#include "ardour/libardour_visibility.h" #include "ardour/vestige/aeffectx.h" -struct _VSTKey +struct LIBARDOUR_API _VSTKey { /** virtual-key code, or 0 if this _VSTFXKey is a `character' key */ int special; @@ -32,7 +33,7 @@ struct _VSTKey typedef struct _VSTKey VSTKey; -struct _VSTInfo +struct LIBARDOUR_API _VSTInfo { char *name; char *creator; @@ -56,7 +57,7 @@ typedef struct _VSTInfo VSTInfo; typedef AEffect * (* main_entry_t) (audioMasterCallback); -struct _VSTHandle +struct LIBARDOUR_API _VSTHandle { void* dll; char* name; @@ -69,7 +70,7 @@ struct _VSTHandle typedef struct _VSTHandle VSTHandle; -struct _VSTState +struct LIBARDOUR_API _VSTState { AEffect* plugin; diff --git a/libs/ardour/ardour/vumeterdsp.h b/libs/ardour/ardour/vumeterdsp.h index 3169dca12e..1271276d68 100644 --- a/libs/ardour/ardour/vumeterdsp.h +++ b/libs/ardour/ardour/vumeterdsp.h @@ -20,8 +20,9 @@ #ifndef __VUMETERDSP_H #define __VUMETERDSP_H +#include "ardour/libardour_visibility.h" -class Vumeterdsp +class LIBARDOUR_API Vumeterdsp { public: diff --git a/libs/ardour/ardour/windows_vst_plugin.h b/libs/ardour/ardour/windows_vst_plugin.h index 83bc113a00..ee4850dc05 100644 --- a/libs/ardour/ardour/windows_vst_plugin.h +++ b/libs/ardour/ardour/windows_vst_plugin.h @@ -22,7 +22,7 @@ #include "ardour/vst_plugin.h" -struct _VSTHandle; +struct LIBARDOUR_API _VSTHandle; typedef struct _VSTHandle VSTHandle; namespace ARDOUR { @@ -30,7 +30,7 @@ namespace ARDOUR { class AudioEngine; class Session; -class WindowsVSTPlugin : public VSTPlugin +class LIBARDOUR_API WindowsVSTPlugin : public VSTPlugin { public: WindowsVSTPlugin (AudioEngine &, Session &, VSTHandle *); @@ -40,7 +40,7 @@ public: std::string state_node_name () const { return "windows-vst"; } }; -class WindowsVSTPluginInfo : public PluginInfo +class LIBARDOUR_API WindowsVSTPluginInfo : public PluginInfo { public: WindowsVSTPluginInfo (); diff --git a/libs/ardour/ardour/worker.h b/libs/ardour/ardour/worker.h index 4f3ff54bc1..c9ff2f2d7f 100644 --- a/libs/ardour/ardour/worker.h +++ b/libs/ardour/ardour/worker.h @@ -27,12 +27,14 @@ #include "pbd/ringbuffer.h" #include "pbd/semaphore.h" +#include "ardour/libardour_visibility.h" + namespace ARDOUR { /** An object that needs to schedule non-RT work in the audio thread. */ -class Workee { +class LIBARDOUR_API Workee { public: virtual ~Workee() {} @@ -50,7 +52,7 @@ public: /** A worker thread for non-realtime tasks scheduled in the audio thread. */ -class Worker +class LIBARDOUR_API Worker { public: Worker(Workee* workee, uint32_t ring_size); diff --git a/libs/ardour/async_midi_port.cc b/libs/ardour/async_midi_port.cc index 5bc8e22833..bd583328c3 100644 --- a/libs/ardour/async_midi_port.cc +++ b/libs/ardour/async_midi_port.cc @@ -19,6 +19,9 @@ */ #include <iostream> +#include <vector> + +#include <glibmm/timer.h> #include "pbd/error.h" #include "pbd/stacktrace.h" @@ -35,7 +38,7 @@ using namespace std; using namespace PBD; namespace Evoral { - template class EventRingBuffer<timestamp_t>; + template class EventRingBuffer<MIDI::timestamp_t>; } pthread_t AsyncMIDIPort::_process_thread; @@ -49,7 +52,9 @@ AsyncMIDIPort::AsyncMIDIPort (string const & name, PortFlags flags) , _last_write_timestamp (0) , output_fifo (512) , input_fifo (1024) +#ifndef PLATFORM_WINDOWS , xthread (true) +#endif { } @@ -58,7 +63,7 @@ AsyncMIDIPort::~AsyncMIDIPort () } void -AsyncMIDIPort::flush_output_fifo (pframes_t nframes) +AsyncMIDIPort::flush_output_fifo (MIDI::pframes_t nframes) { RingBuffer< Evoral::Event<double> >::rw_vector vec = { { 0, 0 }, { 0, 0 } }; size_t written; @@ -89,7 +94,7 @@ AsyncMIDIPort::flush_output_fifo (pframes_t nframes) } void -AsyncMIDIPort::cycle_start (pframes_t nframes) +AsyncMIDIPort::cycle_start (MIDI::pframes_t nframes) { _currently_in_cycle = true; MidiPort::cycle_start (nframes); @@ -113,16 +118,17 @@ AsyncMIDIPort::cycle_start (pframes_t nframes) for (MidiBuffer::iterator b = mb.begin(); b != mb.end(); ++b) { input_fifo.write (when, (Evoral::EventType) 0, (*b).size(), (*b).buffer()); } - + +#ifndef PLATFORM_WINDOWS if (!mb.empty()) { xthread.wakeup (); } +#endif } - } void -AsyncMIDIPort::cycle_end (pframes_t nframes) +AsyncMIDIPort::cycle_end (MIDI::pframes_t nframes) { if (ARDOUR::Port::sends_output()) { /* move any additional data from output FIFO into the port @@ -161,12 +167,12 @@ AsyncMIDIPort::drain (int check_interval_usecs) if (vec.len[0] + vec.len[1] >= output_fifo.bufsize() - 1) { break; } - usleep (check_interval_usecs); + Glib::usleep (check_interval_usecs); } } int -AsyncMIDIPort::write (const byte * msg, size_t msglen, timestamp_t timestamp) +AsyncMIDIPort::write (const MIDI::byte * msg, size_t msglen, MIDI::timestamp_t timestamp) { int ret = 0; @@ -219,7 +225,7 @@ AsyncMIDIPort::write (const byte * msg, size_t msglen, timestamp_t timestamp) } if (timestamp >= _cycle_nframes) { - std::cerr << "attempting to write MIDI event of " << msglen << " bytes at time " + std::cerr << "attempting to write MIDI event of " << msglen << " MIDI::bytes at time " << timestamp << " of " << _cycle_nframes << " (this will not work - needs a code fix)" << std::endl; @@ -268,9 +274,9 @@ AsyncMIDIPort::read (MIDI::byte *, size_t) timestamp_t time; Evoral::EventType type; uint32_t size; - byte buffer[input_fifo.capacity()]; + vector<MIDI::byte> buffer(input_fifo.capacity()); - while (input_fifo.read (&time, &type, &size, buffer)) { + while (input_fifo.read (&time, &type, &size, &buffer[0])) { _parser->set_timestamp (time); for (uint32_t i = 0; i < size; ++i) { _parser->scanner (buffer[i]); @@ -281,7 +287,7 @@ AsyncMIDIPort::read (MIDI::byte *, size_t) } void -AsyncMIDIPort::parse (framecnt_t) +AsyncMIDIPort::parse (MIDI::framecnt_t) { MIDI::byte buf[1]; diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index a9f9f40d64..dd2dcf324e 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -27,8 +27,6 @@ #include <fcntl.h> #include <cstdlib> #include <ctime> -#include <sys/stat.h> -#include <sys/mman.h> #include "pbd/error.h" #include "pbd/xml++.h" @@ -925,7 +923,7 @@ AudioDiskstream::internal_playback_seek (framecnt_t distance) boost::shared_ptr<ChannelList> c = channels.reader(); for (chan = c->begin(); chan != c->end(); ++chan) { - (*chan)->playback_buf->increment_read_ptr (std::llabs(distance)); + (*chan)->playback_buf->increment_read_ptr (llabs(distance)); } if (first_recordable_frame < max_framepos) { @@ -1791,7 +1789,7 @@ AudioDiskstream::get_state () LocaleGuard lg (X_("POSIX")); boost::shared_ptr<ChannelList> c = channels.reader(); - snprintf (buf, sizeof(buf), "%zd", c->size()); + snprintf (buf, sizeof(buf), "%u", (unsigned int) c->size()); node.add_property ("channels", buf); if (!capturing_sources.empty() && _session.get_record_enabled()) { diff --git a/libs/ardour/audio_library.cc b/libs/ardour/audio_library.cc index c2b2f1bff7..4a6089dac3 100644 --- a/libs/ardour/audio_library.cc +++ b/libs/ardour/audio_library.cc @@ -17,11 +17,18 @@ */ +#ifdef WAF_BUILD +#include "libardour-config.h" +#endif + #include <sstream> #include <libxml/uri.h> +#ifdef HAVE_LRDF #include <lrdf.h> +#endif + #include <glibmm/miscutils.h> #include <glibmm/convert.h> @@ -57,7 +64,9 @@ AudioLibrary::AudioLibrary () touch_file(sfdb_file_path); +#ifdef HAVE_LRDF lrdf_read_file(src.c_str()); +#endif } AudioLibrary::~AudioLibrary () @@ -67,14 +76,17 @@ AudioLibrary::~AudioLibrary () void AudioLibrary::save_changes () { +#ifdef HAVE_LRDF if (lrdf_export_by_source(src.c_str(), src.substr(5).c_str())) { PBD::warning << string_compose(_("Could not open %1. Audio Library not saved"), src) << endmsg; } +#endif } void AudioLibrary::set_tags (string member, vector<string> tags) { +#ifdef HAVE_LRDF sort (tags.begin(), tags.end()); tags.erase (unique(tags.begin(), tags.end()), tags.end()); @@ -85,12 +97,14 @@ AudioLibrary::set_tags (string member, vector<string> tags) for (vector<string>::iterator i = tags.begin(); i != tags.end(); ++i) { lrdf_add_triple (src.c_str(), file_uri.c_str(), TAG, (*i).c_str(), lrdf_literal); } +#endif } vector<string> AudioLibrary::get_tags (string member) { vector<string> tags; +#ifdef HAVE_LRDF lrdf_statement pattern; pattern.subject = strdup(Glib::filename_to_uri(member).c_str()); @@ -111,13 +125,14 @@ AudioLibrary::get_tags (string member) lrdf_free_statements (matches); sort (tags.begin(), tags.end()); - +#endif return tags; } void AudioLibrary::search_members_and (vector<string>& members, const vector<string>& tags) { +#ifdef HAVE_LRDF lrdf_statement **head; lrdf_statement* pattern = 0; lrdf_statement* old = 0; @@ -153,4 +168,5 @@ AudioLibrary::search_members_and (vector<string>& members, const vector<string>& pattern = pattern->next; delete old; } +#endif } diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 7f77f637a3..a82c109cba 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -315,7 +315,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram if (!lm.locked()) { boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream(); framecnt_t playback_distance = diskstream->calculate_playback_distance(nframes); - if (can_internal_playback_seek(std::llabs(playback_distance))) { + if (can_internal_playback_seek(llabs(playback_distance))) { /* TODO should declick */ internal_playback_seek(playback_distance); } diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 538a905ca2..1a24977399 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -34,6 +34,7 @@ #include <glibmm/threads.h> #include <glibmm/fileutils.h> #include <glibmm/miscutils.h> +#include <glib/gstdio.h> #include "ardour/ardour.h" #include "ardour/audioengine.h" @@ -2453,7 +2454,7 @@ AUPluginInfo::save_cached_info () if (!tree.write (path)) { error << string_compose (_("could not save AU cache to %1"), path) << endmsg; - unlink (path.c_str()); + g_unlink (path.c_str()); } } diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 82564ebaf2..cb167c9595 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -34,8 +34,6 @@ #include "pbd/stacktrace.h" #include "pbd/unknown_type.h" -#include <jack/weakjack.h> - #include "midi++/port.h" #include "midi++/mmc.h" @@ -474,8 +472,17 @@ AudioEngine::discover_backends () Glib::PatternSpec so_extension_pattern("*backend.so"); Glib::PatternSpec dylib_extension_pattern("*backend.dylib"); - Glib::PatternSpec dll_extension_pattern("*backend.dll"); +#if defined(PLATFORM_WINDOWS) && defined(DEBUGGABLE_BACKENDS) + #if defined(DEBUG) || defined(_DEBUG) + Glib::PatternSpec dll_extension_pattern("*backendD.dll"); + #else + Glib::PatternSpec dll_extension_pattern("*backendRDC.dll"); + #endif +#else + Glib::PatternSpec dll_extension_pattern("*backend.dll"); +#endif + find_matching_files_in_search_path (backend_search_path (), so_extension_pattern, backend_modules); diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 13b03f8f48..014baa9031 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -40,6 +40,7 @@ #include <sndfile.h> +#include <glib/gstdio.h> #include <glibmm/miscutils.h> #include <glibmm/fileutils.h> #include <glibmm/threads.h> @@ -133,8 +134,8 @@ AudioFileSource::~AudioFileSource () { DEBUG_TRACE (DEBUG::Destruction, string_compose ("AudioFileSource destructor %1, removable? %2\n", _path, removable())); if (removable()) { - unlink (_path.c_str()); - unlink (peakpath.c_str()); + ::g_unlink (_path.c_str()); + ::g_unlink (peakpath.c_str()); } } @@ -292,7 +293,7 @@ AudioFileSource::mark_streaming_write_completed () int AudioFileSource::move_dependents_to_trash() { - return ::unlink (peakpath.c_str()); + return ::g_unlink (peakpath.c_str()); } void diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index e9b0b1fc07..331de043cd 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -409,14 +409,22 @@ AudioRegion::set_envelope_active (bool yn) } } +/** @param buf Buffer to put peak data in. + * @param npeaks Number of peaks to read (ie the number of PeakDatas in buf) + * @param offset Start position, as an offset from the start of this region's source. + * @param cnt Number of samples to read. + * @param chan_n Channel. + * @param frames_per_pixel Number of samples to use to generate one peak value. + */ + ARDOUR::framecnt_t -AudioRegion::read_peaks (PeakData *buf, framecnt_t npeaks, framecnt_t offset, framecnt_t cnt, uint32_t chan_n, double samples_per_unit) const +AudioRegion::read_peaks (PeakData *buf, framecnt_t npeaks, framecnt_t offset, framecnt_t cnt, uint32_t chan_n, double frames_per_pixel) const { if (chan_n >= _sources.size()) { return 0; } - if (audio_source(chan_n)->read_peaks (buf, npeaks, offset, cnt, samples_per_unit)) { + if (audio_source(chan_n)->read_peaks (buf, npeaks, offset, cnt, frames_per_pixel)) { return 0; } else { if (_scale_amplitude != 1.0f) { @@ -1852,22 +1860,3 @@ AudioRegion::verify_xfade_bounds (framecnt_t len, bool start) } -extern "C" { - - int region_read_peaks_from_c (void *arg, uint32_t npeaks, uint32_t start, uint32_t cnt, intptr_t data, uint32_t n_chan, double samples_per_unit) -{ - return ((AudioRegion *) arg)->read_peaks ((PeakData *) data, (framecnt_t) npeaks, (framepos_t) start, (framecnt_t) cnt, n_chan,samples_per_unit); -} - -uint32_t region_length_from_c (void *arg) -{ - - return ((AudioRegion *) arg)->length(); -} - -uint32_t sourcefile_length_from_c (void *arg, double zoom_factor) -{ - return ( (AudioRegion *) arg)->audio_source()->available_peaks (zoom_factor) ; -} - -} /* extern "C" */ diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index 84a5b687f9..d0b6205cb2 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -17,12 +17,15 @@ */ -#include <sys/stat.h> +#ifdef COMPILER_MSVC +#include <sys/utime.h> +#else #include <unistd.h> +#include <utime.h> +#endif +#include <sys/stat.h> #include <fcntl.h> -#include <poll.h> #include <float.h> -#include <utime.h> #include <cerrno> #include <ctime> #include <cmath> @@ -31,6 +34,12 @@ #include <algorithm> #include <vector> +#include <glib.h> +#include <glib/gstdio.h> + +#include <boost/scoped_array.hpp> +#include <boost/scoped_ptr.hpp> + #include <glibmm/fileutils.h> #include <glibmm/miscutils.h> @@ -42,6 +51,8 @@ #include "i18n.h" +#include "ardour/debug.h" + using namespace std; using namespace ARDOUR; using namespace PBD; @@ -173,9 +184,9 @@ AudioSource::peaks_ready (boost::function<void()> doThisWhenReady, ScopedConnect void AudioSource::touch_peakfile () { - struct stat statbuf; + GStatBuf statbuf; - if (stat (peakpath.c_str(), &statbuf) != 0 || statbuf.st_size == 0) { + if (g_stat (peakpath.c_str(), &statbuf) != 0 || statbuf.st_size == 0) { return; } @@ -184,7 +195,7 @@ AudioSource::touch_peakfile () tbuf.actime = statbuf.st_atime; tbuf.modtime = time ((time_t*) 0); - utime (peakpath.c_str(), &tbuf); + g_utime (peakpath.c_str(), &tbuf); } int @@ -195,7 +206,7 @@ AudioSource::rename_peakfile (string newpath) string oldpath = peakpath; if (Glib::file_test (oldpath, Glib::FILE_TEST_EXISTS)) { - if (rename (oldpath.c_str(), newpath.c_str()) != 0) { + if (g_rename (oldpath.c_str(), newpath.c_str()) != 0) { error << string_compose (_("cannot rename peakfile for %1 from %2 to %3 (%4)"), _name, oldpath, newpath, strerror (errno)) << endmsg; return -1; } @@ -209,17 +220,19 @@ AudioSource::rename_peakfile (string newpath) int AudioSource::initialize_peakfile (string audio_path) { - struct stat statbuf; + GStatBuf statbuf; peakpath = peak_path (audio_path); + DEBUG_TRACE(DEBUG::Peaks, string_compose ("Initialize Peakfile %1 for Audio file %2\n", peakpath, audio_path)); + /* if the peak file should be there, but isn't .... */ if (!empty() && !Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) { peakpath = find_broken_peakfile (peakpath, audio_path); } - if (stat (peakpath.c_str(), &statbuf)) { + if (g_stat (peakpath.c_str(), &statbuf)) { if (errno != ENOENT) { /* it exists in the peaks dir, but there is some kind of error */ @@ -227,7 +240,7 @@ AudioSource::initialize_peakfile (string audio_path) return -1; } - /* peakfile does not exist */ + DEBUG_TRACE(DEBUG::Peaks, string_compose("Peakfile %1 does not exist\n", peakpath)); _peaks_built = false; @@ -236,7 +249,7 @@ AudioSource::initialize_peakfile (string audio_path) /* we found it in the peaks dir, so check it out */ if (statbuf.st_size == 0 || (statbuf.st_size < (off_t) ((length(_timeline_position) / _FPP) * sizeof (PeakData)))) { - // empty + DEBUG_TRACE(DEBUG::Peaks, string_compose("Peakfile %1 is empty\n", peakpath)); _peaks_built = false; } else { // Check if the audio file has changed since the peakfile was built. @@ -248,6 +261,7 @@ AudioSource::initialize_peakfile (string audio_path) /* no audio path - nested source or we can't read it or ... whatever, use the peakfile as-is. */ + DEBUG_TRACE(DEBUG::Peaks, string_compose("Error when calling stat on Peakfile %1\n", peakpath)); _peaks_built = true; _peak_byte_max = statbuf.st_size; @@ -316,33 +330,20 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t int32_t to_read; uint32_t nread; framecnt_t zero_fill = 0; - int ret = -1; - PeakData* staging = 0; - Sample* raw_staging = 0; - FdFileDescriptor* peakfile_descriptor = new FdFileDescriptor (peakpath, false, 0664); + boost::scoped_ptr<FdFileDescriptor> peakfile_descriptor(new FdFileDescriptor (peakpath, false, 0664)); int peakfile_fd = -1; expected_peaks = (cnt / (double) samples_per_file_peak); scale = npeaks/expected_peaks; -#undef DEBUG_READ_PEAKS -#ifdef DEBUG_READ_PEAKS - cerr << "======>RP: npeaks = " << npeaks - << " start = " << start - << " cnt = " << cnt - << " len = " << _length - << " samples_per_visual_peak =" << samples_per_visual_peak - << " expected was " << expected_peaks << " ... scale = " << scale - << " PD ptr = " << peaks - <<endl; - -#endif + DEBUG_TRACE (DEBUG::Peaks, string_compose (" ======>RP: npeaks = %1 start = %2 cnt = %3 len = %4 samples_per_visual_peak = %5 expected was %6 ... scale = %7 PD ptr = %8\n" + , npeaks, start, cnt, _length, samples_per_visual_peak, expected_peaks, scale, peaks)); /* fix for near-end-of-file conditions */ if (cnt > _length - start) { - // cerr << "too close to end @ " << _length << " given " << start << " + " << cnt << endl; + // cerr << "too close to end @ " << _length << " given " << start << " + " << cnt << " (" << _length - start << ")" << endl; cnt = _length - start; framecnt_t old = npeaks; npeaks = min ((framecnt_t) floor (cnt / samples_per_visual_peak), npeaks); @@ -353,16 +354,15 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t if (npeaks == cnt) { -#ifdef DEBUG_READ_PEAKS - cerr << "RAW DATA\n"; -#endif + DEBUG_TRACE (DEBUG::Peaks, "RAW DATA\n"); + /* no scaling at all, just get the sample data and duplicate it for both max and min peak values. */ - Sample* raw_staging = new Sample[cnt]; + boost::scoped_array<Sample> raw_staging(new Sample[cnt]); - if (read_unlocked (raw_staging, start, cnt) != cnt) { + if (read_unlocked (raw_staging.get(), start, cnt) != cnt) { error << _("cannot read sample data for unscaled peak computation") << endmsg; return -1; } @@ -372,43 +372,35 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t peaks[i].min = raw_staging[i]; } - delete peakfile_descriptor; - delete [] raw_staging; return 0; } if (scale == 1.0) { + off_t offset = 0; off_t first_peak_byte = (start / samples_per_file_peak) * sizeof (PeakData); - + ssize_t bytes_to_read = sizeof (PeakData)* npeaks; /* open, read, close */ if ((peakfile_fd = peakfile_descriptor->allocate ()) < 0) { error << string_compose(_("AudioSource: cannot open peakpath (a) \"%1\" (%2)"), peakpath, strerror (errno)) << endmsg; - delete peakfile_descriptor; return -1; } -#ifdef DEBUG_READ_PEAKS - cerr << "DIRECT PEAKS\n"; -#endif + DEBUG_TRACE (DEBUG::Peaks, "DIRECT PEAKS\n"); - nread = ::pread (peakfile_fd, peaks, sizeof (PeakData)* npeaks, first_peak_byte); - - if (nread != sizeof (PeakData) * npeaks) { - cerr << "AudioSource[" - << _name - << "]: cannot read peaks from peakfile! (read only " - << nread - << " not " - << npeaks - << "at sample " - << start - << " = byte " - << first_peak_byte - << ')' - << endl; - delete peakfile_descriptor; + offset = lseek (peakfile_fd, first_peak_byte, SEEK_SET); + + if (offset != first_peak_byte) { + error << string_compose(_("AudioSource: could not seek to correct location in peak file \"%1\" (%2)"), peakpath, strerror (errno)) << endmsg; + return -1; + } + + nread = ::read (peakfile_fd, peaks, bytes_to_read); + + if (nread != bytes_to_read) { + DEBUG_TRACE (DEBUG::Peaks, string_compose ("[%1]: Cannot read peaks from peakfile! (read only %2 not %3 at sample %4 = byte %5 )\n" + , _name, nread, npeaks, start, first_peak_byte)); return -1; } @@ -416,7 +408,6 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t memset (&peaks[npeaks], 0, sizeof (PeakData) * zero_fill); } - delete peakfile_descriptor; return 0; } @@ -425,9 +416,8 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t if (scale < 1.0) { -#ifdef DEBUG_READ_PEAKS - cerr << "DOWNSAMPLE\n"; -#endif + DEBUG_TRACE (DEBUG::Peaks, "DOWNSAMPLE\n"); + /* the caller wants: - more frames-per-peak (lower resolution) than the peakfile, or to put it another way, @@ -440,7 +430,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t const framecnt_t chunksize = (framecnt_t) min (expected_peaks, 65536.0); - staging = new PeakData[chunksize]; + boost::scoped_array<PeakData> staging(new PeakData[chunksize]); /* compute the rounded up frame position */ @@ -461,8 +451,6 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t if ((peakfile_fd = peakfile_descriptor->allocate ()) < 0) { error << string_compose(_("AudioSource: cannot open peakpath (b) \"%1\" (%2)"), peakpath, strerror (errno)) << endmsg; - delete peakfile_descriptor; - delete [] staging; return 0; } @@ -473,33 +461,27 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t uint32_t start_byte = current_stored_peak * sizeof(PeakData); tnp = min ((framecnt_t)(_length/samples_per_file_peak - current_stored_peak), (framecnt_t) expected_peaks); to_read = min (chunksize, tnp); + ssize_t bytes_to_read = sizeof (PeakData) * to_read; -#ifdef DEBUG_READ_PEAKS - cerr << "read " << sizeof (PeakData) * to_read << " from peakfile @ " << start_byte << endl; -#endif + DEBUG_TRACE (DEBUG::Peaks, string_compose ("reading %1 bytes from peakfile @ %2\n" + , bytes_to_read, start_byte)); - if ((nread = ::pread (peakfile_fd, staging, sizeof (PeakData) * to_read, start_byte)) - != sizeof (PeakData) * to_read) { - off_t fend = lseek (peakfile_fd, 0, SEEK_END); + off_t offset = lseek (peakfile_fd, start_byte, SEEK_SET); - cerr << "AudioSource[" - << _name - << "]: cannot read peak data from peakfile (" - << (nread / sizeof(PeakData)) - << " peaks instead of " - << to_read - << ") (" - << strerror (errno) - << ')' - << " at start_byte = " << start_byte - << " _length = " << _length << " versus len = " << fend - << " expected maxpeaks = " << (_length - current_frame)/samples_per_file_peak - << " npeaks was " << npeaks - << endl; - goto out; + if (offset != start_byte) { + error << string_compose(_("AudioSource: could not seek to correct location in peak file \"%1\" (%2)"), peakpath, strerror (errno)) << endmsg; + return -1; } + if ((nread = ::read (peakfile_fd, staging.get(), bytes_to_read)) != bytes_to_read) { + + off_t fend = lseek (peakfile_fd, 0, SEEK_END); + + DEBUG_TRACE (DEBUG::Peaks, string_compose ("[%1]: cannot read peak data from peakfile (%2 peaks instead of %3) (%4) at start_byte = %5 _length = %6 versus len = %7 expected maxpeaks = %8 npeaks was %9" + , _name, (nread / sizeof(PeakData)), to_read, g_strerror (errno), start_byte, _length, fend, ((_length - current_frame)/samples_per_file_peak), npeaks)); + return -1; + } i = 0; stored_peaks_read = nread / sizeof(PeakData); } @@ -527,16 +509,14 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t } if (zero_fill) { + cerr << "Zero fill end of peaks (@ " << npeaks << " with " << zero_fill << endl; memset (&peaks[npeaks], 0, sizeof (PeakData) * zero_fill); } - ret = 0; - } else { -#ifdef DEBUG_READ_PEAKS - cerr << "UPSAMPLE\n"; -#endif + DEBUG_TRACE (DEBUG::Peaks, "UPSAMPLE\n"); + /* the caller wants - less frames-per-peak (more resolution) @@ -551,7 +531,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t framecnt_t i = 0; framecnt_t nvisual_peaks = 0; framecnt_t chunksize = (framecnt_t) min (cnt, (framecnt_t) 4096); - raw_staging = new Sample[chunksize]; + boost::scoped_array<Sample> raw_staging(new Sample[chunksize]); framepos_t frame_pos = start; double pixel_pos = floor (frame_pos / samples_per_visual_peak); @@ -576,18 +556,18 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t this loop early */ - memset (raw_staging, 0, sizeof (Sample) * chunksize); + memset (raw_staging.get(), 0, sizeof (Sample) * chunksize); } else { to_read = min (chunksize, (_length - current_frame)); - if ((frames_read = read_unlocked (raw_staging, current_frame, to_read)) == 0) { + if ((frames_read = read_unlocked (raw_staging.get(), current_frame, to_read)) == 0) { error << string_compose(_("AudioSource[%1]: peak read - cannot read %2 samples at offset %3 of %4 (%5)"), _name, to_read, current_frame, _length, strerror (errno)) << endmsg; - goto out; + return -1; } } @@ -615,32 +595,19 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t if (zero_fill) { memset (&peaks[npeaks], 0, sizeof (PeakData) * zero_fill); } - - ret = 0; } - out: - delete peakfile_descriptor; - - delete [] staging; - delete [] raw_staging; - -#ifdef DEBUG_READ_PEAKS - cerr << "RP DONE\n"; -#endif - - return ret; + DEBUG_TRACE (DEBUG::Peaks, "READPEAKS DONE\n"); + return 0; } -#undef DEBUG_PEAK_BUILD - int AudioSource::build_peaks_from_scratch () { - Sample* buf = 0; - const framecnt_t bufsize = 65536; // 256kB per disk read for mono data is about ideal + DEBUG_TRACE (DEBUG::Peaks, "Building peaks from scratch\n"); + int ret = -1; { @@ -656,20 +623,20 @@ AudioSource::build_peaks_from_scratch () framecnt_t cnt = _length; _peaks_built = false; - buf = new Sample[bufsize]; + boost::scoped_array<Sample> buf(new Sample[bufsize]); while (cnt) { framecnt_t frames_to_read = min (bufsize, cnt); framecnt_t frames_read; - if ((frames_read = read_unlocked (buf, current_frame, frames_to_read)) != frames_to_read) { + if ((frames_read = read_unlocked (buf.get(), current_frame, frames_to_read)) != frames_to_read) { error << string_compose(_("%1: could not write read raw data for peak computation (%2)"), _name, strerror (errno)) << endmsg; done_with_peakfile_writes (false); goto out; } - if (compute_and_write_peaks (buf, current_frame, frames_read, true, false, _FPP)) { + if (compute_and_write_peaks (buf.get(), current_frame, frames_read, true, false, _FPP)) { break; } @@ -690,11 +657,10 @@ AudioSource::build_peaks_from_scratch () out: if (ret) { - unlink (peakpath.c_str()); + DEBUG_TRACE (DEBUG::Peaks, string_compose("Could not write peak data, attempting to remove peakfile %1\n", peakpath)); + ::g_unlink (peakpath.c_str()); } - delete [] buf; - return ret; } @@ -738,15 +704,13 @@ int AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt, bool force, bool intermediate_peaks_ready, framecnt_t fpp) { - Sample* buf2 = 0; framecnt_t to_do; uint32_t peaks_computed; - PeakData* peakbuf = 0; - int ret = -1; framepos_t current_frame; framecnt_t frames_done; const size_t blocksize = (128 * 1024); off_t first_peak_byte; + boost::scoped_array<Sample> buf2; if (_peakfile_descriptor == 0) { prepare_for_peakfile_writes (); @@ -769,9 +733,16 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame off_t byte = (peak_leftover_frame / fpp) * sizeof (PeakData); - if (::pwrite (_peakfile_fd, &x, sizeof (PeakData), byte) != sizeof (PeakData)) { + off_t offset = lseek (_peakfile_fd, byte, SEEK_SET); + + if (offset != byte) { + error << string_compose(_("%1: could not seek in peak file data (%2)"), _name, strerror (errno)) << endmsg; + return -1; + } + + if (::write (_peakfile_fd, &x, sizeof (PeakData)) != sizeof (PeakData)) { error << string_compose(_("%1: could not write peak file data (%2)"), _name, strerror (errno)) << endmsg; - goto out; + return -1; } _peak_byte_max = max (_peak_byte_max, (off_t) (byte + sizeof(PeakData))); @@ -797,19 +768,19 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame /* make a new contiguous buffer containing leftovers and the new stuff */ to_do = cnt + peak_leftover_cnt; - buf2 = new Sample[to_do]; + buf2.reset(new Sample[to_do]); /* the remnants */ - memcpy (buf2, peak_leftovers, peak_leftover_cnt * sizeof (Sample)); + memcpy (buf2.get(), peak_leftovers, peak_leftover_cnt * sizeof (Sample)); /* the new stuff */ - memcpy (buf2+peak_leftover_cnt, buf, cnt * sizeof (Sample)); + memcpy (buf2.get()+peak_leftover_cnt, buf, cnt * sizeof (Sample)); /* no more leftovers */ peak_leftover_cnt = 0; /* use the temporary buffer */ - buf = buf2; + buf = buf2.get(); /* make sure that when we write into the peakfile, we startup where we left off */ @@ -819,7 +790,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame to_do = cnt; } - peakbuf = new PeakData[(to_do/fpp)+1]; + boost::scoped_array<PeakData> peakbuf(new PeakData[(to_do/fpp)+1]); peaks_computed = 0; current_frame = first_frame; frames_done = 0; @@ -876,18 +847,31 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame off_t target_length = blocksize * ((first_peak_byte + blocksize + 1) / blocksize); if (endpos < target_length) { + DEBUG_TRACE(DEBUG::Peaks, string_compose ("Truncating Peakfile %1\n", peakpath)); if (ftruncate (_peakfile_fd, target_length)) { /* error doesn't actually matter so continue on without testing */ } } } - if (::pwrite (_peakfile_fd, peakbuf, sizeof (PeakData) * peaks_computed, first_peak_byte) != (ssize_t) (sizeof (PeakData) * peaks_computed)) { + + off_t offset = lseek(_peakfile_fd, first_peak_byte, SEEK_SET); + + if (offset != first_peak_byte) { + error << string_compose(_("%1: could not seek in peak file data (%2)"), _name, strerror (errno)) << endmsg; + return -1; + } + + ssize_t bytes_to_write = sizeof (PeakData) * peaks_computed; + + ssize_t bytes_written = ::write (_peakfile_fd, peakbuf.get(), bytes_to_write); + + if (bytes_written != bytes_to_write) { error << string_compose(_("%1: could not write peak file data (%2)"), _name, strerror (errno)) << endmsg; - goto out; + return -1; } - _peak_byte_max = max (_peak_byte_max, (off_t) (first_peak_byte + sizeof(PeakData)*peaks_computed)); + _peak_byte_max = max (_peak_byte_max, (off_t) (first_peak_byte + bytes_to_write)); if (frames_done) { Glib::Threads::Mutex::Lock lm (_peaks_ready_lock); @@ -897,13 +881,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame } } - ret = 0; - - out: - delete [] peakbuf; - delete [] buf2; - - return ret; + return 0; } void @@ -920,6 +898,7 @@ AudioSource::truncate_peakfile () off_t end = lseek (_peakfile_fd, 0, SEEK_END); if (end > _peak_byte_max) { + DEBUG_TRACE(DEBUG::Peaks, string_compose ("Truncating Peakfile %1\n", peakpath)); if (ftruncate (_peakfile_fd, _peak_byte_max)) { error << string_compose (_("could not truncate peakfile %1 to %2 (error: %3)"), peakpath, _peak_byte_max, errno) << endmsg; diff --git a/libs/ardour/automation_watch.cc b/libs/ardour/automation_watch.cc index 16e10c95f9..91fe4d38ed 100644 --- a/libs/ardour/automation_watch.cc +++ b/libs/ardour/automation_watch.cc @@ -19,6 +19,8 @@ #include <iostream> +#include <glibmm/timer.h> + #include "pbd/compose.h" #include "ardour/automation_control.h" @@ -134,7 +136,7 @@ void AutomationWatch::thread () { while (_run_thread) { - usleep ((useconds_t) floor (Config->get_automation_interval_msecs() * 1000)); + Glib::usleep ((gulong) floor (Config->get_automation_interval_msecs() * 1000)); timer (); } } diff --git a/libs/ardour/backend_search_path.cc b/libs/ardour/backend_search_path.cc index 9a0425094b..4c5ff40e7d 100644 --- a/libs/ardour/backend_search_path.cc +++ b/libs/ardour/backend_search_path.cc @@ -31,14 +31,14 @@ using namespace PBD; namespace ARDOUR { -SearchPath +Searchpath backend_search_path () { - SearchPath spath(user_config_directory ()); + Searchpath spath(user_config_directory ()); spath += ardour_dll_directory (); spath.add_subdirectory_to_paths(backend_dir_name); - spath += SearchPath(Glib::getenv(backend_env_variable_name)); + spath += Searchpath(Glib::getenv(backend_env_variable_name)); return spath; } diff --git a/libs/ardour/broadcast_info.cc b/libs/ardour/broadcast_info.cc index a7fa41aaf9..a08d2c7991 100644 --- a/libs/ardour/broadcast_info.cc +++ b/libs/ardour/broadcast_info.cc @@ -22,6 +22,7 @@ #include <iostream> #include <sstream> #include <iomanip> +#include <vector> #include <glibmm.h> @@ -37,15 +38,15 @@ namespace ARDOUR static void snprintf_bounded_null_filled (char* target, size_t target_size, char const * fmt, ...) { - char buf[target_size+1]; + std::vector<char> buf(target_size+1); va_list ap; va_start (ap, fmt); - vsnprintf (buf, target_size+1, fmt, ap); + vsnprintf (&buf[0], target_size+1, fmt, ap); va_end (ap); memset (target, 0, target_size); - memcpy (target, buf, target_size); + memcpy (target, &buf[0], target_size); } @@ -84,7 +85,7 @@ BroadcastInfo::set_originator_ref_from_session (Session const & /*session*/) /* random code is 9 digits */ - int random_code = random() % 999999999; + int random_code = g_random_int() % 999999999; /* Serial number is 12 chars */ diff --git a/libs/ardour/butler.cc b/libs/ardour/butler.cc index 03ae7867db..c9eb55a472 100644 --- a/libs/ardour/butler.cc +++ b/libs/ardour/butler.cc @@ -20,7 +20,11 @@ #include <errno.h> #include <fcntl.h> #include <unistd.h> + +#ifndef PLATFORM_WINDOWS #include <poll.h> +#endif + #include "pbd/error.h" #include "pbd/pthread_utils.h" #include "ardour/butler.h" @@ -38,7 +42,7 @@ namespace ARDOUR { Butler::Butler(Session& s) : SessionHandleRef (s) - , thread(0) + , thread() , audio_dstream_capture_buffer_size(0) , audio_dstream_playback_buffer_size(0) , midi_dstream_buffer_size(0) @@ -68,25 +72,10 @@ Butler::config_changed (std::string p) } } +#ifndef PLATFORM_WINDOWS int -Butler::start_thread() +Butler::setup_request_pipe () { - const float rate = (float)_session.frame_rate(); - - /* size is in Samples, not bytes */ - audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * rate); - audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * rate); - - /* size is in bytes - * XXX: Jack needs to tell us the MIDI buffer size - * (i.e. how many MIDI bytes we might see in a cycle) - */ - midi_dstream_buffer_size = (uint32_t) floor (Config->get_midi_track_buffer_seconds() * rate); - - MidiDiskstream::set_readahead_frames ((framecnt_t) (Config->get_midi_readahead() * rate)); - - should_run = false; - if (pipe (request_pipe)) { error << string_compose(_("Cannot create transport request signal pipe (%1)"), strerror (errno)) << endmsg; @@ -104,6 +93,32 @@ Butler::start_thread() strerror (errno)) << endmsg; return -1; } + return 0; +} +#endif + +int +Butler::start_thread() +{ + const float rate = (float)_session.frame_rate(); + + /* size is in Samples, not bytes */ + audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * rate); + audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * rate); + + /* size is in bytes + * XXX: Jack needs to tell us the MIDI buffer size + * (i.e. how many MIDI bytes we might see in a cycle) + */ + midi_dstream_buffer_size = (uint32_t) floor (Config->get_midi_track_buffer_seconds() * rate); + + MidiDiskstream::set_readahead_frames ((framecnt_t) (Config->get_midi_readahead() * rate)); + + should_run = false; + +#ifndef PLATFORM_WINDOWS + if (setup_request_pipe() != 0) return -1; +#endif if (pthread_create_and_store ("disk butler", &thread, _thread_work, this)) { error << _("Session: could not create butler thread") << endmsg; @@ -118,12 +133,9 @@ Butler::start_thread() void Butler::terminate_thread () { - if (thread) { - void* status; - const char c = Request::Quit; - (void) ::write (request_pipe[1], &c, 1); - pthread_join (thread, &status); - } + void* status; + queue_request (Request::Quit); + pthread_join (thread, &status); } void * @@ -134,28 +146,25 @@ Butler::_thread_work (void* arg) return ((Butler *) arg)->thread_work (); } -void * -Butler::thread_work () +bool +Butler::wait_for_requests () { - uint32_t err = 0; - +#ifndef PLATFORM_WINDOWS struct pollfd pfd[1]; - bool disk_work_outstanding = false; - RouteList::iterator i; - while (true) { - pfd[0].fd = request_pipe[0]; - pfd[0].events = POLLIN|POLLERR|POLLHUP; + pfd[0].fd = request_pipe[0]; + pfd[0].events = POLLIN|POLLERR|POLLHUP; - if (poll (pfd, 1, (disk_work_outstanding ? 0 : -1)) < 0) { + while(true) { + if (poll (pfd, 1, -1) < 0) { if (errno == EINTR) { continue; } error << string_compose (_("poll on butler request pipe failed (%1)"), - strerror (errno)) - << endmsg; + strerror (errno)) + << endmsg; break; } @@ -165,16 +174,60 @@ Butler::thread_work () } if (pfd[0].revents & POLLIN) { + return true; + } + } + return false; +#else + m_request_sem.wait (); + return true; +#endif +} - char req; +bool +Butler::dequeue_request (Request::Type& r) +{ +#ifndef PLATFORM_WINDOWS + char req; + size_t nread = ::read (request_pipe[0], &req, sizeof (req)); + if (nread == 1) { + r = (Request::Type) req; + return true; + } else if (nread == 0) { + return false; + } else if (errno == EAGAIN) { + return false; + } else { + fatal << _("Error reading from butler request pipe") << endmsg; + /*NOTREACHED*/ + } +#else + r = (Request::Type) m_request_state.get(); +#endif + return false; +} - /* empty the pipe of all current requests */ + void * +Butler::thread_work () +{ + uint32_t err = 0; - while (1) { - size_t nread = ::read (request_pipe[0], &req, sizeof (req)); - if (nread == 1) { + bool disk_work_outstanding = false; + RouteList::iterator i; - switch ((Request::Type) req) { + while (true) { + if(!disk_work_outstanding) { + if (wait_for_requests ()) { + Request::Type req; + + /* empty the pipe of all current requests */ +#ifdef PLATFORM_WINDOWS + dequeue_request (req); + { +#else + while(dequeue_request(req)) { +#endif + switch (req) { case Request::Run: should_run = true; @@ -192,14 +245,6 @@ Butler::thread_work () default: break; } - - } else if (nread == 0) { - break; - } else if (errno == EAGAIN) { - break; - } else { - fatal << _("Error reading from butler request pipe") << endmsg; - /*NOTREACHED*/ } } } @@ -346,18 +391,28 @@ Butler::schedule_transport_work () } void -Butler::summon () +Butler::queue_request (Request::Type r) { - char c = Request::Run; +#ifndef PLATFORM_WINDOWS + char c = r; (void) ::write (request_pipe[1], &c, 1); +#else + m_request_state.set (r); + m_request_sem.post (); +#endif +} + +void +Butler::summon () +{ + queue_request (Request::Run); } void Butler::stop () { Glib::Threads::Mutex::Lock lm (request_lock); - char c = Request::Pause; - (void) ::write (request_pipe[1], &c, 1); + queue_request (Request::Pause); paused.wait(request_lock); } @@ -365,8 +420,7 @@ void Butler::wait_until_finished () { Glib::Threads::Mutex::Lock lm (request_lock); - char c = Request::Pause; - (void) ::write (request_pipe[1], &c, 1); + queue_request (Request::Pause); paused.wait(request_lock); } diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc index 974258a5c2..d9cefb44f2 100644 --- a/libs/ardour/control_protocol_manager.cc +++ b/libs/ardour/control_protocol_manager.cc @@ -17,7 +17,7 @@ */ -#include <dlfcn.h> +#include <glibmm/module.h> #include <glibmm/fileutils.h> @@ -29,8 +29,10 @@ #include "ardour/debug.h" #include "ardour/control_protocol_manager.h" + #include "ardour/control_protocol_search_path.h" + using namespace ARDOUR; using namespace std; using namespace PBD; @@ -211,7 +213,9 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi) } cpi.protocol = 0; - dlclose (cpi.descriptor->module); + delete cpi.state; + cpi.state = 0; + delete (Glib::Module*)cpi.descriptor->module; ProtocolStatusChange (&cpi); @@ -296,7 +300,7 @@ ControlProtocolManager::control_protocol_discover (string path) string_compose(_("Control surface protocol discovered: \"%1\"\n"), cpi->name)); } - dlclose (descriptor->module); + delete (Glib::Module*)descriptor->module; } return 0; @@ -305,31 +309,31 @@ ControlProtocolManager::control_protocol_discover (string path) ControlProtocolDescriptor* ControlProtocolManager::get_descriptor (string path) { - void *module; + Glib::Module* module = new Glib::Module(path); ControlProtocolDescriptor *descriptor = 0; ControlProtocolDescriptor* (*dfunc)(void); - const char *errstr; + void* func = 0; - if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) { - error << string_compose(_("ControlProtocolManager: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg; + if (!(*module)) { + error << string_compose(_("ControlProtocolManager: cannot load module \"%1\" (%2)"), path, Glib::Module::get_last_error()) << endmsg; + delete module; return 0; } - - dfunc = (ControlProtocolDescriptor* (*)(void)) dlsym (module, "protocol_descriptor"); - - if ((errstr = dlerror()) != 0) { + if (!module->get_symbol("protocol_descriptor", func)) { error << string_compose(_("ControlProtocolManager: module \"%1\" has no descriptor function."), path) << endmsg; - error << errstr << endmsg; - dlclose (module); + error << Glib::Module::get_last_error() << endmsg; + delete module; return 0; } + dfunc = (ControlProtocolDescriptor* (*)(void))func; descriptor = dfunc(); + if (descriptor) { - descriptor->module = module; + descriptor->module = (void*)module; } else { - dlclose (module); + delete module; } return descriptor; diff --git a/libs/ardour/control_protocol_search_path.cc b/libs/ardour/control_protocol_search_path.cc index 254cd03fe9..c5c5d0ba00 100644 --- a/libs/ardour/control_protocol_search_path.cc +++ b/libs/ardour/control_protocol_search_path.cc @@ -33,14 +33,14 @@ using namespace PBD; namespace ARDOUR { -SearchPath +Searchpath control_protocol_search_path () { - SearchPath spath(user_config_directory ()); + Searchpath spath(user_config_directory ()); spath += ardour_dll_directory (); spath.add_subdirectory_to_paths (surfaces_dir_name); - spath += SearchPath(Glib::getenv(surfaces_env_variable_name)); + spath += Searchpath(Glib::getenv(surfaces_env_variable_name)); return spath; } diff --git a/libs/ardour/cycle_timer.cc b/libs/ardour/cycle_timer.cc index 02d1abb930..bb4f3181e0 100644 --- a/libs/ardour/cycle_timer.cc +++ b/libs/ardour/cycle_timer.cc @@ -22,6 +22,8 @@ #include "pbd/error.h" #include "ardour/cycle_timer.h" +#include "ardour/libardour_visibility.h" + #include "i18n.h" using namespace std; diff --git a/libs/ardour/debug.cc b/libs/ardour/debug.cc index fb122dd83c..dc762299e9 100644 --- a/libs/ardour/debug.cc +++ b/libs/ardour/debug.cc @@ -31,6 +31,7 @@ uint64_t PBD::DEBUG::MidiDiskstreamIO = PBD::new_debug_bit ("mididiskstreamio"); uint64_t PBD::DEBUG::SnapBBT = PBD::new_debug_bit ("snapbbt"); uint64_t PBD::DEBUG::Configuration = PBD::new_debug_bit ("configuration"); uint64_t PBD::DEBUG::Latency = PBD::new_debug_bit ("latency"); +uint64_t PBD::DEBUG::Peaks = PBD::new_debug_bit ("peaks"); uint64_t PBD::DEBUG::Processors = PBD::new_debug_bit ("processors"); uint64_t PBD::DEBUG::ProcessThreads = PBD::new_debug_bit ("processthreads"); uint64_t PBD::DEBUG::Graph = PBD::new_debug_bit ("graph"); diff --git a/libs/ardour/default_click.cc b/libs/ardour/default_click.cc index fd23f0166d..7e8eca8fd2 100644 --- a/libs/ardour/default_click.cc +++ b/libs/ardour/default_click.cc @@ -21,6 +21,10 @@ #include "ardour/session.h" #include "ardour/types.h" +#ifdef COMPILER_MSVC +#pragma warning(disable:4305) +#endif + using namespace ARDOUR; const Sample Session::default_click_emphasis[] = { diff --git a/libs/ardour/directory_names.cc b/libs/ardour/directory_names.cc index af7f7f550c..f01c024435 100644 --- a/libs/ardour/directory_names.cc +++ b/libs/ardour/directory_names.cc @@ -36,6 +36,7 @@ const char* const export_formats_dir_name = X_("export"); const char* const templates_dir_name = X_("templates"); const char* const route_templates_dir_name = X_("route_templates"); const char* const surfaces_dir_name = X_("surfaces"); +const char* const ladspa_dir_name = X_("ladspa"); const char* const panner_dir_name = X_("panners"); const char* const backend_dir_name = X_("backends"); diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index a359f228e8..e046d5a830 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -29,7 +29,6 @@ #include <cstdlib> #include <ctime> #include <sys/stat.h> -#include <sys/mman.h> #include <glibmm/threads.h> @@ -571,7 +570,7 @@ Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, list< Evora set<Evoral::Parameter> const a = processor->what_can_be_automated (); - for (set<Evoral::Parameter>::iterator i = a.begin (); i != a.end (); ++i) { + for (set<Evoral::Parameter>::const_iterator i = a.begin (); i != a.end (); ++i) { boost::shared_ptr<AutomationList> al = processor->automation_control(*i)->alist(); XMLNode & before = al->get_state (); bool const things_moved = al->move_ranges (movements); @@ -601,7 +600,7 @@ Diskstream::check_record_status (framepos_t transport_frame, bool can_record) */ rolling = _session.transport_speed() != 0.0f; - possibly_recording = (rolling << 2) | (record_enabled() << 1) | can_record; + possibly_recording = (rolling << 2) | ((int)record_enabled() << 1) | (int)can_record; change = possibly_recording ^ last_possibly_recording; if (possibly_recording == last_possibly_recording) { diff --git a/libs/ardour/element_import_handler.cc b/libs/ardour/element_import_handler.cc index c360e82206..8f6483b145 100644 --- a/libs/ardour/element_import_handler.cc +++ b/libs/ardour/element_import_handler.cc @@ -18,6 +18,7 @@ */ +#include "ardour/libardour_visibility.h" #include "ardour/element_import_handler.h" #include <algorithm> diff --git a/libs/ardour/export_channel.cc b/libs/ardour/export_channel.cc index c67f33bb91..296bfc9022 100644 --- a/libs/ardour/export_channel.cc +++ b/libs/ardour/export_channel.cc @@ -239,7 +239,11 @@ RouteExportChannel::read (Sample const *& data, framecnt_t frames) const { assert(processor); AudioBuffer const & buffer = processor->get_capture_buffers().get_audio (channel); +#ifndef NDEBUG + (void) frames; +#else assert (frames <= (framecnt_t) buffer.size()); +#endif data = buffer.data(); } diff --git a/libs/ardour/export_filename.cc b/libs/ardour/export_filename.cc index 9e126ed087..f7fe22c3b4 100644 --- a/libs/ardour/export_filename.cc +++ b/libs/ardour/export_filename.cc @@ -19,7 +19,6 @@ */ #include <string> -#include "ardour/export_filename.h" #include <glibmm/miscutils.h> #include <glibmm/fileutils.h> @@ -28,11 +27,13 @@ #include "pbd/convert.h" #include "pbd/enumwriter.h" +#include "ardour/libardour_visibility.h" #include "ardour/session.h" #include "ardour/session_directory.h" -#include "ardour/export_timespan.h" +#include "ardour/export_filename.h" #include "ardour/export_format_specification.h" #include "ardour/export_channel_configuration.h" +#include "ardour/export_timespan.h" #include "ardour/utils.h" #include "i18n.h" diff --git a/libs/ardour/export_format_base.cc b/libs/ardour/export_format_base.cc index ed8bb9d5f8..1eda449915 100644 --- a/libs/ardour/export_format_base.cc +++ b/libs/ardour/export_format_base.cc @@ -185,7 +185,7 @@ ExportFormatBase::nearest_sample_rate (framecnt_t sample_rate) SampleRate best_match = SR_None; #define DO_SR_COMPARISON(rate) \ - diff = std::fabs((rate) - sample_rate); \ + diff = std::fabs((double)((rate) - sample_rate)); \ if(diff < smallest_diff) { \ smallest_diff = diff; \ best_match = (rate); \ diff --git a/libs/ardour/export_formats_search_path.cc b/libs/ardour/export_formats_search_path.cc index cf18b14a18..ffa096d33a 100644 --- a/libs/ardour/export_formats_search_path.cc +++ b/libs/ardour/export_formats_search_path.cc @@ -32,14 +32,14 @@ using namespace PBD; namespace ARDOUR { -SearchPath +Searchpath export_formats_search_path () { - SearchPath spath (ardour_data_search_path()); + Searchpath spath (ardour_data_search_path()); spath.add_subdirectory_to_paths (export_formats_dir_name); bool export_formats_path_defined = false; - SearchPath spath_env (Glib::getenv(export_env_variable_name, export_formats_path_defined)); + Searchpath spath_env (Glib::getenv(export_env_variable_name, export_formats_path_defined)); if (export_formats_path_defined) { spath += spath_env; diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc index 301914b0ae..2c0c44033d 100644 --- a/libs/ardour/export_graph_builder.cc +++ b/libs/ardour/export_graph_builder.cc @@ -20,6 +20,8 @@ #include "ardour/export_graph_builder.h" +#include <vector> + #include <glibmm/miscutils.h> #include "audiographer/process_context.h" @@ -317,8 +319,8 @@ ExportGraphBuilder::Normalizer::Normalizer (ExportGraphBuilder & parent, FileSpe { std::string tmpfile_path = parent.session.session_directory().export_path(); tmpfile_path = Glib::build_filename(tmpfile_path, "XXXXXX"); - char tmpfile_path_buf[tmpfile_path.size() + 1]; - std::copy(tmpfile_path.begin(), tmpfile_path.end(), tmpfile_path_buf); + std::vector<char> tmpfile_path_buf(tmpfile_path.size() + 1); + std::copy(tmpfile_path.begin(), tmpfile_path.end(), tmpfile_path_buf.begin()); tmpfile_path_buf[tmpfile_path.size()] = '\0'; config = new_config; @@ -334,7 +336,7 @@ ExportGraphBuilder::Normalizer::Normalizer (ExportGraphBuilder & parent, FileSpe normalizer->add_output (threader); int format = ExportFormatBase::F_RAW | ExportFormatBase::SF_Float; - tmp_file.reset (new TmpFile<float> (tmpfile_path_buf, format, channels, config.format->sample_rate())); + tmp_file.reset (new TmpFile<float> (&tmpfile_path_buf[0], format, channels, config.format->sample_rate())); tmp_file->FileWritten.connect_same_thread (post_processing_connection, boost::bind (&Normalizer::start_post_processing, this)); diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index 93f43f33a6..20abc80de1 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -20,6 +20,7 @@ #include "ardour/export_handler.h" +#include <glib/gstdio.h> #include <glibmm.h> #include <glibmm/convert.h> @@ -422,10 +423,10 @@ ExportHandler::export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSp } catch (std::exception& e) { error << string_compose (_("an error occured while writing a TOC/CUE file: %1"), e.what()) << endmsg; - ::unlink (filepath.c_str()); + ::g_unlink (filepath.c_str()); } catch (Glib::Exception& e) { error << string_compose (_("an error occured while writing a TOC/CUE file: %1"), e.what()) << endmsg; - ::unlink (filepath.c_str()); + ::g_unlink (filepath.c_str()); } } diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc index 42e494c0cb..7ff4282c74 100644 --- a/libs/ardour/export_profile_manager.cc +++ b/libs/ardour/export_profile_manager.cc @@ -685,7 +685,7 @@ ExportProfileManager::FormatStatePtr ExportProfileManager::deserialize_format (XMLNode & root) { XMLProperty * prop; - UUID id; + PBD::UUID id; if ((prop = root.property ("id"))) { id = prop->value(); diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index 0921498186..e06b3d624e 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -51,7 +51,7 @@ using namespace ARDOUR; using namespace PBD; using namespace Glib; -PBD::Signal3<int,std::string,std::string,std::vector<std::string> > FileSource::AmbiguousFileName; +PBD::Signal2<int,std::string,std::vector<std::string> > FileSource::AmbiguousFileName; FileSource::FileSource (Session& session, DataType type, const string& path, const string& origin, Source::Flag flag) : Source(session, type, path, flag) @@ -240,19 +240,15 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist isnew = false; if (!Glib::path_is_absolute (path)) { - vector<string> dirs; vector<string> hits; string fullpath; + std::vector<std::string> dirs = s.source_search_path (type); - string search_path = s.source_search_path (type); - - if (search_path.length() == 0) { + if (dirs.size() == 0) { error << _("FileSource: search path not set") << endmsg; goto out; } - split (search_path, dirs, ':'); - hits.clear (); for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) { @@ -296,7 +292,7 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist /* more than one match: ask the user */ - int which = FileSource::AmbiguousFileName (path, search_path, de_duped_hits).get_value_or (-1); + int which = FileSource::AmbiguousFileName (path, de_duped_hits).get_value_or (-1); if (which < 0) { goto out; @@ -310,8 +306,7 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist if (must_exist) { error << string_compose( - _("Filesource: cannot find required file (%1): while searching %2"), - path, search_path) << endmsg; + _("Filesource: cannot find required file (%1)"), path) << endmsg; goto out; } else { isnew = true; @@ -357,8 +352,6 @@ bool FileSource::find_2X (Session& s, DataType type, const string& path, bool must_exist, bool& isnew, uint16_t& chan, string& found_path) { - string search_path = s.source_search_path (type); - string pathstr = path; string::size_type pos; bool ret = false; @@ -369,18 +362,17 @@ FileSource::find_2X (Session& s, DataType type, const string& path, bool must_ex /* non-absolute pathname: find pathstr in search path */ - vector<string> dirs; + vector<string> dirs = s.source_search_path (type); + int cnt; string fullpath; string keeppath; - if (search_path.length() == 0) { + if (dirs.size() == 0) { error << _("FileSource: search path not set") << endmsg; goto out; } - split (search_path, dirs, ':'); - cnt = 0; for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) { @@ -437,16 +429,15 @@ FileSource::find_2X (Session& s, DataType type, const string& path, bool must_ex if (cnt > 1) { error << string_compose ( - _("FileSource: \"%1\" is ambigous when searching %2\n\t"), - pathstr, search_path) << endmsg; + _("FileSource: \"%1\" is ambigous when searching\n\t"), pathstr) << endmsg; goto out; } else if (cnt == 0) { if (must_exist) { error << string_compose( - _("Filesource: cannot find required file (%1): while searching %2"), - pathstr, search_path) << endmsg; + _("Filesource: cannot find required file (%1): while searching") + , pathstr) << endmsg; goto out; } else { isnew = true; @@ -496,13 +487,14 @@ FileSource::find_2X (Session& s, DataType type, const string& path, bool must_ex goto out; } +#ifndef PLATFORM_WINDOWS if (errno != ENOENT) { error << string_compose( _("Filesource: cannot check for existing file (%1): %2"), path, strerror (errno)) << endmsg; goto out; } - +#endif /* a new file */ isnew = true; ret = true; diff --git a/libs/ardour/filesystem_paths.cc b/libs/ardour/filesystem_paths.cc index 73bfaff137..54f7508b65 100644 --- a/libs/ardour/filesystem_paths.cc +++ b/libs/ardour/filesystem_paths.cc @@ -86,49 +86,71 @@ user_config_directory () std::string ardour_dll_directory () { +#ifdef PLATFORM_WINDOWS + std::string dll_dir_path(g_win32_get_package_installation_directory_of_module(NULL)); + dll_dir_path = Glib::build_filename (dll_dir_path, "lib"); + return Glib::build_filename (dll_dir_path, "ardour3"); +#else std::string s = Glib::getenv("ARDOUR_DLL_PATH"); if (s.empty()) { std::cerr << _("ARDOUR_DLL_PATH not set in environment - exiting\n"); ::exit (1); } return s; +#endif +} + +#ifdef PLATFORM_WINDOWS +Searchpath +windows_search_path () +{ + std::string dll_dir_path(g_win32_get_package_installation_directory_of_module(NULL)); + dll_dir_path = Glib::build_filename (dll_dir_path, "share"); + return Glib::build_filename (dll_dir_path, "ardour3"); } +#endif -SearchPath +Searchpath ardour_config_search_path () { - static SearchPath search_path; + static Searchpath search_path; if (search_path.empty()) { search_path += user_config_directory(); - +#ifdef PLATFORM_WINDOWS + search_path += windows_search_path (); +#else std::string s = Glib::getenv("ARDOUR_CONFIG_PATH"); if (s.empty()) { std::cerr << _("ARDOUR_CONFIG_PATH not set in environment - exiting\n"); ::exit (1); } - search_path += SearchPath (s); + search_path += Searchpath (s); +#endif } return search_path; } -SearchPath +Searchpath ardour_data_search_path () { - static SearchPath search_path; + static Searchpath search_path; if (search_path.empty()) { search_path += user_config_directory(); - +#ifdef PLATFORM_WINDOWS + search_path += windows_search_path (); +#else std::string s = Glib::getenv("ARDOUR_DATA_PATH"); if (s.empty()) { std::cerr << _("ARDOUR_DATA_PATH not set in environment - exiting\n"); ::exit (1); } - search_path += SearchPath (s); + search_path += Searchpath (s); +#endif } return search_path; diff --git a/libs/ardour/find_session.cc b/libs/ardour/find_session.cc index f0a034d8d4..501927c42c 100644 --- a/libs/ardour/find_session.cc +++ b/libs/ardour/find_session.cc @@ -27,10 +27,12 @@ #include <glibmm/miscutils.h> #include "pbd/compose.h" +#include "pbd/pathexpand.h" #include "pbd/error.h" #include "ardour/filename_extensions.h" #include "ardour/utils.h" +#include "ardour/session_utils.h" #include "i18n.h" @@ -43,16 +45,10 @@ int find_session (string str, string& path, string& snapshot, bool& isnew) { struct stat statbuf; - char buf[PATH_MAX+1]; isnew = false; - if (!realpath (str.c_str(), buf) && (errno != ENOENT && errno != ENOTDIR)) { - error << string_compose (_("Could not resolve path: %1 (%2)"), buf, strerror(errno)) << endmsg; - return -1; - } - - str = buf; + str = canonical_path (str); /* check to see if it exists, and what it is */ diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 9850d82d31..5874ac3b1b 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -20,12 +20,18 @@ #include "libardour-config.h" #endif +#ifdef interface +#undef interface +#endif + #include <cstdio> // Needed so that libraptor (included in lrdf) won't complain #include <cstdlib> #include <sys/stat.h> #include <sys/types.h> #include <sys/time.h> +#ifndef PLATFORM_WINDOWS #include <sys/resource.h> +#endif #include <unistd.h> #include <fcntl.h> #include <errno.h> @@ -43,7 +49,7 @@ #include "ardour/audio_unit.h" #endif -#ifdef __SSE__ +#if defined(__SSE__) || defined(USE_XMMINTRIN) #include <xmmintrin.h> #endif @@ -54,7 +60,9 @@ #include <glibmm/fileutils.h> #include <glibmm/miscutils.h> +#ifdef HAVE_LRDF #include <lrdf.h> +#endif #include "pbd/cpus.h" #include "pbd/error.h" @@ -196,6 +204,7 @@ setup_hardware_optimization (bool try_optimization) static void lotsa_files_please () { +#ifndef PLATFORM_WINDOWS struct rlimit rl; if (getrlimit (RLIMIT_NOFILE, &rl) == 0) { @@ -216,6 +225,7 @@ lotsa_files_please () } else { error << string_compose (_("Could not get system open files limit (%1)"), strerror (errno)) << endmsg; } +#endif } bool @@ -262,7 +272,9 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir // allow ardour the absolute maximum number of open files lotsa_files_please (); +#ifdef HAVE_LRDF lrdf_init(); +#endif Library = new AudioLibrary; BootMessage (_("Loading configuration")); @@ -364,7 +376,9 @@ ARDOUR::cleanup () ARDOUR::AudioEngine::destroy (); delete Library; +#ifdef HAVE_LRDF lrdf_cleanup (); +#endif delete &ControlProtocolManager::instance(); #ifdef WINDOWS_VST_SUPPORT fst_exit (); @@ -382,7 +396,7 @@ void ARDOUR::find_bindings_files (map<string,string>& files) { vector<std::string> found; - SearchPath spath = ardour_config_search_path(); + Searchpath spath = ardour_config_search_path(); if (getenv ("ARDOUR_SAE")) { Glib::PatternSpec pattern("*SAE-*.bindings"); @@ -525,8 +539,8 @@ ARDOUR::set_translations_enabled (bool yn) c = '0'; } - ::write (fd, &c, 1); - ::close (fd); + (void) ::write (fd, &c, 1); + (void) ::close (fd); return true; } @@ -581,10 +595,21 @@ clock_gettime (int /*clk_id*/, struct timespec *t) microseconds_t ARDOUR::get_microseconds () { +#ifdef PLATFORM_WINDOWS + microseconds_t ret = 0; + LARGE_INTEGER freq, time; + + if (QueryPerformanceFrequency(&freq)) + if (QueryPerformanceCounter(&time)) + ret = (microseconds_t)((time.QuadPart * 1000000) / freq.QuadPart); + + return ret; +#else struct timespec ts; if (clock_gettime (CLOCK_MONOTONIC, &ts) != 0) { /* EEEK! */ return 0; } return (microseconds_t) ts.tv_sec * 1000000 + (ts.tv_nsec/1000); +#endif } diff --git a/libs/ardour/graph.cc b/libs/ardour/graph.cc index 71eeee41ea..f8a1d51e10 100644 --- a/libs/ardour/graph.cc +++ b/libs/ardour/graph.cc @@ -22,6 +22,7 @@ #include "pbd/compose.h" #include "pbd/debug_rt_alloc.h" +#include "pbd/pthread_utils.h" #include "ardour/debug.h" #include "ardour/graph.h" @@ -223,7 +224,7 @@ Graph::trigger (GraphNode* n) void Graph::dec_ref() { - if (g_atomic_int_dec_and_test (&_finished_refcount)) { + if (g_atomic_int_dec_and_test (const_cast<gint*> (&_finished_refcount))) { /* We have run all the nodes that are at the `output' end of the graph, so there is nothing more to do this time around. @@ -358,7 +359,7 @@ Graph::run_one() /* update the number of threads that will still be sleeping */ _execution_tokens -= wakeup; - DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 signals %2\n", pthread_self(), wakeup)); + DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 signals %2\n", pthread_name(), wakeup)); for (int i = 0; i < wakeup; i++) { _execution_sem.signal (); @@ -367,12 +368,12 @@ Graph::run_one() while (to_run == 0) { _execution_tokens += 1; pthread_mutex_unlock (&_trigger_mutex); - DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 goes to sleep\n", pthread_self())); + DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 goes to sleep\n", pthread_name())); _execution_sem.wait (); if (_quit_threads) { return true; } - DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 is awake\n", pthread_self())); + DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 is awake\n", pthread_name())); pthread_mutex_lock (&_trigger_mutex); if (_trigger_queue.size()) { to_run = _trigger_queue.back(); @@ -384,7 +385,7 @@ Graph::run_one() to_run->process(); to_run->finish (_current_chain); - DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 has finished run_one()\n", pthread_self())); + DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 has finished run_one()\n", pthread_name())); return false; } @@ -552,7 +553,7 @@ Graph::process_one_route (Route* route) assert (route); - DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 runs route %2\n", pthread_self(), route->name())); + DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 runs route %2\n", pthread_name(), route->name())); if (_process_silent) { retval = route->silent_roll (_process_nframes, _process_start_frame, _process_end_frame, need_butler); diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index 047b46f553..b66f354224 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -34,6 +34,7 @@ #include <sndfile.h> #include <samplerate.h> +#include <glib/gstdio.h> #include <glibmm.h> #include <boost/scoped_array.hpp> @@ -117,7 +118,7 @@ open_importable_source (const string& path, framecnt_t samplerate, ARDOUR::SrcQu } static std::string -get_non_existent_filename (HeaderFormat hf, DataType type, const bool allow_replacing, const std::string& destdir, const std::string& basename, uint channel, uint channels) +get_non_existent_filename (HeaderFormat hf, DataType type, const bool allow_replacing, const std::string& destdir, const std::string& basename, uint32_t channel, uint32_t channels) { char buf[PATH_MAX+1]; bool goodfile = false; @@ -172,14 +173,14 @@ get_non_existent_filename (HeaderFormat hf, DataType type, const bool allow_repl } static vector<string> -get_paths_for_new_sources (HeaderFormat hf, const bool allow_replacing, const string& import_file_path, const string& session_dir, uint channels) +get_paths_for_new_sources (HeaderFormat hf, const bool allow_replacing, const string& import_file_path, const string& session_dir, uint32_t channels) { vector<string> new_paths; const string basename = basename_nosuffix (import_file_path); SessionDirectory sdir(session_dir); - for (uint n = 0; n < channels; ++n) { + for (uint32_t n = 0; n < channels; ++n) { const DataType type = SMFSource::safe_midi_file_extension (import_file_path) ? DataType::MIDI : DataType::AUDIO; @@ -196,7 +197,7 @@ get_paths_for_new_sources (HeaderFormat hf, const bool allow_replacing, const st static bool map_existing_mono_sources (const vector<string>& new_paths, Session& /*sess*/, - uint /*samplerate*/, vector<boost::shared_ptr<Source> >& newfiles, Session *session) + uint32_t /*samplerate*/, vector<boost::shared_ptr<Source> >& newfiles, Session *session) { for (vector<string>::const_iterator i = new_paths.begin(); i != new_paths.end(); ++i) @@ -215,7 +216,7 @@ map_existing_mono_sources (const vector<string>& new_paths, Session& /*sess*/, static bool create_mono_sources_for_writing (const vector<string>& new_paths, - Session& sess, uint samplerate, + Session& sess, uint32_t samplerate, vector<boost::shared_ptr<Source> >& newfiles, framepos_t timeline_position) { @@ -253,10 +254,10 @@ create_mono_sources_for_writing (const vector<string>& new_paths, static string compose_status_message (const string& path, - uint file_samplerate, - uint session_samplerate, - uint /* current_file */, - uint /* total_files */) + uint32_t file_samplerate, + uint32_t session_samplerate, + uint32_t /* current_file */, + uint32_t /* total_files */) { if (file_samplerate != session_samplerate) { return string_compose (_("Resampling %1 from %2kHz to %3kHz"), @@ -274,12 +275,12 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status, { const framecnt_t nframes = ResampledImportableSource::blocksize; boost::shared_ptr<AudioFileSource> afs; - uint channels = source->channels(); + uint32_t channels = source->channels(); boost::scoped_array<float> data(new float[nframes * channels]); vector<boost::shared_array<Sample> > channel_data; - for (uint n = 0; n < channels; ++n) { + for (uint32_t n = 0; n < channels; ++n) { channel_data.push_back(boost::shared_array<Sample>(new Sample[nframes])); } @@ -300,7 +301,7 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status, */ float peak = 0; - uint read_count = 0; + uint32_t read_count = 0; while (!status.cancel) { framecnt_t const nread = source->read (data.get(), nframes); @@ -324,15 +325,23 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status, progress_base = 0.5; } - uint read_count = 0; + uint32_t read_count = 0; while (!status.cancel) { framecnt_t nread, nfread; - uint x; - uint chn; + uint32_t x; + uint32_t chn; if ((nread = source->read (data.get(), nframes)) == 0) { +#ifdef PLATFORM_WINDOWS + /* Flush the data once we've finished importing the file. Windows can */ + /* cache the data for very long periods of time (perhaps not writing */ + /* it to disk until Ardour closes). So let's force it to flush now. */ + for (chn = 0; chn < channels; ++chn) + if ((afs = boost::dynamic_pointer_cast<AudioFileSource>(newfiles[chn])) != 0) + afs->flush (); +#endif break; } @@ -464,7 +473,7 @@ remove_file_source (boost::shared_ptr<Source> source) boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (source); if (fs) { - ::unlink (fs->path().c_str()); + ::g_unlink (fs->path().c_str()); } } @@ -479,7 +488,7 @@ Session::import_files (ImportStatus& status) Sources all_new_sources; boost::shared_ptr<AudioFileSource> afs; boost::shared_ptr<SMFSource> smfs; - uint channels = 0; + uint32_t channels = 0; status.sources.clear (); diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 6f5b5a63da..2cc213f797 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -19,6 +19,7 @@ #include <fstream> #include <algorithm> #include <cmath> +#include <vector> #include <unistd.h> #include <locale.h> @@ -395,7 +396,9 @@ IO::disconnect (void* src) int IO::ensure_ports_locked (ChanCount count, bool clear, bool& changed) { +#ifndef PLATFORM_WINDOWS assert (!AudioEngine::instance()->process_lock().trylock()); +#endif boost::shared_ptr<Port> port; @@ -466,7 +469,9 @@ IO::ensure_ports_locked (ChanCount count, bool clear, bool& changed) int IO::ensure_ports (ChanCount count, bool clear, void* src) { +#ifndef PLATFORM_WINDOWS assert (!AudioEngine::instance()->process_lock().trylock()); +#endif bool changed = false; @@ -501,7 +506,9 @@ IO::ensure_ports (ChanCount count, bool clear, void* src) int IO::ensure_io (ChanCount count, bool clear, void* src) { +#ifndef PLATFORM_WINDOWS assert (!AudioEngine::instance()->process_lock().trylock()); +#endif return ensure_ports (count, clear, src); } @@ -1373,20 +1380,20 @@ IO::build_legal_port_name (DataType type) limit = name_size - AudioEngine::instance()->my_name().length() - (suffix.length() + 5); - char buf1[name_size+1]; - char buf2[name_size+1]; + std::vector<char> buf1(name_size+1); + std::vector<char> buf2(name_size+1); /* colons are illegal in port names, so fix that */ string nom = _name.val(); replace_all (nom, ":", ";"); - snprintf (buf1, name_size+1, ("%.*s/%s"), limit, nom.c_str(), suffix.c_str()); + snprintf (&buf1[0], name_size+1, ("%.*s/%s"), limit, nom.c_str(), suffix.c_str()); - int port_number = find_port_hole (buf1); - snprintf (buf2, name_size+1, "%s %d", buf1, port_number); + int port_number = find_port_hole (&buf1[0]); + snprintf (&buf2[0], name_size+1, "%s %d", &buf1[0], port_number); - return string (buf2); + return string (&buf2[0]); } int32_t @@ -1404,14 +1411,13 @@ IO::find_port_hole (const char* base) */ for (n = 1; n < 9999; ++n) { - size_t size = AudioEngine::instance()->port_name_size() + 1; - char buf[size]; + std::vector<char> buf (AudioEngine::instance()->port_name_size()); PortSet::iterator i = _ports.begin(); - snprintf (buf, size, _("%s %u"), base, n); + snprintf (&buf[0], buf.size()+1, _("%s %u"), base, n); for ( ; i != _ports.end(); ++i) { - if (i->name() == buf) { + if (string(i->name()) == string(&buf[0])) { break; } } diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index bc3a83799b..8b089929b5 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -17,6 +17,10 @@ */ +#ifdef WAF_BUILD +#include "libardour-config.h" +#endif + #include <inttypes.h> #include <vector> @@ -25,11 +29,15 @@ #include <cstdlib> #include <cstdio> // so libraptor doesn't complain #include <cmath> +#ifndef COMPILER_MSVC #include <dirent.h> +#endif #include <sys/stat.h> #include <cerrno> +#ifdef HAVE_LRDF #include <lrdf.h> +#endif #include "pbd/compose.h" #include "pbd/error.h" @@ -50,16 +58,16 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -LadspaPlugin::LadspaPlugin (void *mod, AudioEngine& e, Session& session, uint32_t index, framecnt_t rate) +LadspaPlugin::LadspaPlugin (string module_path, AudioEngine& e, Session& session, uint32_t index, framecnt_t rate) : Plugin (e, session) { - init (mod, index, rate); + init (module_path, index, rate); } LadspaPlugin::LadspaPlugin (const LadspaPlugin &other) : Plugin (other) { - init (other._module, other._index, other._sample_rate); + init (other._module_path, other._index, other._sample_rate); for (uint32_t i = 0; i < parameter_count(); ++i) { _control_data[i] = other._shadow_data[i]; @@ -68,25 +76,32 @@ LadspaPlugin::LadspaPlugin (const LadspaPlugin &other) } void -LadspaPlugin::init (void *mod, uint32_t index, framecnt_t rate) +LadspaPlugin::init (string module_path, uint32_t index, framecnt_t rate) { + void* func; LADSPA_Descriptor_Function dfunc; uint32_t i, port_cnt; - const char *errstr; - _module = mod; + _module_path = module_path; + _module = new Glib::Module(_module_path); _control_data = 0; _shadow_data = 0; _latency_control_port = 0; _was_activated = false; - dfunc = (LADSPA_Descriptor_Function) dlsym (_module, "ladspa_descriptor"); + if (!(*_module)) { + error << _("LADSPA: Unable to open module: ") << Glib::Module::get_last_error() << endmsg; + delete _module; + throw failed_constructor(); + } - if ((errstr = dlerror()) != NULL) { + if (!_module->get_symbol("ladspa_descriptor", func)) { error << _("LADSPA: module has no descriptor function.") << endmsg; throw failed_constructor(); } + dfunc = (LADSPA_Descriptor_Function)func; + if ((_descriptor = dfunc (index)) == 0) { error << _("LADSPA: plugin has gone away since discovery!") << endmsg; throw failed_constructor(); @@ -142,9 +157,8 @@ LadspaPlugin::~LadspaPlugin () deactivate (); cleanup (); - /* XXX who should close a plugin? */ - - // dlclose (module); + // glib has internal reference counting on modules so this is ok + delete _module; delete [] _control_data; delete [] _shadow_data; @@ -629,10 +643,11 @@ LadspaPlugin::print_parameter (uint32_t param, char *buf, uint32_t len) const boost::shared_ptr<Plugin::ScalePoints> LadspaPlugin::get_scale_points(uint32_t port_index) const { + boost::shared_ptr<Plugin::ScalePoints> ret; +#ifdef HAVE_LRDF const uint32_t id = atol(unique_id().c_str()); lrdf_defaults* points = lrdf_get_scale_values(id, port_index); - boost::shared_ptr<Plugin::ScalePoints> ret; if (!points) { return ret; } @@ -645,6 +660,7 @@ LadspaPlugin::get_scale_points(uint32_t port_index) const } lrdf_free_setting_values(points); +#endif return ret; } @@ -710,17 +726,7 @@ PluginPtr LadspaPluginInfo::load (Session& session) { try { - PluginPtr plugin; - void *module; - - if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) { - error << string_compose(_("LADSPA: cannot load module from \"%1\""), path) << endmsg; - error << dlerror() << endmsg; - return PluginPtr ((Plugin*) 0); - } else { - plugin.reset (new LadspaPlugin (module, session.engine(), session, index, session.frame_rate())); - } - + PluginPtr plugin (new LadspaPlugin (path, session.engine(), session, index, session.frame_rate())); plugin->set_info(PluginInfoPtr(new LadspaPluginInfo(*this))); return plugin; } @@ -739,6 +745,7 @@ LadspaPluginInfo::LadspaPluginInfo() void LadspaPlugin::find_presets () { +#ifdef HAVE_LRDF uint32_t id; std::string unique (unique_id()); @@ -759,12 +766,14 @@ LadspaPlugin::find_presets () } lrdf_free_uris(set_uris); } +#endif } bool LadspaPlugin::load_preset (PresetRecord r) { +#ifdef HAVE_LRDF lrdf_defaults* defs = lrdf_get_setting_values (r.uri.c_str()); if (defs) { @@ -777,6 +786,7 @@ LadspaPlugin::load_preset (PresetRecord r) } Plugin::load_preset (r); +#endif return true; } @@ -784,6 +794,7 @@ LadspaPlugin::load_preset (PresetRecord r) static void lrdf_remove_preset (const char* /*source*/, const char *setting_uri) { +#ifdef HAVE_LRDF lrdf_statement p; lrdf_statement *q; lrdf_statement *i; @@ -817,11 +828,13 @@ lrdf_remove_preset (const char* /*source*/, const char *setting_uri) p.predicate = NULL; p.object = NULL; lrdf_remove_matches (&p); +#endif } void LadspaPlugin::do_remove_preset (string name) { +#ifdef HAVE_LRDF string const envvar = preset_envvar (); if (envvar.empty()) { warning << _("Could not locate HOME. Preset not removed.") << endmsg; @@ -837,6 +850,7 @@ LadspaPlugin::do_remove_preset (string name) lrdf_remove_preset (source.c_str(), p->uri.c_str ()); write_preset_file (envvar); +#endif } string @@ -859,6 +873,7 @@ LadspaPlugin::preset_source (string envvar) const bool LadspaPlugin::write_preset_file (string envvar) { +#ifdef HAVE_LRDF string path = string_compose("%1/.ladspa", envvar); if (g_mkdir_with_parents (path.c_str(), 0775)) { warning << string_compose(_("Could not create %1. Preset not saved. (%2)"), path, strerror(errno)) << endmsg; @@ -879,11 +894,15 @@ LadspaPlugin::write_preset_file (string envvar) } return true; +#else + return false; +#endif } string LadspaPlugin::do_save_preset (string name) { +#ifdef HAVE_LRDF /* make a vector of pids that are input parameters */ vector<int> input_parameter_pids; for (uint32_t i = 0; i < parameter_count(); ++i) { @@ -902,8 +921,8 @@ LadspaPlugin::do_save_preset (string name) lrdf_defaults defaults; defaults.count = input_parameter_pids.size (); - lrdf_portvalue portvalues[input_parameter_pids.size()]; - defaults.items = portvalues; + std::vector<lrdf_portvalue> portvalues(input_parameter_pids.size()); + defaults.items = &portvalues[0]; for (vector<int>::size_type i = 0; i < input_parameter_pids.size(); ++i) { portvalues[i].pid = input_parameter_pids[i]; @@ -927,6 +946,9 @@ LadspaPlugin::do_save_preset (string name) } return uri; +#else + return string(); +#endif } LADSPA_PortDescriptor diff --git a/libs/ardour/ladspa_search_path.cc b/libs/ardour/ladspa_search_path.cc new file mode 100644 index 0000000000..49a2645f5d --- /dev/null +++ b/libs/ardour/ladspa_search_path.cc @@ -0,0 +1,61 @@ +/* + Copyright (C) 2011 Tim Mayberry + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <glibmm/miscutils.h> + +#include "pbd/pathexpand.h" + +#include "ardour/ladspa_search_path.h" +#include "ardour/directory_names.h" +#include "ardour/filesystem_paths.h" + +namespace { + const char * const ladspa_env_variable_name = "LADSPA_PATH"; +} // anonymous + +using namespace PBD; + +namespace ARDOUR { + +Searchpath +ladspa_search_path () +{ + Searchpath spath_env (Glib::getenv(ladspa_env_variable_name)); + + Searchpath spath (user_config_directory ()); + + spath += ardour_dll_directory (); + spath.add_subdirectory_to_paths (ladspa_dir_name); + +#ifndef PLATFORM_WINDOWS + spath.push_back ("/usr/local/lib64/ladspa"); + spath.push_back ("/usr/local/lib/ladspa"); + spath.push_back ("/usr/lib64/ladspa"); + spath.push_back ("/usr/lib/ladspa"); +#endif + +#ifdef __APPLE__ + spath.push_back (path_expand ("~/Library/Audio/Plug-Ins/LADSPA")); + spath.push_back ("/Library/Audio/Plug-Ins/LADSPA"); +#endif + + return spath_env + spath; +} + +} // namespace ARDOUR diff --git a/libs/ardour/ltc_slave.cc b/libs/ardour/ltc_slave.cc index bdb4fbead9..ced0226d00 100644 --- a/libs/ardour/ltc_slave.cc +++ b/libs/ardour/ltc_slave.cc @@ -19,11 +19,11 @@ */ #include <iostream> #include <errno.h> -#include <poll.h> #include <sys/types.h> #include <unistd.h> #include "pbd/error.h" +#include "pbd/pthread_utils.h" #include "ardour/debug.h" #include "ardour/slave.h" @@ -150,7 +150,7 @@ LTC_Slave::reset() } void -LTC_Slave::parse_ltc(const pframes_t nframes, const Sample* const in, const framecnt_t posinfo) +LTC_Slave::parse_ltc(const ARDOUR::pframes_t nframes, const Sample* const in, const ARDOUR::framecnt_t posinfo) { pframes_t i; unsigned char sound[8192]; @@ -432,7 +432,7 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos) frameoffset_t skip = now - (monotonic_cnt + nframes); monotonic_cnt = now; - DEBUG_TRACE (DEBUG::LTC, string_compose ("speed_and_position - TID:%1 | latency: %2 | skip %3\n", ::pthread_self(), ltc_slave_latency.max, skip)); + DEBUG_TRACE (DEBUG::LTC, string_compose ("speed_and_position - TID:%1 | latency: %2 | skip %3\n", pthread_name(), ltc_slave_latency.max, skip)); if (last_timestamp == 0) { engine_dll_initstate = 0; @@ -588,10 +588,10 @@ LTC_Slave::approximate_current_delta() const if (last_timestamp == 0 || engine_dll_initstate == 0) { snprintf(delta, sizeof(delta), "\u2012\u2012\u2012\u2012"); } else if ((monotonic_cnt - last_timestamp) > 2 * frames_per_ltc_frame) { - snprintf(delta, sizeof(delta), _("flywheel")); + snprintf(delta, sizeof(delta), "%s", _("flywheel")); } else { snprintf(delta, sizeof(delta), "\u0394<span foreground=\"green\" face=\"monospace\" >%s%s%" PRIi64 "</span>sm", - LEADINGZERO(abs(current_delta)), PLUSMINUS(-current_delta), abs(current_delta)); + LEADINGZERO(llabs(current_delta)), PLUSMINUS(-current_delta), llabs(current_delta)); } return std::string(delta); } diff --git a/libs/ardour/lv2_bundled_search_path.cc b/libs/ardour/lv2_bundled_search_path.cc index d8cd1c1075..2454ea2ae1 100644 --- a/libs/ardour/lv2_bundled_search_path.cc +++ b/libs/ardour/lv2_bundled_search_path.cc @@ -29,10 +29,10 @@ using namespace PBD; namespace ARDOUR { -SearchPath +Searchpath lv2_bundled_search_path () { - SearchPath spath( ardour_dll_directory () ); + Searchpath spath( ardour_dll_directory () ); spath.add_subdirectory_to_paths ("LV2"); return spath; diff --git a/libs/ardour/lv2_evbuf.c b/libs/ardour/lv2_evbuf.c index 8942d19a9b..fba7fd521d 100644 --- a/libs/ardour/lv2_evbuf.c +++ b/libs/ardour/lv2_evbuf.c @@ -219,7 +219,7 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter, *subframes = 0; *type = aev->body.type; *size = aev->body.size; - *data = LV2_ATOM_BODY(&aev->body); + *data = (uint8_t*)LV2_ATOM_BODY(&aev->body); break; } diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 58060f372f..f24aa653bb 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -25,6 +25,7 @@ #include <cstdlib> #include <cstring> +#include <glib/gstdio.h> #include <giomm/file.h> #include <glib/gprintf.h> #include <glibmm.h> @@ -1113,7 +1114,7 @@ LV2Plugin::do_remove_preset(string name) name + ".ttl" ) ); - unlink(preset_file.c_str()); + ::g_unlink(preset_file.c_str()); } bool @@ -1141,16 +1142,16 @@ LV2Plugin::write_to(RingBuffer<uint8_t>* dest, uint32_t size, const uint8_t* body) { - const uint32_t buf_size = sizeof(UIMessage) + size; - uint8_t buf[buf_size]; + const uint32_t buf_size = sizeof(UIMessage) + size; + vector<uint8_t> buf(buf_size); - UIMessage* msg = (UIMessage*)buf; + UIMessage* msg = (UIMessage*)&buf[0]; msg->index = index; msg->protocol = protocol; msg->size = size; memcpy(msg + 1, body, size); - return (dest->write(buf, buf_size) == buf_size); + return (dest->write(&buf[0], buf_size) == buf_size); } bool @@ -1229,13 +1230,13 @@ LV2Plugin::emit_to_ui(void* controller, UIMessageSink sink) error << "Error reading from Plugin=>UI RingBuffer" << endmsg; break; } - uint8_t body[msg.size]; - if (_to_ui->read(body, msg.size) != msg.size) { + vector<uint8_t> body(msg.size); + if (_to_ui->read(&body[0], msg.size) != msg.size) { error << "Error reading from Plugin=>UI RingBuffer" << endmsg; break; } - sink(controller, msg.index, msg.size, msg.protocol, body); + sink(controller, msg.index, msg.size, msg.protocol, &body[0]); read_space -= sizeof(msg) + msg.size; } @@ -1718,15 +1719,15 @@ LV2Plugin::connect_and_run(BufferSet& bufs, error << "Error reading from UI=>Plugin RingBuffer" << endmsg; break; } - uint8_t body[msg.size]; - if (_from_ui->read(body, msg.size) != msg.size) { + vector<uint8_t> body(msg.size); + if (_from_ui->read(&body[0], msg.size) != msg.size) { error << "Error reading from UI=>Plugin RingBuffer" << endmsg; break; } if (msg.protocol == urids.atom_eventTransfer) { LV2_Evbuf* buf = _ev_buffers[msg.index]; LV2_Evbuf_Iterator i = lv2_evbuf_end(buf); - const LV2_Atom* const atom = (const LV2_Atom*)body; + const LV2_Atom* const atom = (const LV2_Atom*)&body[0]; if (!lv2_evbuf_write(&i, nframes, 0, atom->type, atom->size, (const uint8_t*)(atom + 1))) { error << "Failed to write data to LV2 event buffer\n"; @@ -2036,7 +2037,7 @@ LV2World::load_bundled_plugins() vector<string *> *plugin_objects = scanner (ARDOUR::lv2_bundled_search_path().to_string(), lv2_filter, 0, true, true); if (plugin_objects) { for ( vector<string *>::iterator x = plugin_objects->begin(); x != plugin_objects->end (); ++x) { -#ifdef WINDOWS +#ifdef PLATFORM_WINDOWS string uri = "file:///" + **x + "/"; #else string uri = "file://" + **x + "/"; diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index ec736fef69..80690bd744 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -18,6 +18,7 @@ #include <algorithm> #include <cmath> +#include <limits> #include "pbd/compose.h" @@ -153,7 +154,7 @@ void PeakMeter::reset_max () { for (size_t i = 0; i < _max_peak_power.size(); ++i) { - _max_peak_power[i] = -INFINITY; + _max_peak_power[i] = -std::numeric_limits<float>::infinity(); _max_peak_signal[i] = 0; } @@ -163,7 +164,7 @@ PeakMeter::reset_max () if (n < n_midi) { _visible_peak_power[n] = 0; } else { - _visible_peak_power[n] = -INFINITY; + _visible_peak_power[n] = -std::numeric_limits<float>::infinity(); } } } @@ -302,7 +303,7 @@ PeakMeter::meter () _peak_signal[n] = 0; /* ... to here */ if (n < n_midi) { - _max_peak_power[n] = -INFINITY; // std::max (new_peak, _max_peak_power[n]); // XXX + _max_peak_power[n] = -std::numeric_limits<float>::infinity(); // std::max (new_peak, _max_peak_power[n]); // XXX _max_peak_signal[n] = 0; if (midi_meter_falloff == 0.0f || new_peak > _visible_peak_power[n]) { ; @@ -336,7 +337,7 @@ PeakMeter::meter () } else { // do falloff new_peak = _visible_peak_power[n] - (audio_meter_falloff); - _visible_peak_power[n] = std::max (new_peak, -INFINITY); + _visible_peak_power[n] = std::max (new_peak, -std::numeric_limits<float>::infinity()); } } } diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc index 762d94469c..8c95272fde 100644 --- a/libs/ardour/midi_clock_slave.cc +++ b/libs/ardour/midi_clock_slave.cc @@ -20,7 +20,6 @@ #include <cmath> #include <errno.h> -#include <poll.h> #include <sys/types.h> #include <unistd.h> #include "pbd/error.h" @@ -261,7 +260,7 @@ MIDIClock_Slave::stop (Parser& /*parser*/, framepos_t /*timestamp*/) } void -MIDIClock_Slave::position (Parser& /*parser*/, byte* message, size_t size) +MIDIClock_Slave::position (Parser& /*parser*/, MIDI::byte* message, size_t size) { // we are note supposed to get position messages while we are running // so lets be robust and ignore those @@ -270,8 +269,8 @@ MIDIClock_Slave::position (Parser& /*parser*/, byte* message, size_t size) } assert(size == 3); - byte lsb = message[1]; - byte msb = message[2]; + MIDI::byte lsb = message[1]; + MIDI::byte msb = message[2]; assert((lsb <= 0x7f) && (msb <= 0x7f)); uint16_t position_in_sixteenth_notes = (uint16_t(msb) << 7) | uint16_t(lsb); diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 66a3754e2d..a1a640cd1c 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -26,11 +26,10 @@ #include <fcntl.h> #include <cstdlib> #include <ctime> -#include <strings.h> // for ffs(3) #include <sys/stat.h> -#include <sys/mman.h> #include "pbd/error.h" +#include "pbd/ffs.h" #include "pbd/basename.h" #include <glibmm/threads.h> #include "pbd/xml++.h" @@ -439,14 +438,14 @@ MidiDiskstream::process (BufferSet& bufs, framepos_t transport_frame, pframes_t break; case ForceChannel: if (ev.is_channel_event()) { - ev.set_channel (ffs(mask) - 1); + ev.set_channel (PBD::ffs(mask) - 1); } _capture_buf->write(transport_frame + loop_offset + ev.time(), ev.type(), ev.size(), ev.buffer()); break; } } - g_atomic_int_add(const_cast<gint*> (&_frames_pending_write), nframes); + g_atomic_int_add(const_cast<gint*>(&_frames_pending_write), nframes); if (buf.size() != 0) { Glib::Threads::Mutex::Lock lm (_gui_feed_buffer_mutex, Glib::Threads::TRY_LOCK); @@ -808,7 +807,7 @@ MidiDiskstream::do_flush (RunContext /*context*/, bool force_flush) } /* if there are 2+ chunks of disk i/o possible for - this track, let the caller know so that it can arrange + this track), let the caller know so that it can arrange for us to be called again, ASAP. if we are forcing a flush, then if there is* any* extra diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index 5c1f65d96b..716d511798 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -1018,6 +1018,7 @@ MidiModel::PatchChangeDiffCommand::change_channel (PatchChangePtr patch, uint8_t c.patch = patch; c.old_channel = patch->channel (); c.new_channel = channel; + c.patch_id = patch->id(); _changes.push_back (c); } @@ -1030,6 +1031,7 @@ MidiModel::PatchChangeDiffCommand::change_program (PatchChangePtr patch, uint8_t c.patch = patch; c.old_program = patch->program (); c.new_program = program; + c.patch_id = patch->id(); _changes.push_back (c); } diff --git a/libs/ardour/midi_patch_manager.cc b/libs/ardour/midi_patch_manager.cc index 4bced4e46d..f2d964bb77 100644 --- a/libs/ardour/midi_patch_manager.cc +++ b/libs/ardour/midi_patch_manager.cc @@ -28,6 +28,7 @@ #include "ardour/session.h" #include "ardour/session_directory.h" #include "ardour/midi_patch_manager.h" + #include "ardour/midi_patch_search_path.h" #include "i18n.h" @@ -102,7 +103,7 @@ MidiPatchManager::refresh() _master_devices_by_model.clear(); _all_models.clear(); - SearchPath search_path = midi_patch_search_path (); + Searchpath search_path = midi_patch_search_path (); Glib::PatternSpec pattern (string("*.midnam")); vector<std::string> result; diff --git a/libs/ardour/midi_patch_search_path.cc b/libs/ardour/midi_patch_search_path.cc index ccad1de466..c099c379e9 100644 --- a/libs/ardour/midi_patch_search_path.cc +++ b/libs/ardour/midi_patch_search_path.cc @@ -31,14 +31,14 @@ using namespace PBD; namespace ARDOUR { -SearchPath +Searchpath midi_patch_search_path () { - SearchPath spath (ardour_data_search_path()); + Searchpath spath (ardour_data_search_path()); spath.add_subdirectory_to_paths(midi_patch_dir_name); bool midi_patch_path_defined = false; - SearchPath spath_env (Glib::getenv(midi_patch_env_variable_name, midi_patch_path_defined)); + Searchpath spath_env (Glib::getenv(midi_patch_env_variable_name, midi_patch_path_defined)); if (midi_patch_path_defined) { spath += spath_env; diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index 124d3f7c9b..1887b74302 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -20,7 +20,6 @@ #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> -#include <poll.h> #include <float.h> #include <cerrno> #include <ctime> diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index 7dff7ac639..6a998de90e 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -17,8 +17,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <strings.h> // for ffs(3) - +#include "pbd/ffs.h" #include "pbd/enumwriter.h" #include "pbd/convert.h" #include "evoral/midi_util.h" @@ -321,7 +320,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame if (!lm.locked()) { boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream(); framecnt_t playback_distance = diskstream->calculate_playback_distance(nframes); - if (can_internal_playback_seek(std::llabs(playback_distance))) { + if (can_internal_playback_seek(llabs(playback_distance))) { /* TODO should declick, and/or note-off */ internal_playback_seek(playback_distance); } @@ -513,7 +512,7 @@ MidiTrack::filter_channels (BufferSet& bufs, ChannelMode mode, uint32_t mask) } break; case ForceChannel: - ev.set_channel (ffs (mask) - 1); + ev.set_channel (PBD::ffs (mask) - 1); ++e; break; case AllChannels: @@ -633,9 +632,9 @@ void MidiTrack::MidiControl::set_value(double val) { bool valid = false; - if (std::isinf(val)) { + if (isinf(val)) { cerr << "MIDIControl value is infinity" << endl; - } else if (std::isnan(val)) { + } else if (isnan(val)) { cerr << "MIDIControl value is NaN" << endl; } else if (val < _list->parameter().min()) { cerr << "MIDIControl value is < " << _list->parameter().min() << endl; diff --git a/libs/ardour/midi_ui.cc b/libs/ardour/midi_ui.cc index b80370ec6a..06940c1e34 100644 --- a/libs/ardour/midi_ui.cc +++ b/libs/ardour/midi_ui.cc @@ -77,7 +77,9 @@ MidiControlUI::midi_input_handler (IOCondition ioc, AsyncMIDIPort* port) if (ioc & IO_IN) { +#ifndef PLATFORM_WINDOWS CrossThreadChannel::drain (port->selectable()); +#endif DEBUG_TRACE (DEBUG::MidiIO, string_compose ("data available on %1\n", ((ARDOUR::Port*)port)->name())); framepos_t now = _session.engine().sample_time(); diff --git a/libs/ardour/mix.cc b/libs/ardour/mix.cc index 3a873a8e50..220cd0660c 100644 --- a/libs/ardour/mix.cc +++ b/libs/ardour/mix.cc @@ -24,6 +24,8 @@ #include "ardour/runtime_functions.h" #include <stdint.h> +using std::min; +using std::max; using namespace ARDOUR; #if defined (ARCH_X86) && defined (BUILD_SSE_OPTIMIZATIONS) @@ -93,22 +95,22 @@ default_compute_peak (const ARDOUR::Sample * buf, pframes_t nsamples, float curr } void -default_find_peaks (const ARDOUR::Sample * buf, pframes_t nframes, float *min, float *max) +default_find_peaks (const ARDOUR::Sample * buf, pframes_t nframes, float *minf, float *maxf) { pframes_t i; float a, b; - a = *max; - b = *min; + a = *maxf; + b = *minf; for (i = 0; i < nframes; i++) { - a = fmax (buf[i], a); - b = fmin (buf[i], b); + a = max (buf[i], a); + b = min (buf[i], b); } - *max = a; - *min = b; + *maxf = a; + *minf = b; } void diff --git a/libs/ardour/msvc/msvc_libardour.cc b/libs/ardour/msvc/msvc_libardour.cc new file mode 100644 index 0000000000..bd186728ea --- /dev/null +++ b/libs/ardour/msvc/msvc_libardour.cc @@ -0,0 +1,276 @@ +/* + Copyright (C) 2009 John Emmas + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#if (defined(PLATFORM_WINDOWS) && !defined(COMPILER_CYGWIN)) +#include <shlobj.h> +#include <glibmm.h> +#ifdef COMPILER_MSVC +#pragma warning(disable:4996) +#endif +#else +#include <glib.h> +#endif + +#include <string.h> +#include <stdlib.h> +#include <ardour/msvc_libardour.h> + +namespace ARDOUR { + +//*************************************************************** +// +// placeholder_for_non_msvc_specific_function() +// +// Description +// +// Returns: +// +// On Success: +// +// On Failure: +// +/* LIBARDOUR_API char* LIBARDOUR_APICALLTYPE + placeholder_for_non_msvc_specific_function() +{ +char *pRet = buffer; + + return (pRet); +} +*/ + +} // namespace ARDOUR + +#ifdef COMPILER_MSVC + +#include <errno.h> + +namespace ARDOUR { + +//*************************************************************** +// +// symlink() +// +// Emulates POSIX symlink() but creates a Windows shortcut. To +// create a Windows shortcut the supplied shortcut name must end +// in ".lnk" +// Note that you can only create a shortcut in a folder for which +// you have appropriate access rights. Note also that the folder +// must already exist. If it doesn't exist or if you don't have +// sufficient access rights to it, symlink() will generate an +// error (in common with its POSIX counterpart). +// +// Returns: +// +// On Success: Zero +// On Failure: -1 ('errno' will contain the specific error) +// +LIBARDOUR_API int LIBARDOUR_APICALLTYPE +symlink(const char *dest, const char *shortcut, const char *working_directory /*= NULL */) +{ +IShellLinkA *pISL = NULL; +IPersistFile *ppf = NULL; +int ret = (-1); + + if ((NULL == dest) || (NULL == shortcut) || (strlen(shortcut) < 5) || (strlen(dest) == 0)) + _set_errno(EINVAL); + else if ((strlen(shortcut) > _MAX_PATH) || (strlen(dest) > _MAX_PATH)) + _set_errno(ENAMETOOLONG); + else if (Glib::file_test(shortcut, Glib::FILE_TEST_EXISTS)) + _set_errno(EEXIST); + else + { + HRESULT hRet = 0; + + if (SUCCEEDED (hRet = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&pISL))) + { + if (SUCCEEDED (pISL->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf))) + { + char sc_path_lower_case[_MAX_PATH]; + WCHAR shortcut_path[_MAX_PATH]; + + // Fail if the path isn't a shortcut + strcpy(sc_path_lower_case, shortcut); + strlwr(sc_path_lower_case); + const char *p = strlen(sc_path_lower_case) + sc_path_lower_case - 4; + + if (0 == strcmp(p, ".lnk")) + { + HRESULT hr; + + // We're apparently been given valid Windows shortcut name + MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, shortcut, -1, shortcut_path, _MAX_PATH); + + // Create the shortcut + if (FAILED (hr = ppf->Load(shortcut_path, STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE))) + hr = ppf->Save(shortcut_path, TRUE); + + if (S_OK == hr) + { + // Set its target path + if (S_OK == pISL->SetPath(dest)) + { + // Set its working directory + if (working_directory) + p = working_directory; + else + p = ""; + + if (S_OK == pISL->SetWorkingDirectory(p)) + { + // Set its 'Show' command + if (S_OK == pISL->SetShowCmd(SW_SHOWNORMAL)) + { + // And finally, set its icon to the same file as the target. + // For the time being, don't fail if the target has no icon. + if (Glib::file_test(dest, Glib::FILE_TEST_IS_DIR)) + pISL->SetIconLocation("%SystemRoot%\\system32\\shell32.dll", 1); + else + pISL->SetIconLocation(dest, 0); + + if (S_OK == ppf->Save(shortcut_path, FALSE)) + { + Sleep(1500); + + ret = 0; + // _set_errno(0); + } + else + _set_errno(EACCES); + } + else + _set_errno(EACCES); + } + else + _set_errno(EACCES); + } + else + _set_errno(EACCES); + } + else + _set_errno(EBADF); + } + else + _set_errno(EACCES); + } + else + _set_errno(EBADF); + } + else + { + if (E_POINTER == hRet) + _set_errno(EINVAL); + else + _set_errno(EIO); + } + } + + return (ret); +} + + +//*************************************************************** +// +// readlink() +// +// Emulates POSIX readlink() but using Windows shortcuts +// Doesn't (currently) resolve shortcuts to shortcuts. This would +// be quite simple to incorporate but we'd need to check for +// recursion (i.e. a shortcut that points to an earlier shortcut +// in the same chain). +// +// Returns: +// +// On Success: Zero +// On Failure: -1 ('errno' will contain the specific error) +// +LIBARDOUR_API int LIBARDOUR_APICALLTYPE +readlink(const char *__restrict shortcut, char *__restrict buf, size_t bufsize) +{ +IShellLinkA *pISL = NULL; +IPersistFile *ppf = NULL; +int ret = (-1); + + if ((NULL == shortcut) || (NULL == buf) || (strlen(shortcut) < 5) || (bufsize == 0)) + _set_errno(EINVAL); + else if ((bufsize > _MAX_PATH) || (strlen(shortcut) > _MAX_PATH)) + _set_errno(ENAMETOOLONG); + else + { + HRESULT hRet = 0; + + if (SUCCEEDED (hRet = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&pISL))) + { + if (SUCCEEDED (pISL->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf))) + { + char target_path[_MAX_PATH]; + WCHAR shortcut_path[_MAX_PATH]; + + // Fail if the path isn't a shortcut + strcpy(target_path, shortcut); // Use 'target_path' temporarily + strlwr(target_path); + const char *p = strlen(target_path) + target_path - 4; + + if (0 == strcmp(p, ".lnk")) + { + // We're apparently pointing to a valid Windows shortcut + MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, shortcut, -1, shortcut_path, _MAX_PATH); + + // Load the shortcut into our persistent file + if (SUCCEEDED (ppf->Load(shortcut_path, 0))) + { + // Read the target information from the shortcut object + if (S_OK == (pISL->GetPath (target_path, _MAX_PATH, NULL, SLGP_UNCPRIORITY))) + { + strncpy(buf, target_path, bufsize); + ret = ((ret = strlen(buf)) > bufsize) ? bufsize : ret; + // _set_errno(0); + } + else + _set_errno(EACCES); + } + else + _set_errno(EBADF); + } + else + _set_errno(EINVAL); + } + else + _set_errno(EBADF); + } + else + { + if (E_POINTER == hRet) + _set_errno(EINVAL); + else + _set_errno(EIO); + } + + if (ppf) + ppf->Release(); + + if (pISL) + pISL->Release(); + } + + return (ret); +} + +} // namespace ARDOUR + +#endif // COMPILER_MSVC diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index e9071af619..1a1c5f2bec 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -19,11 +19,11 @@ */ #include <iostream> #include <errno.h> -#include <poll.h> #include <sys/types.h> #include <unistd.h> #include "pbd/error.h" +#include "pbd/pthread_utils.h" #include "ardour/audioengine.h" #include "ardour/debug.h" @@ -32,6 +32,8 @@ #include "ardour/session.h" #include "ardour/slave.h" +#include <glibmm/timer.h> + #include "i18n.h" using namespace std; @@ -236,7 +238,7 @@ MTC_Slave::read_current (SafeTime *st) const do { if (tries == 10) { error << _("MTC Slave: atomic read of current time failed, sleeping!") << endmsg; - usleep (20); + Glib::usleep (20); tries = 0; } *st = current; @@ -299,7 +301,7 @@ MTC_Slave::update_mtc_qtr (Parser& /*p*/, int which_qtr, framepos_t now) * when a full TC has been received * OR on locate */ void -MTC_Slave::update_mtc_time (const byte *msg, bool was_full, framepos_t now) +MTC_Slave::update_mtc_time (const MIDI::byte *msg, bool was_full, framepos_t now) { busy_guard1++; @@ -307,8 +309,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, framepos_t now) to use a timestamp indicating when this MTC time was received. example: when we received a locate command via MMC. */ - - DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC::update_mtc_time - TID:%1\n", ::pthread_self())); + DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC::update_mtc_time - TID:%1\n", pthread_name())); TimecodeFormat tc_format; bool reset_tc = true; @@ -488,7 +489,7 @@ MTC_Slave::update_mtc_status (MIDI::MTC_Status status) /* XXX !!! thread safety ... called from MIDI I/O context * on locate (via ::update_mtc_time()) */ - DEBUG_TRACE (DEBUG::MTC, string_compose("MTC_Slave::update_mtc_status - TID:%1\n", ::pthread_self())); + DEBUG_TRACE (DEBUG::MTC, string_compose("MTC_Slave::update_mtc_status - TID:%1\n", pthread_name())); return; // why was this fn needed anyway ? it just messes up things -> use reset. busy_guard1++; diff --git a/libs/ardour/panner_manager.cc b/libs/ardour/panner_manager.cc index ec5b675731..0084a62285 100644 --- a/libs/ardour/panner_manager.cc +++ b/libs/ardour/panner_manager.cc @@ -29,6 +29,7 @@ #include "ardour/debug.h" #include "ardour/panner_manager.h" + #include "ardour/panner_search_path.h" #include "i18n.h" @@ -65,7 +66,7 @@ static bool panner_filter (const string& str, void */*arg*/) #ifdef __APPLE__ return str[0] != '.' && (str.length() > 6 && str.find (".dylib") == (str.length() - 6)); #else - return str[0] != '.' && (str.length() > 3 && str.find (".so") == (str.length() - 3)); + return str[0] != '.' && (str.length() > 3 && (str.find (".so") == (str.length() - 3) || str.find (".dll") == (str.length() - 4))); #endif } @@ -83,6 +84,7 @@ PannerManager::discover_panners () for (vector<std::string *>::iterator i = panner_modules->begin(); i != panner_modules->end(); ++i) { panner_discover (**i); } + vector_delete (panner_modules); } @@ -113,31 +115,33 @@ PannerManager::panner_discover (string path) PannerInfo* PannerManager::get_descriptor (string path) { - void *module; + Glib::Module* module = new Glib::Module(path); PannerInfo* info = 0; PanPluginDescriptor *descriptor = 0; PanPluginDescriptor* (*dfunc)(void); - const char *errstr; + void* func = 0; - if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) { - error << string_compose(_("PannerManager: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg; + if (!module) { + error << string_compose(_("PannerManager: cannot load module \"%1\" (%2)"), path, + Glib::Module::get_last_error()) << endmsg; + delete module; return 0; } - dfunc = (PanPluginDescriptor* (*)(void)) dlsym (module, "panner_descriptor"); - - if ((errstr = dlerror()) != 0) { + if (!module->get_symbol("panner_descriptor", func)) { error << string_compose(_("PannerManager: module \"%1\" has no descriptor function."), path) << endmsg; - error << errstr << endmsg; - dlclose (module); + error << Glib::Module::get_last_error() << endmsg; + delete module; return 0; } + dfunc = (PanPluginDescriptor* (*)(void))func; descriptor = dfunc(); + if (descriptor) { info = new PannerInfo (*descriptor, module); } else { - dlclose (module); + delete module; } return info; diff --git a/libs/ardour/panner_search_path.cc b/libs/ardour/panner_search_path.cc index 49349238e4..c400aa6c3b 100644 --- a/libs/ardour/panner_search_path.cc +++ b/libs/ardour/panner_search_path.cc @@ -31,13 +31,15 @@ using namespace PBD; namespace ARDOUR { -SearchPath +Searchpath panner_search_path () { - SearchPath spath(user_config_directory ()); + Searchpath spath(user_config_directory ()); + spath += ardour_dll_directory (); spath.add_subdirectory_to_paths(panner_dir_name); - spath += SearchPath(Glib::getenv(panner_env_variable_name)); + spath += Searchpath(Glib::getenv(panner_env_variable_name)); + return spath; } diff --git a/libs/ardour/pcm_utils.cc b/libs/ardour/pcm_utils.cc index de3497d977..ae3bd4a4e0 100644 --- a/libs/ardour/pcm_utils.cc +++ b/libs/ardour/pcm_utils.cc @@ -17,8 +17,10 @@ */ +#ifdef COMPILER_MSVC +#include <ardourext/float_cast.h> +#endif #include "ardour/pcm_utils.h" - #include <cmath> using namespace std; diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index bb79801c9f..47462a3575 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1997,11 +1997,11 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir) freeze (); /* add the added regions */ - for (RegionListProperty::ChangeContainer::iterator i = change.added.begin(); i != change.added.end(); ++i) { + for (RegionListProperty::ChangeContainer::const_iterator i = change.added.begin(); i != change.added.end(); ++i) { add_region_internal ((*i), (*i)->position()); } /* remove the removed regions */ - for (RegionListProperty::ChangeContainer::iterator i = change.removed.begin(); i != change.removed.end(); ++i) { + for (RegionListProperty::ChangeContainer::const_iterator i = change.removed.begin(); i != change.removed.end(); ++i) { remove_region (*i); } @@ -2488,7 +2488,7 @@ Playlist::uses_source (boost::shared_ptr<const Source> src) const { RegionReadLock rlock (const_cast<Playlist*> (this)); - for (set<boost::shared_ptr<Region> >::iterator r = all_regions.begin(); r != all_regions.end(); ++r) { + for (set<boost::shared_ptr<Region> >::const_iterator r = all_regions.begin(); r != all_regions.end(); ++r) { if ((*r)->uses_source (src)) { return true; } @@ -2533,7 +2533,7 @@ Playlist::region_by_id (const ID& id) const { /* searches all regions ever added to this playlist */ - for (set<boost::shared_ptr<Region> >::iterator i = all_regions.begin(); i != all_regions.end(); ++i) { + for (set<boost::shared_ptr<Region> >::const_iterator i = all_regions.begin(); i != all_regions.end(); ++i) { if ((*i)->id() == id) { return *i; } diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index 9b2170c349..11d859ed8c 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -27,12 +27,16 @@ #include <cstdlib> #include <cstdio> // so libraptor doesn't complain #include <cmath> +#ifndef COMPILER_MSVC #include <dirent.h> +#endif #include <sys/stat.h> #include <cerrno> #include <utility> +#ifdef HAVE_LRDF #include <lrdf.h> +#endif #include "pbd/compose.h" #include "pbd/error.h" diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index 90522a7e06..e93566068b 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -25,11 +25,13 @@ #include <sys/types.h> #include <cstdio> -#include <lrdf.h> -#include <dlfcn.h> #include <cstdlib> #include <fstream> +#ifdef HAVE_LRDF +#include <lrdf.h> +#endif + #ifdef WINDOWS_VST_SUPPORT #include "fst.h" #include "pbd/basename.h" @@ -43,9 +45,11 @@ #endif //LXVST_SUPPORT #include <glibmm/miscutils.h> +#include <glibmm/pattern.h> #include "pbd/pathscanner.h" #include "pbd/whitespace.h" +#include "pbd/file_utils.h" #include "ardour/debug.h" #include "ardour/filesystem_paths.h" @@ -55,6 +59,8 @@ #include "ardour/plugin_manager.h" #include "ardour/rc_configuration.h" +#include "ardour/ladspa_search_path.h" + #ifdef LV2_SUPPORT #include "ardour/lv2_plugin.h" #endif @@ -77,6 +83,8 @@ #include "i18n.h" +#include "ardour/debug.h" + using namespace ARDOUR; using namespace PBD; using namespace std; @@ -126,10 +134,6 @@ PluginManager::PluginManager () } #endif /* Native LinuxVST support*/ - if ((s = getenv ("LADSPA_PATH"))) { - ladspa_path = s; - } - if ((s = getenv ("VST_PATH"))) { windows_vst_path = s; } else if ((s = getenv ("VST_PLUGINS"))) { @@ -198,91 +202,38 @@ PluginManager::refresh () void PluginManager::ladspa_refresh () { - if (_ladspa_plugin_info) + if (_ladspa_plugin_info) { _ladspa_plugin_info->clear (); - else + } else { _ladspa_plugin_info = new ARDOUR::PluginInfoList (); - - static const char *standard_paths[] = { - "/usr/local/lib64/ladspa", - "/usr/local/lib/ladspa", - "/usr/lib64/ladspa", - "/usr/lib/ladspa", - "/Library/Audio/Plug-Ins/LADSPA", - "" - }; + } /* allow LADSPA_PATH to augment, not override standard locations */ /* Only add standard locations to ladspa_path if it doesn't * already contain them. Check for trailing G_DIR_SEPARATOR too. */ + + vector<string> ladspa_modules; - int i; - for (i = 0; standard_paths[i][0]; i++) { - size_t found = ladspa_path.find(standard_paths[i]); - if (found != ladspa_path.npos) { - switch (ladspa_path[found + strlen(standard_paths[i])]) { - case ':' : - case '\0': - continue; - case G_DIR_SEPARATOR : - if (ladspa_path[found + strlen(standard_paths[i]) + 1] == ':' || - ladspa_path[found + strlen(standard_paths[i]) + 1] == '\0') { - continue; - } - } - } - if (!ladspa_path.empty()) - ladspa_path += ":"; - - ladspa_path += standard_paths[i]; - - } - - DEBUG_TRACE (DEBUG::PluginManager, string_compose ("LADSPA: search along: [%1]\n", ladspa_path)); - - ladspa_discover_from_path (ladspa_path); -} - - -int -PluginManager::add_ladspa_directory (string path) -{ - if (ladspa_discover_from_path (path) == 0) { - ladspa_path += ':'; - ladspa_path += path; - return 0; - } - return -1; -} - -static bool ladspa_filter (const string& str, void */*arg*/) -{ - /* Not a dotfile, has a prefix before a period, suffix is "so" */ - - return str[0] != '.' && (str.length() > 3 && str.find (".so") == (str.length() - 3)); -} + DEBUG_TRACE (DEBUG::PluginManager, string_compose ("LADSPA: search along: [%1]\n", ladspa_search_path().to_string())); -int -PluginManager::ladspa_discover_from_path (string /*path*/) -{ - PathScanner scanner; - vector<string *> *plugin_objects; - vector<string *>::iterator x; - int ret = 0; + Glib::PatternSpec so_extension_pattern("*.so"); + Glib::PatternSpec dylib_extension_pattern("*.dylib"); + Glib::PatternSpec dll_extension_pattern("*.dll"); - plugin_objects = scanner (ladspa_path, ladspa_filter, 0, false, true); + find_matching_files_in_search_path (ladspa_search_path (), + so_extension_pattern, ladspa_modules); - if (plugin_objects) { - for (x = plugin_objects->begin(); x != plugin_objects->end (); ++x) { - ladspa_discover (**x); - } + find_matching_files_in_search_path (ladspa_search_path (), + dylib_extension_pattern, ladspa_modules); + + find_matching_files_in_search_path (ladspa_search_path (), + dll_extension_pattern, ladspa_modules); - vector_delete (plugin_objects); + for (vector<std::string>::iterator i = ladspa_modules.begin(); i != ladspa_modules.end(); ++i) { + ladspa_discover (*i); } - - return ret; } static bool rdf_filter (const string &str, void* /*arg*/) @@ -315,7 +266,7 @@ PluginManager::add_lxvst_presets() void PluginManager::add_presets(string domain) { - +#ifdef HAVE_LRDF PathScanner scanner; vector<string *> *presets; vector<string *>::iterator x; @@ -338,11 +289,13 @@ PluginManager::add_presets(string domain) vector_delete (presets); } +#endif } void PluginManager::add_lrdf_data (const string &path) { +#ifdef HAVE_LRDF PathScanner scanner; vector<string *>* rdf_files; vector<string *>::iterator x; @@ -360,30 +313,36 @@ PluginManager::add_lrdf_data (const string &path) vector_delete (rdf_files); } +#endif } int PluginManager::ladspa_discover (string path) { - void *module; + DEBUG_TRACE (DEBUG::PluginManager, string_compose ("Checking for LADSPA plugin at %1\n", path)); + + Glib::Module module(path); const LADSPA_Descriptor *descriptor; LADSPA_Descriptor_Function dfunc; - const char *errstr; + void* func = 0; - if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) { - error << string_compose(_("LADSPA: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg; + if (!module) { + error << string_compose(_("LADSPA: cannot load module \"%1\" (%2)"), + path, Glib::Module::get_last_error()) << endmsg; return -1; } - dfunc = (LADSPA_Descriptor_Function) dlsym (module, "ladspa_descriptor"); - if ((errstr = dlerror()) != 0) { + if (!module.get_symbol("ladspa_descriptor", func)) { error << string_compose(_("LADSPA: module \"%1\" has no descriptor function."), path) << endmsg; - error << errstr << endmsg; - dlclose (module); + error << Glib::Module::get_last_error() << endmsg; return -1; } + dfunc = (LADSPA_Descriptor_Function)func; + + DEBUG_TRACE (DEBUG::PluginManager, string_compose ("LADSPA plugin found at %1\n", path)); + for (uint32_t i = 0; ; ++i) { if ((descriptor = dfunc (i)) == 0) { break; @@ -437,6 +396,8 @@ PluginManager::ladspa_discover (string path) if(!found){ _ladspa_plugin_info->push_back (info); } + + DEBUG_TRACE (DEBUG::PluginManager, string_compose ("Found LADSPA plugin, name: %1, Inputs: %2, Outputs: %3\n", info->name, info->n_inputs, info->n_outputs)); } // GDB WILL NOT LIKE YOU IF YOU DO THIS @@ -448,6 +409,7 @@ PluginManager::ladspa_discover (string path) string PluginManager::get_ladspa_category (uint32_t plugin_id) { +#ifdef HAVE_LRDF char buf[256]; lrdf_statement pattern; @@ -505,6 +467,9 @@ PluginManager::get_ladspa_category (uint32_t plugin_id) } else { return label; } +#else + return ("Unknown"); +#endif } #ifdef LV2_SUPPORT @@ -678,6 +643,10 @@ PluginManager::lxvst_discover_from_path (string path) vector<string *>::iterator x; int ret = 0; +#ifndef NDEBUG + (void) path; +#endif + DEBUG_TRACE (DEBUG::PluginManager, string_compose ("Discovering linuxVST plugins along %1\n", path)); plugin_objects = scanner (lxvst_path, lxvst_filter, 0, false, true); diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc index cf961d6828..bc5d26fb80 100644 --- a/libs/ardour/port.cc +++ b/libs/ardour/port.cc @@ -21,7 +21,9 @@ #include "libardour-config.h" #endif +#ifndef PLATFORM_WINDOWS #include <jack/weakjack.h> // so that we can test for new functions at runtime +#endif #include "pbd/compose.h" #include "pbd/error.h" diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index c352e22e55..fa09ea05ac 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -249,7 +249,9 @@ PortInsert::signal_latency() const bool PortInsert::configure_io (ChanCount in, ChanCount out) { +#ifndef PLATFORM_WINDOWS assert (!AudioEngine::instance()->process_lock().trylock()); +#endif /* for an insert, processor input corresponds to IO output, and vice versa */ diff --git a/libs/ardour/port_set.cc b/libs/ardour/port_set.cc index 6096e356f5..c7f5e2e674 100644 --- a/libs/ardour/port_set.cc +++ b/libs/ardour/port_set.cc @@ -56,7 +56,7 @@ static bool sort_ports_by_name (boost::shared_ptr<Port> a, boost::shared_ptr<Por // if some of the names don't have a number as posfix, compare as strings - if (last_digit_position_a == aname.size() or last_digit_position_b == bname.size()) { + if (last_digit_position_a == aname.size() || last_digit_position_b == bname.size()) { return aname < bname; } diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc index f4612699d4..7fe030fb7e 100644 --- a/libs/ardour/rc_configuration.cc +++ b/libs/ardour/rc_configuration.cc @@ -72,7 +72,7 @@ int RCConfiguration::load_state () { std::string rcfile; - struct stat statbuf; + GStatBuf statbuf; /* load system configuration first */ diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 3b9dc308ec..1784cdbf3c 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -698,33 +698,32 @@ Region::set_start (framepos_t pos) } void -Region::trim_start (framepos_t new_position) +Region::move_start (frameoffset_t distance) { if (locked() || position_locked() || video_locked()) { return; } framepos_t new_start; - frameoffset_t const start_shift = new_position - _position; - if (start_shift > 0) { + if (distance > 0) { - if (_start > max_framepos - start_shift) { - new_start = max_framepos; + if (_start > max_framepos - distance) { + new_start = max_framepos; // makes no sense } else { - new_start = _start + start_shift; + new_start = _start + distance; } if (!verify_start (new_start)) { return; } - } else if (start_shift < 0) { + } else if (distance < 0) { - if (_start < -start_shift) { + if (_start < -distance) { new_start = 0; } else { - new_start = _start + start_shift; + new_start = _start + distance; } } else { @@ -736,6 +735,7 @@ Region::trim_start (framepos_t new_position) } set_start_internal (new_start); + _whole_file = false; first_edit (); diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc index 3e81524750..44f8c34ddd 100644 --- a/libs/ardour/region_factory.cc +++ b/libs/ardour/region_factory.cc @@ -564,7 +564,7 @@ RegionFactory::new_region_name (string old) uint32_t number; string::size_type len = old.length() + 64; string remainder; - char buf[len]; + std::vector<char> buf(len); if ((last_period = old.find_last_of ('.')) == string::npos) { @@ -603,8 +603,8 @@ RegionFactory::new_region_name (string old) number++; - snprintf (buf, len, "%s%" PRIu32 "%s", old.substr (0, last_period + 1).c_str(), number, remainder.c_str()); - sbuf = buf; + snprintf (&buf[0], len, "%s%" PRIu32 "%s", old.substr (0, last_period + 1).c_str(), number, remainder.c_str()); + sbuf = &buf[0]; if (region_name_map.find (sbuf) == region_name_map.end ()) { break; @@ -612,7 +612,7 @@ RegionFactory::new_region_name (string old) } if (number != (UINT_MAX-1)) { - return buf; + return &buf[0]; } error << string_compose (_("cannot create new name for region \"%1\""), old) << endmsg; diff --git a/libs/ardour/resampled_source.cc b/libs/ardour/resampled_source.cc index 6184e1a3d6..0a81319108 100644 --- a/libs/ardour/resampled_source.cc +++ b/libs/ardour/resampled_source.cc @@ -26,7 +26,11 @@ using namespace ARDOUR; using namespace PBD; +#ifdef PLATFORM_WINDOWS +const uint32_t ResampledImportableSource::blocksize = 524288U; +#else const uint32_t ResampledImportableSource::blocksize = 16384U; +#endif ResampledImportableSource::ResampledImportableSource (boost::shared_ptr<ImportableSource> src, framecnt_t rate, SrcQuality srcq) : source (src) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 046bf7998e..7eb50c7695 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -1070,7 +1070,8 @@ Route::add_processor_from_xml_2X (const XMLNode& node, int version) } else if (node.name() == "Send") { - processor.reset (new Send (_session, _pannable, _mute_master)); + boost::shared_ptr<Pannable> sendpan (new Pannable (_session)); + processor.reset (new Send (_session, sendpan, _mute_master)); } else { @@ -1638,7 +1639,10 @@ Route::reset_instrument_info () int Route::configure_processors (ProcessorStreams* err) { +#ifndef PLATFORM_WINDOWS assert (!AudioEngine::instance()->process_lock().trylock()); +#endif + if (!_in_configure_processors) { Glib::Threads::RWLock::WriterLock lm (_processor_lock); return configure_processors_unlocked (err); @@ -1708,7 +1712,9 @@ Route::try_configure_processors_unlocked (ChanCount in, ProcessorStreams* err) int Route::configure_processors_unlocked (ProcessorStreams* err) { +#ifndef PLATFORM_WINDOWS assert (!AudioEngine::instance()->process_lock().trylock()); +#endif if (_in_configure_processors) { return 0; @@ -2759,7 +2765,8 @@ Route::add_aux_send (boost::shared_ptr<Route> route, boost::shared_ptr<Processor { Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ()); - listener.reset (new InternalSend (_session, _pannable, _mute_master, route, Delivery::Aux)); + boost::shared_ptr<Pannable> sendpan (new Pannable (_session)); + listener.reset (new InternalSend (_session, sendpan, _mute_master, route, Delivery::Aux)); } add_processor (listener, before); @@ -2846,7 +2853,7 @@ Route::feeds (boost::shared_ptr<Route> other, bool* via_sends_only) { const FedBy& fed_by (other->fed_by()); - for (FedBy::iterator f = fed_by.begin(); f != fed_by.end(); ++f) { + for (FedBy::const_iterator f = fed_by.begin(); f != fed_by.end(); ++f) { boost::shared_ptr<Route> sr = f->r.lock(); if (sr && (sr.get() == this)) { diff --git a/libs/ardour/route_group_member.cc b/libs/ardour/route_group_member.cc index 85d2f981d7..3caa7cd1d0 100644 --- a/libs/ardour/route_group_member.cc +++ b/libs/ardour/route_group_member.cc @@ -16,6 +16,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "ardour/libardour_visibility.h" #include "ardour/route_group_member.h" using namespace ARDOUR; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 53d670a1f4..d93d689459 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -44,8 +44,8 @@ #include "pbd/stacktrace.h" #include "pbd/file_utils.h" #include "pbd/convert.h" -#include "pbd/strsplit.h" #include "pbd/unwind.h" +#include "pbd/search_path.h" #include "ardour/amp.h" #include "ardour/analyser.h" @@ -4595,18 +4595,18 @@ Session::end_time_changed (framepos_t old) } } -string +std::vector<std::string> Session::source_search_path (DataType type) const { - vector<string> s; + Searchpath sp; if (session_dirs.size() == 1) { switch (type) { case DataType::AUDIO: - s.push_back (_session_dir->sound_path()); + sp.push_back (_session_dir->sound_path()); break; case DataType::MIDI: - s.push_back (_session_dir->midi_path()); + sp.push_back (_session_dir->midi_path()); break; } } else { @@ -4614,10 +4614,10 @@ Session::source_search_path (DataType type) const SessionDirectory sdir (i->path); switch (type) { case DataType::AUDIO: - s.push_back (sdir.sound_path()); + sp.push_back (sdir.sound_path()); break; case DataType::MIDI: - s.push_back (sdir.midi_path()); + sp.push_back (sdir.midi_path()); break; } } @@ -4626,49 +4626,30 @@ Session::source_search_path (DataType type) const if (type == DataType::AUDIO) { const string sound_path_2X = _session_dir->sound_path_2X(); if (Glib::file_test (sound_path_2X, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_DIR)) { - if (find (s.begin(), s.end(), sound_path_2X) == s.end()) { - s.push_back (sound_path_2X); + if (find (sp.begin(), sp.end(), sound_path_2X) == sp.end()) { + sp.push_back (sound_path_2X); } } } - /* now check the explicit (possibly user-specified) search path - */ - - vector<string> dirs; + // now check the explicit (possibly user-specified) search path switch (type) { case DataType::AUDIO: - split (config.get_audio_search_path (), dirs, ':'); + sp += Searchpath(config.get_audio_search_path ()); break; case DataType::MIDI: - split (config.get_midi_search_path (), dirs, ':'); + sp += Searchpath(config.get_midi_search_path ()); break; } - for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) { - if (find (s.begin(), s.end(), *i) == s.end()) { - s.push_back (*i); - } - } - - string search_path; - - for (vector<string>::iterator si = s.begin(); si != s.end(); ++si) { - if (!search_path.empty()) { - search_path += ':'; - } - search_path += *si; - } - - return search_path; + return sp; } void Session::ensure_search_path_includes (const string& path, DataType type) { - string search_path; - vector<string> dirs; + Searchpath sp; if (path == ".") { return; @@ -4676,16 +4657,14 @@ Session::ensure_search_path_includes (const string& path, DataType type) switch (type) { case DataType::AUDIO: - search_path = config.get_audio_search_path (); + sp += Searchpath(config.get_audio_search_path ()); break; case DataType::MIDI: - search_path = config.get_midi_search_path (); + sp += Searchpath (config.get_midi_search_path ()); break; } - split (search_path, dirs, ':'); - - for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) { + for (vector<std::string>::iterator i = sp.begin(); i != sp.end(); ++i) { /* No need to add this new directory if it has the same inode as an existing one; checking inode rather than name prevents duplicated directories when we are using symlinks. @@ -4697,18 +4676,14 @@ Session::ensure_search_path_includes (const string& path, DataType type) } } - if (!search_path.empty()) { - search_path += ':'; - } - - search_path += path; + sp += path; switch (type) { case DataType::AUDIO: - config.set_audio_search_path (search_path); + config.set_audio_search_path (sp.to_string()); break; case DataType::MIDI: - config.set_midi_search_path (search_path); + config.set_midi_search_path (sp.to_string()); break; } } diff --git a/libs/ardour/session_butler.cc b/libs/ardour/session_butler.cc index 1d235b051a..3e7c2226cc 100644 --- a/libs/ardour/session_butler.cc +++ b/libs/ardour/session_butler.cc @@ -17,16 +17,6 @@ */ -#include <algorithm> -#include <string> -#include <cmath> -#include <cerrno> -#include <unistd.h> -#include <fcntl.h> -#include <poll.h> - -#include <glibmm/threads.h> - #include "pbd/error.h" #include "pbd/pthread_utils.h" #include "pbd/stacktrace.h" diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index 6c828ac6f0..19034da247 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -23,6 +23,7 @@ #include "pbd/error.h" #include "pbd/enumwriter.h" #include "pbd/stacktrace.h" +#include "pbd/pthread_utils.h" #include "ardour/debug.h" #include "ardour/session_event.h" @@ -56,7 +57,7 @@ SessionEvent::operator new (size_t) { CrossThreadPool* p = pool->per_thread_pool (); SessionEvent* ev = static_cast<SessionEvent*> (p->alloc ()); - DEBUG_TRACE (DEBUG::SessionEvents, string_compose ("%1 Allocating SessionEvent from %2 ev @ %3\n", pthread_self(), p->name(), ev)); + DEBUG_TRACE (DEBUG::SessionEvents, string_compose ("%1 Allocating SessionEvent from %2 ev @ %3\n", pthread_name(), p->name(), ev)); #ifndef NDEBUG if (DEBUG::SessionEvents & PBD::debug_bits) { stacktrace (cerr, 40); @@ -74,7 +75,7 @@ SessionEvent::operator delete (void *ptr, size_t /*size*/) DEBUG_TRACE (DEBUG::SessionEvents, string_compose ( "%1 Deleting SessionEvent @ %2 ev thread pool = %3 ev pool = %4\n", - pthread_self(), ev, p->name(), ev->own_pool->name() + pthread_name(), ev, p->name(), ev->own_pool->name() )); #ifndef NDEBUG diff --git a/libs/ardour/session_ltc.cc b/libs/ardour/session_ltc.cc index b2fbaf602c..2ce25b5a48 100644 --- a/libs/ardour/session_ltc.cc +++ b/libs/ardour/session_ltc.cc @@ -31,7 +31,6 @@ using namespace std; using namespace ARDOUR; -using namespace MIDI; using namespace PBD; using namespace Timecode; diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 6d3083df77..ea6dfe81cf 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -22,8 +22,6 @@ #include <cerrno> #include <cassert> #include <unistd.h> -#include <fcntl.h> -#include <poll.h> #include <boost/shared_ptr.hpp> @@ -34,6 +32,7 @@ #include "pbd/error.h" #include "pbd/pthread_utils.h" +#include "pbd/timersub.h" #include "timecode/time.h" @@ -349,7 +348,7 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled) * @param t time to send. */ int -Session::send_full_time_code (framepos_t const t, pframes_t nframes) +Session::send_full_time_code (framepos_t const t, MIDI::pframes_t nframes) { /* This function could easily send at a given frame offset, but would * that be useful? Does ardour do sub-block accurate locating? [DR] */ @@ -440,7 +439,7 @@ Session::send_full_time_code (framepos_t const t, pframes_t nframes) * earlier already this cycle by send_full_time_code) */ int -Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_frame, pframes_t nframes) +Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_frame, ARDOUR::pframes_t nframes) { if (_engine.freewheeling() || !_send_qf_mtc || transmitting_timecode_time.negative || (next_quarter_frame_to_send < 0)) { // cerr << "(MTC) Not sending MTC\n"; @@ -512,7 +511,7 @@ Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_f assert (msg_time < end_frame); /* convert from session frames back to JACK frames using the transport speed */ - pframes_t const out_stamp = (msg_time - start_frame) / _transport_speed; + ARDOUR::pframes_t const out_stamp = (msg_time - start_frame) / _transport_speed; assert (out_stamp < nframes); MidiBuffer& mb (_midi_ports->mtc_output_port()->get_midi_buffer(nframes)); diff --git a/libs/ardour/session_playlists.cc b/libs/ardour/session_playlists.cc index b2c4640880..b586ab196e 100644 --- a/libs/ardour/session_playlists.cc +++ b/libs/ardour/session_playlists.cc @@ -221,11 +221,11 @@ SessionPlaylists::get (vector<boost::shared_ptr<Playlist> >& s) const { Glib::Threads::Mutex::Lock lm (lock); - for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) { + for (List::const_iterator i = playlists.begin(); i != playlists.end(); ++i) { s.push_back (*i); } - for (List::iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) { + for (List::const_iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) { s.push_back (*i); } } @@ -448,11 +448,11 @@ SessionPlaylists::region_use_count (boost::shared_ptr<Region> region) const Glib::Threads::Mutex::Lock lm (lock); uint32_t cnt = 0; - for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) { + for (List::const_iterator i = playlists.begin(); i != playlists.end(); ++i) { cnt += (*i)->region_use_count (region); } - for (List::iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) { + for (List::const_iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) { cnt += (*i)->region_use_count (region); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index f3ad9d66dd..5c3ffae3cc 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -33,15 +33,14 @@ #include <unistd.h> #include <sys/stat.h> #include <climits> -#include <fcntl.h> -#include <poll.h> #include <signal.h> -#include <sys/mman.h> #include <sys/time.h> #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h> -#else +#endif + +#ifdef __APPLE__ #include <sys/param.h> #include <sys/mount.h> #endif @@ -69,11 +68,13 @@ #include "pbd/enumwriter.h" #include "pbd/error.h" #include "pbd/file_utils.h" +#include "pbd/pathexpand.h" #include "pbd/pathscanner.h" #include "pbd/pthread_utils.h" #include "pbd/stacktrace.h" #include "pbd/convert.h" #include "pbd/clear_dir.h" +#include "pbd/localtime_r.h" #include "ardour/amp.h" #include "ardour/audio_diskstream.h" @@ -135,14 +136,7 @@ Session::pre_engine_init (string fullpath) /* discover canonical fullpath */ - char buf[PATH_MAX+1]; - if (!realpath (fullpath.c_str(), buf) && (errno != ENOENT)) { - error << string_compose(_("Could not use path %1 (%2)"), buf, strerror(errno)) << endmsg; - destroy (); - throw failed_constructor(); - } - - _path = string(buf); + _path = canonical_path(fullpath); /* we require _path to end with a dir separator */ @@ -355,7 +349,7 @@ Session::post_engine_init () string Session::raid_path () const { - SearchPath raid_search_path; + Searchpath raid_search_path; for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) { raid_search_path += (*i).path; @@ -376,11 +370,11 @@ Session::setup_raid_path (string path) session_dirs.clear (); - SearchPath search_path(path); - SearchPath sound_search_path; - SearchPath midi_search_path; + Searchpath search_path(path); + Searchpath sound_search_path; + Searchpath midi_search_path; - for (SearchPath::const_iterator i = search_path.begin(); i != search_path.end(); ++i) { + for (Searchpath::const_iterator i = search_path.begin(); i != search_path.end(); ++i) { sp.path = *i; sp.blocks = 0; // not needed session_dirs.push_back (sp); @@ -726,9 +720,9 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot } else { - if (::rename (tmp_path.c_str(), xml_path.c_str()) != 0) { - error << string_compose (_("could not rename temporary session file %1 to %2"), - tmp_path, xml_path) << endmsg; + if (::g_rename (tmp_path.c_str(), xml_path.c_str()) != 0) { + error << string_compose (_("could not rename temporary session file %1 to %2 (%3)"), + tmp_path, xml_path, g_strerror(errno)) << endmsg; if (g_remove (tmp_path.c_str()) != 0) { error << string_compose(_("Could not remove temporary session file at path \"%1\" (%2)"), tmp_path, g_strerror (errno)) << endmsg; @@ -2041,6 +2035,54 @@ Session::refresh_disk_space () _total_free_4k_blocks_uncertain = true; } } +#elif defined (COMPILER_MSVC) + vector<string> scanned_volumes; + vector<string>::iterator j; + vector<space_and_path>::iterator i; + DWORD nSectorsPerCluster, nBytesPerSector, + nFreeClusters, nTotalClusters; + char disk_drive[4]; + bool volume_found; + + _total_free_4k_blocks = 0; + + for (i = session_dirs.begin(); i != session_dirs.end(); i++) { + strncpy (disk_drive, (*i).path.c_str(), 3); + disk_drive[3] = 0; + strupr(disk_drive); + + volume_found = false; + if (0 != (GetDiskFreeSpace(disk_drive, &nSectorsPerCluster, &nBytesPerSector, &nFreeClusters, &nTotalClusters))) + { + int64_t nBytesPerCluster = nBytesPerSector * nSectorsPerCluster; + int64_t nFreeBytes = nBytesPerCluster * (int64_t)nFreeClusters; + i->blocks = (uint32_t)(nFreeBytes / 4096); + + for (j = scanned_volumes.begin(); j != scanned_volumes.end(); j++) { + if (0 == j->compare(disk_drive)) { + volume_found = true; + break; + } + } + + if (!volume_found) { + scanned_volumes.push_back(disk_drive); + _total_free_4k_blocks += i->blocks; + } + } + } + + if (0 == _total_free_4k_blocks) { + strncpy (disk_drive, path().c_str(), 3); + disk_drive[3] = 0; + + if (0 != (GetDiskFreeSpace(disk_drive, &nSectorsPerCluster, &nBytesPerSector, &nFreeClusters, &nTotalClusters))) + { + int64_t nBytesPerCluster = nBytesPerSector * nSectorsPerCluster; + int64_t nFreeBytes = nBytesPerCluster * (int64_t)nFreeClusters; + _total_free_4k_blocks = (uint32_t)(nFreeBytes / 4096); + } + } #endif } @@ -2227,7 +2269,7 @@ Session::auto_save() } static bool -state_file_filter (const string &str, void */*arg*/) +state_file_filter (const string &str, void* /*arg*/) { return (str.length() > strlen(statefile_suffix) && str.find (statefile_suffix) == (str.length() - strlen (statefile_suffix))); @@ -2404,7 +2446,7 @@ Session::commit_reversible_command (Command *cmd) } static bool -accept_all_audio_files (const string& path, void */*arg*/) +accept_all_audio_files (const string& path, void* /*arg*/) { if (!Glib::file_test (path, Glib::FILE_TEST_IS_REGULAR)) { return false; @@ -2418,7 +2460,7 @@ accept_all_audio_files (const string& path, void */*arg*/) } static bool -accept_all_midi_files (const string& path, void */*arg*/) +accept_all_midi_files (const string& path, void* /*arg*/) { if (!Glib::file_test (path, Glib::FILE_TEST_IS_REGULAR)) { return false; @@ -2430,7 +2472,7 @@ accept_all_midi_files (const string& path, void */*arg*/) } static bool -accept_all_state_files (const string& path, void */*arg*/) +accept_all_state_files (const string& path, void* /*arg*/) { if (!Glib::file_test (path, Glib::FILE_TEST_IS_REGULAR)) { return false; @@ -2586,6 +2628,8 @@ Session::cleanup_sources (CleanupReport& rep) bool used; string spath; int ret = -1; + string tmppath1; + string tmppath2; _state_of_the_state = (StateOfTheState) (_state_of_the_state | InCleanup); @@ -2710,9 +2754,6 @@ Session::cleanup_sources (CleanupReport& rep) i = tmp; } - char tmppath1[PATH_MAX+1]; - char tmppath2[PATH_MAX+1]; - if (candidates) { for (vector<string*>::iterator x = candidates->begin(); x != candidates->end(); ++x) { @@ -2721,19 +2762,10 @@ Session::cleanup_sources (CleanupReport& rep) for (set<string>::iterator i = all_sources.begin(); i != all_sources.end(); ++i) { - if (realpath(spath.c_str(), tmppath1) == 0) { - error << string_compose (_("Cannot expand path %1 (%2)"), - spath, strerror (errno)) << endmsg; - continue; - } - - if (realpath((*i).c_str(), tmppath2) == 0) { - error << string_compose (_("Cannot expand path %1 (%2)"), - (*i), strerror (errno)) << endmsg; - continue; - } + tmppath1 = canonical_path (spath); + tmppath2 = canonical_path ((*i)); - if (strcmp(tmppath1, tmppath2) == 0) { + if (tmppath1 == tmppath2) { used = true; break; } @@ -2837,7 +2869,7 @@ Session::cleanup_sources (CleanupReport& rep) string peakpath = peak_path (base); if (Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) { - if (::unlink (peakpath.c_str()) != 0) { + if (::g_unlink (peakpath.c_str()) != 0) { error << string_compose (_("cannot remove peakfile %1 for %2 (%3)"), peakpath, _path, strerror (errno)) << endmsg; diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index 830fd75fdf..d915bba845 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -30,6 +30,7 @@ #include "pbd/stl_delete.h" #include "pbd/strsplit.h" +#include <glib/gstdio.h> #include <glibmm/miscutils.h> #include "evoral/Control.hpp" @@ -96,7 +97,7 @@ SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist) SMFSource::~SMFSource () { if (removable()) { - unlink (_path.c_str()); + ::g_unlink (_path.c_str()); } } diff --git a/libs/ardour/sndfile_helpers.cc b/libs/ardour/sndfile_helpers.cc index 459890e829..2e618e043b 100644 --- a/libs/ardour/sndfile_helpers.cc +++ b/libs/ardour/sndfile_helpers.cc @@ -17,7 +17,9 @@ */ +#ifndef COMPILER_MSVC #include <strings.h> +#endif #include <map> #include <sndfile.h> diff --git a/libs/ardour/sndfileimportable.cc b/libs/ardour/sndfileimportable.cc index c9f6c4014f..ceb88eddc9 100644 --- a/libs/ardour/sndfileimportable.cc +++ b/libs/ardour/sndfileimportable.cc @@ -51,7 +51,7 @@ SndFileImportableSource::read (Sample* buffer, framecnt_t nframes) return per_channel * sf_info.channels; } -uint +uint32_t SndFileImportableSource::channels () const { return sf_info.channels; diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index cf75cffba3..1c3144f164 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -26,10 +26,11 @@ #include <climits> #include <cstdarg> -#include <pwd.h> -#include <sys/utsname.h> #include <sys/stat.h> +#ifdef PLATFORM_WINDOWS +#include <glibmm/convert.h> +#endif #include <glibmm/miscutils.h> #include "ardour/sndfilesource.h" @@ -184,22 +185,30 @@ SndFileSource::init_sndfile () int SndFileSource::open () { - _descriptor = new SndFileDescriptor (_path, writable(), &_info); + string path_to_open; + +#ifdef PLATFORM_WINDOWS + path_to_open = Glib::locale_from_utf8(_path); +#else + path_to_open = _path; +#endif + + _descriptor = new SndFileDescriptor (path_to_open.c_str(), writable(), &_info); _descriptor->Closed.connect_same_thread (file_manager_connection, boost::bind (&SndFileSource::file_closed, this)); SNDFILE* sf = _descriptor->allocate (); if (sf == 0) { - char errbuf[256]; + char errbuf[1024]; sf_error_str (0, errbuf, sizeof (errbuf) - 1); #ifndef HAVE_COREAUDIO /* if we have CoreAudio, we will be falling back to that if libsndfile fails, so we don't want to see this message. */ - cerr << "failed to open " << _path << " with name " << _name << endl; + cerr << "failed to open " << path_to_open << " with name " << _name << endl; error << string_compose(_("SndFileSource: cannot open file \"%1\" for %2 (%3)"), - _path, (writable() ? "read+write" : "reading"), errbuf) << endmsg; + path_to_open, (writable() ? "read+write" : "reading"), errbuf) << endmsg; #endif return -1; } @@ -253,7 +262,7 @@ SndFileSource::open () if (!_broadcast_info->write_to_file (sf)) { error << string_compose (_("cannot set broadcast info for audio file %1 (%2); dropping broadcast info for this file"), - _path, _broadcast_info->get_error()) + path_to_open, _broadcast_info->get_error()) << endmsg; _flags = Flag (_flags & ~Broadcast); delete _broadcast_info; @@ -541,6 +550,30 @@ SndFileSource::flush_header () return r; } +void +SndFileSource::flush () +{ + if (!_open) { + warning << string_compose (_("attempt to flush an un-opened audio file source (%1)"), _path) << endmsg; + return; + } + + if (!writable()) { + warning << string_compose (_("attempt to flush a non-writable audio file source (%1)"), _path) << endmsg; + return; + } + + SNDFILE* sf = _descriptor->allocate (); + if (sf == 0) { + error << string_compose (_("could not allocate file %1 to flush contents"), _path) << endmsg; + return; + } + + // Hopefully everything OK + sf_write_sync (sf); + _descriptor->release (); +} + int SndFileSource::setup_broadcast_info (framepos_t /*when*/, struct tm& now, time_t /*tnow*/) { @@ -768,12 +801,12 @@ SndFileSource::crossfade (Sample* data, framecnt_t cnt, int fade_in) } else if (xfade < xfade_frames) { - gain_t in[xfade]; - gain_t out[xfade]; + std::vector<gain_t> in(xfade); + std::vector<gain_t> out(xfade); /* short xfade, compute custom curve */ - compute_equal_power_fades (xfade, in, out); + compute_equal_power_fades (xfade, &in[0], &out[0]); for (framecnt_t n = 0; n < xfade; ++n) { xfade_buf[n] = (xfade_buf[n] * out[n]) + (fade_data[n] * in[n]); diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index 618dddc70b..03039fea5b 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -19,8 +19,6 @@ #include <sys/stat.h> #include <unistd.h> -#include <fcntl.h> -#include <poll.h> #include <float.h> #include <cerrno> #include <ctime> diff --git a/libs/ardour/sse_functions_xmm.cc b/libs/ardour/sse_functions_xmm.cc index 48212ea8e1..f8a53cc6f8 100644 --- a/libs/ardour/sse_functions_xmm.cc +++ b/libs/ardour/sse_functions_xmm.cc @@ -45,8 +45,11 @@ x86_sse_find_peaks(const ARDOUR::Sample* buf, ARDOUR::pframes_t nframes, float * // use 64 byte prefetch for quadruple quads while (nframes >= 16) { +#ifdef COMPILER_MSVC + _mm_prefetch(((char*)buf+64), 0); // A total guess! Assumed to be eqivalent to +#else // the line below but waiting to be tested !! __builtin_prefetch(buf+64,0,0); - +#endif work = _mm_load_ps(buf); current_min = _mm_min_ps(current_min, work); current_max = _mm_max_ps(current_max, work); diff --git a/libs/ardour/template_utils.cc b/libs/ardour/template_utils.cc index 05007b0ade..b912fdc446 100644 --- a/libs/ardour/template_utils.cc +++ b/libs/ardour/template_utils.cc @@ -37,18 +37,18 @@ using namespace PBD; namespace ARDOUR { -SearchPath +Searchpath template_search_path () { - SearchPath spath (ardour_data_search_path()); + Searchpath spath (ardour_data_search_path()); spath.add_subdirectory_to_paths(templates_dir_name); return spath; } -SearchPath +Searchpath route_template_search_path () { - SearchPath spath (ardour_data_search_path()); + Searchpath spath (ardour_data_search_path()); spath.add_subdirectory_to_paths(route_templates_dir_name); return spath; } @@ -66,7 +66,7 @@ user_route_template_directory () } static bool -template_filter (const string &str, void */*arg*/) +template_filter (const string &str, void* /*arg*/) { if (!Glib::file_test (str, Glib::FILE_TEST_IS_DIR)) { return false; @@ -76,7 +76,7 @@ template_filter (const string &str, void */*arg*/) } static bool -route_template_filter (const string &str, void */*arg*/) +route_template_filter (const string &str, void* /*arg*/) { if (str.find (template_suffix) == str.length() - strlen (template_suffix)) { return true; @@ -97,7 +97,7 @@ find_session_templates (vector<TemplateInfo>& template_names) { vector<string *> *templates; PathScanner scanner; - SearchPath spath (template_search_path()); + Searchpath spath (template_search_path()); templates = scanner (spath.to_string(), template_filter, 0, true, true); @@ -133,7 +133,7 @@ find_route_templates (vector<TemplateInfo>& template_names) { vector<string *> *templates; PathScanner scanner; - SearchPath spath (route_template_search_path()); + Searchpath spath (route_template_search_path()); templates = scanner (spath.to_string(), route_template_filter, 0, false, true); diff --git a/libs/ardour/test/audio_engine_test.cc b/libs/ardour/test/audio_engine_test.cc new file mode 100644 index 0000000000..b992caf73e --- /dev/null +++ b/libs/ardour/test/audio_engine_test.cc @@ -0,0 +1,53 @@ +#include <iostream> + +#include "ardour/audioengine.h" +#include "ardour/audio_backend.h" +#include "ardour/backend_search_path.h" + +#include "audio_engine_test.h" +#include "test_common.h" + +CPPUNIT_TEST_SUITE_REGISTRATION (AudioEngineTest); + +using namespace std; +using namespace ARDOUR; +using namespace PBD; + +void +print_audio_backend_info (AudioBackendInfo const* abi) +{ + cerr << "Audio Backend, name:" << abi->name << endl; +} + +void +AudioEngineTest::test_backends () +{ + AudioEngine* engine = AudioEngine::create (); + + CPPUNIT_ASSERT (engine); + + std::vector<AudioBackendInfo const *> backends = engine->available_backends (); + + CPPUNIT_ASSERT (backends.size () != 0); + + for (std::vector<AudioBackendInfo const *>::const_iterator i = backends.begin(); + i != backends.end(); ++i) { + print_audio_backend_info(*i); + } +} + +void +AudioEngineTest::test_start () +{ + AudioEngine* engine = AudioEngine::create (); + + CPPUNIT_ASSERT_NO_THROW (engine->set_default_backend ()); + + init_post_engine (); + + CPPUNIT_ASSERT (engine->start () == 0); + + // sleep + // stop + // destroy +} diff --git a/libs/ardour/test/audio_engine_test.h b/libs/ardour/test/audio_engine_test.h new file mode 100644 index 0000000000..9a6d9cc241 --- /dev/null +++ b/libs/ardour/test/audio_engine_test.h @@ -0,0 +1,14 @@ +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> + +class AudioEngineTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE (AudioEngineTest); + CPPUNIT_TEST (test_backends); + CPPUNIT_TEST (test_start); + CPPUNIT_TEST_SUITE_END (); + +public: + void test_backends (); + void test_start (); +}; diff --git a/libs/ardour/test/jack_utils_test.cc b/libs/ardour/test/jack_utils_test.cc new file mode 100644 index 0000000000..7645df6ff3 --- /dev/null +++ b/libs/ardour/test/jack_utils_test.cc @@ -0,0 +1,290 @@ + +#include <stdexcept> + +#ifdef PLATFORM_WINDOWS +#include <windows.h> // only for Sleep +#endif + +#include <glibmm/miscutils.h> + +#include "ardour/jack_utils.h" + +#include "jack_utils_test.h" + +CPPUNIT_TEST_SUITE_REGISTRATION (JackUtilsTest); + +using namespace std; +using namespace ARDOUR; + +void +JackUtilsTest::test_driver_names () +{ + vector<string> driver_names; + + get_jack_audio_driver_names (driver_names); + + CPPUNIT_ASSERT(!driver_names.empty()); + + cout << endl; + cout << "Number of possible JACK Audio drivers found on this system: " << driver_names.size () << endl; + + for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) { + cout << "JACK Audio driver found: " << *i << endl; + } + + string default_audio_driver; + get_jack_default_audio_driver_name (default_audio_driver); + + cout << "The default audio driver on this system is: " << default_audio_driver << endl; + + driver_names.clear(); + + get_jack_midi_system_names (default_audio_driver, driver_names); + + CPPUNIT_ASSERT(!driver_names.empty()); + + cout << "Number of possible JACK MIDI drivers found on this system for default audio driver: " << driver_names.size () << endl; + + for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) { + cout << "JACK MIDI driver found: " << *i << endl; + } + + string default_midi_driver; + get_jack_default_midi_system_name (default_audio_driver, default_midi_driver); + + cout << "The default midi driver on this system is: " << default_midi_driver << endl; +} + +string +devices_string (const vector<string>& devices) +{ + std::string str; + for (vector<string>::const_iterator i = devices.begin(); i != devices.end();) { + str += *i; + if (++i != devices.end()) str += ", "; + } + return str; +} + +void +JackUtilsTest::test_device_names () +{ + vector<string> driver_names; + + get_jack_audio_driver_names (driver_names); + + CPPUNIT_ASSERT(!driver_names.empty()); + + cout << endl; + + for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) { + string devices = devices_string (get_jack_device_names_for_audio_driver (*i)); + cout << "JACK Audio driver found: " << *i << " with devices: " << devices << endl; + } +} + +void +JackUtilsTest::test_samplerates () +{ + vector<string> samplerates; + + get_jack_sample_rate_strings (samplerates); + cout << endl; + cout << "Number of possible Samplerates supported by JACK: " << samplerates.size () << endl; + + for (vector<string>::const_iterator i = samplerates.begin(); i != samplerates.end(); ++i) { + cout << "Samplerate: " << *i << endl; + } +} + +void +JackUtilsTest::test_period_sizes () +{ + vector<string> period_sizes; + + get_jack_period_size_strings (period_sizes); + cout << endl; + cout << "Number of possible Period sizes supported by JACK: " << period_sizes.size () << endl; + + for (vector<string>::const_iterator i = period_sizes.begin(); i != period_sizes.end(); ++i) { + cout << "Period size: " << *i << endl; + } +} + +void +JackUtilsTest::test_dither_modes () +{ + vector<string> driver_names; + + get_jack_audio_driver_names (driver_names); + + CPPUNIT_ASSERT(!driver_names.empty()); + + cout << endl; + + for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) { + vector<string> dither_modes; + + get_jack_dither_mode_strings (*i, dither_modes); + cout << "Number of possible Dither Modes supported by JACK driver " << *i << + ": " << dither_modes.size () << endl; + for (vector<string>::const_iterator j = dither_modes.begin(); j != dither_modes.end(); ++j) { + cout << "Dither Mode: " << *j << endl; + } + cout << endl; + } + +} + +void +JackUtilsTest::test_connect_server () +{ + cout << endl; + if (jack_server_running ()) { + cout << "Jack server running " << endl; + } else { + cout << "Jack server not running " << endl; + } +} + +void +JackUtilsTest::test_set_jack_path_env () +{ + cout << endl; + + bool path_env_set = false; + + string path_env = Glib::getenv ("PATH", path_env_set); + + if (path_env_set) { + cout << "PATH env set to: " << path_env << endl; + } else { + cout << "PATH env not set" << endl; + } + vector<string> server_dirs; + get_jack_server_dir_paths (server_dirs); + set_path_env_for_jack_autostart (server_dirs); + + path_env_set = false; + + path_env = Glib::getenv ("PATH", path_env_set); + + CPPUNIT_ASSERT (path_env_set); + + cout << "After set_jack_path_env PATH env set to: " << path_env << endl; +} + +void +JackUtilsTest::test_server_paths () +{ + cout << endl; + + vector<std::string> server_dirs; + + CPPUNIT_ASSERT (get_jack_server_dir_paths (server_dirs)); + + cout << "Number of Directories that may contain JACK servers: " << server_dirs.size () << endl; + + for (vector<std::string>::const_iterator i = server_dirs.begin(); i != server_dirs.end(); ++i) { + cout << "JACK server directory path: " << *i << endl; + } + + vector<string> server_names; + + CPPUNIT_ASSERT (get_jack_server_application_names (server_names)); + + cout << "Number of possible JACK server names on this system: " << server_names.size () << endl; + + for (vector<string>::const_iterator i = server_names.begin(); i != server_names.end(); ++i) { + cout << "JACK server name: " << *i << endl; + } + + vector<std::string> server_paths; + + CPPUNIT_ASSERT (get_jack_server_paths (server_dirs, server_names, server_paths)); + + cout << "Number of JACK servers on this system: " << server_paths.size () << endl; + + for (vector<std::string>::const_iterator i = server_paths.begin(); i != server_paths.end(); ++i) { + cout << "JACK server path: " << *i << endl; + } + + vector<std::string> server_paths2; + + CPPUNIT_ASSERT (get_jack_server_paths (server_paths2)); + + CPPUNIT_ASSERT (server_paths.size () == server_paths2.size ()); + + std::string default_server_path; + + CPPUNIT_ASSERT (get_jack_default_server_path (default_server_path)); + + cout << "The default JACK server on this system: " << default_server_path << endl; +} + +bool +get_default_jack_command_line (std::string& command_line) +{ + cout << endl; + + JackCommandLineOptions options; + + CPPUNIT_ASSERT (get_jack_default_server_path (options.server_path)); + + get_jack_default_audio_driver_name (options.driver); + + + // should fail, haven't set any device yet + CPPUNIT_ASSERT (!get_jack_command_line_string (options, command_line)); + + vector<string> devices = get_jack_device_names_for_audio_driver (options.driver); + + if (!devices.empty()) { + options.input_device = devices.front (); + options.output_device = devices.front (); + } else { + cout << "No audio devices available using default JACK driver using Dummy driver" << endl; + options.driver = dummy_driver_name; + devices = get_jack_device_names_for_audio_driver (options.driver); + CPPUNIT_ASSERT (!devices.empty ()); + options.input_device = devices.front (); + options.output_device = devices.front (); + } + + options.input_device = devices.front (); + options.output_device = devices.front (); + + string midi_driver; + + get_jack_default_midi_system_name (options.driver, options.midi_driver); + // + // this at least should create a valid jack command line + return get_jack_command_line_string (options, command_line); + +} + +void +JackUtilsTest::test_config () +{ + std::string config_path(get_jack_server_user_config_file_path()); + + cout << "Jack server config file path: " << config_path << endl; + + std::string command_line; + + CPPUNIT_ASSERT (get_default_jack_command_line (command_line)); + + CPPUNIT_ASSERT (write_jack_config_file (config_path, command_line)); +} + + +void +JackUtilsTest::test_command_line () +{ + string command_line; + + // this at least should create a valid jack command line + CPPUNIT_ASSERT (get_default_jack_command_line (command_line)); + + cout << "Default JACK command line: " << command_line << endl; +} diff --git a/libs/ardour/test/jack_utils_test.h b/libs/ardour/test/jack_utils_test.h new file mode 100644 index 0000000000..08fad2fc36 --- /dev/null +++ b/libs/ardour/test/jack_utils_test.h @@ -0,0 +1,31 @@ + +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> + +class JackUtilsTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE (JackUtilsTest); + CPPUNIT_TEST (test_driver_names); + CPPUNIT_TEST (test_device_names); + CPPUNIT_TEST (test_samplerates); + CPPUNIT_TEST (test_period_sizes); + CPPUNIT_TEST (test_dither_modes); + CPPUNIT_TEST (test_connect_server); + CPPUNIT_TEST (test_set_jack_path_env); + CPPUNIT_TEST (test_server_paths); + CPPUNIT_TEST (test_config); + CPPUNIT_TEST (test_command_line); + CPPUNIT_TEST_SUITE_END (); + +public: + void test_driver_names (); + void test_device_names (); + void test_samplerates (); + void test_period_sizes (); + void test_dither_modes (); + void test_connect_server (); + void test_set_jack_path_env (); + void test_server_paths (); + void test_config (); + void test_command_line (); +}; diff --git a/libs/ardour/test/midi_clock_slave_test.cc b/libs/ardour/test/midi_clock_slave_test.cc index dcb159cb2c..4349df22eb 100644 --- a/libs/ardour/test/midi_clock_slave_test.cc +++ b/libs/ardour/test/midi_clock_slave_test.cc @@ -27,7 +27,7 @@ MIDIClock_SlaveTest::testStepResponse () for (framecnt_t i = 1; i<= 100 * period_size; i++) { // simulate jitter - framecnt_t input_delta = framecnt_t (one_ppqn_in_frames + 0.1 * (double(random()) / double (RAND_MAX)) * one_ppqn_in_frames); + framecnt_t input_delta = framecnt_t (one_ppqn_in_frames + 0.1 * (double(g_random_int()) / double (RAND_MAX)) * one_ppqn_in_frames); if (i % input_delta == 0) { update_midi_clock (*parser, start_time + i); diff --git a/libs/ardour/test/plugins_test.cc b/libs/ardour/test/plugins_test.cc new file mode 100644 index 0000000000..0e4bddcda6 --- /dev/null +++ b/libs/ardour/test/plugins_test.cc @@ -0,0 +1,54 @@ +#include <iostream> + +#include "ardour/plugin_manager.h" +#include "ardour/ladspa_search_path.h" + +#include "plugins_test.h" +#include "test_common.h" + +CPPUNIT_TEST_SUITE_REGISTRATION (PluginsTest); + +using namespace std; +using namespace ARDOUR; +using namespace PBD; + +void +print_plugin_info (PluginInfoPtr pp) +{ + cout << "LADSPA Plugin, name " << pp->name + << ", category " << pp->category + << ", creator " << pp->creator + << ", path " << pp->path + << ", n_inputs " << pp->n_inputs.n_audio () + << ", n_outputs " << pp->n_outputs.n_audio () + << endl; + +} + +void +PluginsTest::test () +{ + PluginManager& pm = PluginManager::instance (); + + pm.refresh (); + + Searchpath ladspa_paths(ladspa_search_path ()); + + cout << "Number of Ladspa paths found: " << ladspa_paths.size () << endl; + + for (vector<std::string>::iterator i = ladspa_paths.begin (); i != ladspa_paths.end(); ++i) + { + cout << "LADSPA search path includes: " << *i << endl; + } + + PluginInfoList& ladspa_list = pm.ladspa_plugin_info (); + + cout << "Number of Ladspa plugins found: " << ladspa_list.size () << endl; + + for (PluginInfoList::iterator i = ladspa_list.begin (); i != ladspa_list.end(); ++i) + { + print_plugin_info (*i); + } + + +} diff --git a/libs/ardour/test/plugins_test.h b/libs/ardour/test/plugins_test.h new file mode 100644 index 0000000000..1503b2bde2 --- /dev/null +++ b/libs/ardour/test/plugins_test.h @@ -0,0 +1,12 @@ +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> + +class PluginsTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE (PluginsTest); + CPPUNIT_TEST (test); + CPPUNIT_TEST_SUITE_END (); + +public: + void test (); +}; diff --git a/libs/ardour/test/resampled_source_test.cc b/libs/ardour/test/resampled_source_test.cc index 5aaf71b7aa..c8ef0f4a95 100644 --- a/libs/ardour/test/resampled_source_test.cc +++ b/libs/ardour/test/resampled_source_test.cc @@ -1,4 +1,4 @@ -// this is included first to avoid SearchPath definition on windows +// this is included first to avoid Searchpath definition on windows #include "test_common.h" #include "pbd/file_utils.h" diff --git a/libs/ardour/test/test_common.cc b/libs/ardour/test/test_common.cc index 61f92972d1..71eba65bbb 100644 --- a/libs/ardour/test/test_common.cc +++ b/libs/ardour/test/test_common.cc @@ -25,10 +25,10 @@ using namespace std; -PBD::SearchPath +PBD::Searchpath test_search_path () { -#ifdef WIN32 +#ifdef PLATFORM_WINDOWS std::string wsp(g_win32_get_package_installation_directory_of_module(NULL)); return Glib::build_filename (wsp, "ardour_testdata"); #else diff --git a/libs/ardour/test/test_common.h b/libs/ardour/test/test_common.h index 91fd066ac2..bfda543508 100644 --- a/libs/ardour/test/test_common.h +++ b/libs/ardour/test/test_common.h @@ -21,7 +21,7 @@ #include "pbd/search_path.h" -PBD::SearchPath test_search_path (); +PBD::Searchpath test_search_path (); std::string new_test_output_dir (std::string prefix = ""); diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index aa06912913..d1d2372977 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -36,7 +36,9 @@ #include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> +#ifndef COMPILER_MSVC #include <dirent.h> +#endif #include <errno.h> #include <regex.h> diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 729ee5c129..5c9c94bdac 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -535,8 +535,17 @@ VSTPlugin::connect_and_run (BufferSet& bufs, BufferSet& silent_bufs = _session.get_silent_buffers(bufs_count); BufferSet& scratch_bufs = _session.get_scratch_buffers(bufs_count); - float *ins[_plugin->numInputs]; - float *outs[_plugin->numOutputs]; + /* VC++ doesn't support the C99 extension that allows + + typeName foo[variableDefiningSize]; + + Use alloca instead of dynamic array (rather than std::vector which + allocs on the heap) because this is realtime code. + */ + + float** ins = (float**)alloca(_plugin->numInputs*sizeof(float*)); + float** outs = (float**)alloca(_plugin->numInputs*sizeof(float*)); + int32_t i; uint32_t in_index = 0; @@ -565,7 +574,7 @@ VSTPlugin::connect_and_run (BufferSet& bufs, } /* we already know it can support processReplacing */ - _plugin->processReplacing (_plugin, ins, outs, nframes); + _plugin->processReplacing (_plugin, &ins[0], &outs[0], nframes); return 0; } diff --git a/libs/ardour/worker.cc b/libs/ardour/worker.cc index b13398c69d..d5238adb60 100644 --- a/libs/ardour/worker.cc +++ b/libs/ardour/worker.cc @@ -23,6 +23,8 @@ #include "ardour/worker.h" #include "pbd/error.h" +#include <glibmm/timer.h> + namespace ARDOUR { Worker::Worker(Workee* workee, uint32_t ring_size) @@ -128,7 +130,7 @@ Worker::run() continue; } while (!verify_message_completeness(_requests)) { - ::usleep(2000); + Glib::usleep(2000); if (_exit) { return; } diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 962ff6dbe3..799349c225 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -2,6 +2,7 @@ from waflib.extras import autowaf as autowaf from waflib import Options import os +import sys import re import subprocess import sys @@ -106,6 +107,7 @@ libardour_sources = [ 'io_processor.cc', 'kmeterdsp.cc', 'ladspa_plugin.cc', + 'ladspa_search_path.cc', 'location.cc', 'location_importer.cc', 'ltc_slave.cc', @@ -241,23 +243,24 @@ def configure(conf): autowaf.build_version_files( path_prefix + 'ardour/version.h', path_prefix + 'version.cc', - 'libardour3', conf.env['MAJOR'], conf.env['MINOR'], 0) + 'libardour3', conf.env['MAJOR'], conf.env['MINOR'], 0, + 'LIBARDOUR_API', 'ardour/libardour_visibility.h') autowaf.configure(conf) autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO', atleast_version='0.3.2') autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO4', atleast_version='0.4.0', mandatory=False) autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML') - autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF', - atleast_version='0.4.0') + if Options.options.dist_target != 'mingw': + autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF', + atleast_version='0.4.0') + autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO', + atleast_version='0.3.2') autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE', atleast_version='0.1.0') autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0') - if re.search ("linux", sys.platform) != None: - autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA') - if Options.options.lv2: autowaf.check_pkg(conf, 'lv2', uselib_store='LV2', atleast_version='1.0.0', mandatory=True) @@ -287,10 +290,9 @@ def configure(conf): autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL', atleast_version='7.0.0') - # we don't try to detect this, since its part of our source tree - - conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it - conf.define('USE_RUBBERBAND', 1) # controls whether we actually use it + # controls whether we actually use it in preference to soundtouch + # Note: as of 2104, soundtouch (WSOLA) has been out-of-use for years. + conf.define('USE_RUBBERBAND', 1) conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION) @@ -318,40 +320,44 @@ def build(bld): # major increment <=> incompatible changes # minor increment <=> compatible changes (additions) # micro increment <=> no interface changes - LIBARDOUR_LIB_VERSION = "3.0.0." + LIBARDOUR_LIB_VERSION = "3.0.0" # 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_EXPORTS=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' + obj.name = 'libardour' obj.target = 'ardour' obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID', 'SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS', - 'OSX','BOOST','CURL','DL'] - obj.use = ['libpbd','libmidipp','libevoral','libvampplugin', - 'libaudiographer','libltc','libtimecode'] + 'OSX','BOOST','CURL','DL','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND'] + obj.use = ['libpbd','libmidipp','libevoral', + 'libaudiographer', + 'libtimecode', + ] if bld.is_defined('USE_EXTERNAL_LIBS'): - obj.uselib.extend(['RUBBERBAND', 'TAGLIB', 'LIBLTC', 'VAMPSDK', - 'VAMPHOSTSDK']) + obj.uselib.extend(['VAMPSDK', 'LIBLTC']) else: - obj.use.extend(['libltc', 'librubberband', 'libtaglib', 'libvamphost']) + obj.use.extend(['librubberband', 'libltc_includes', 'libltc']) 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' + 'EVORAL_MIDI_XML=1', ] #obj.source += ' st_stretch.cc st_pitch.cc ' @@ -406,21 +412,18 @@ def build(bld): testcommon.source = ['test/testrunner.cc', 'test/test_needing_session.cc', 'test/test_common.cc', 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc'] testcommon.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD', - 'SAMPLERATE','XML','LRDF','COREAUDIO'] + 'SAMPLERATE','XML','LRDF','COREAUDIO','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND'] testcommon.use = ['libpbd','libmidipp','libevoral', - 'libvampplugin','libaudiographer','ardour'] + 'libaudiographer','ardour'] if bld.is_defined('USE_EXTERNAL_LIBS'): - testcommon.uselib.extend(['RUBBERBAND', 'TAGLIB', 'LIBLTC', 'VAMPSDK', - 'VAMPHOSTSDK']) + testcommon.uselib.extend(['LIBLTC',]) else: - testcommon.use.extend(['libltc', 'librubberband', 'libtaglib', 'libvamphost']) + testcommon.use.extend(['libltc', 'librubberband']) testcommon.defines = [ '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') + '"', - 'VAMP_DIR="' + os.path.join( - os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"' ] testcommon.name = 'testcommon' @@ -433,6 +436,7 @@ def build(bld): testcommon.source += [ 'sse_functions_64bit.s' ] if bld.env['SINGLE_TESTS']: + create_ardour_test_program(bld, obj.includes, 'audio_engine_test', 'test_audio_engine', ['test/audio_engine_test.cc']) create_ardour_test_program(bld, obj.includes, 'automation_list_property_test', 'test_automation_list_property', ['test/automation_list_property_test.cc']) create_ardour_test_program(bld, obj.includes, 'bbt', 'test_bbt', ['test/bbt_test.cc']) create_ardour_test_program(bld, obj.includes, 'tempo', 'test_tempo', ['test/tempo_test.cc']) @@ -444,12 +448,14 @@ def build(bld): create_ardour_test_program(bld, obj.includes, 'framepos_minus_beats', 'test_framepos_minus_beats', ['test/framepos_minus_beats_test.cc']) create_ardour_test_program(bld, obj.includes, 'playlist_equivalent_regions', 'test_playlist_equivalent_regions', ['test/playlist_equivalent_regions_test.cc']) create_ardour_test_program(bld, obj.includes, 'playlist_layering', 'test_playlist_layering', ['test/playlist_layering_test.cc']) + create_ardour_test_program(bld, obj.includes, 'plugins_test', 'test_plugins', ['test/plugins_test.cc']) create_ardour_test_program(bld, obj.includes, 'region_naming', 'test_region_naming', ['test/region_naming_test.cc']) create_ardour_test_program(bld, obj.includes, 'control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc']) create_ardour_test_program(bld, obj.includes, 'mtdm_test', 'test_mtdm', ['test/mtdm_test.cc']) create_ardour_test_program(bld, obj.includes, 'session_test', 'test_session', ['test/session_test.cc']) test_sources = ''' + test/audio_engine_test.cc test/automation_list_property_test.cc test/bbt_test.cc test/tempo_test.cc @@ -461,6 +467,7 @@ def build(bld): test/framepos_minus_beats_test.cc test/playlist_equivalent_regions_test.cc test/playlist_layering_test.cc + test/plugins_test.cc test/region_naming_test.cc test/control_surfaces_test.cc test/mtdm_test.cc @@ -497,8 +504,6 @@ def build(bld): 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"', 'LOCALEDIR="' + os.path.join( os.path.normpath(bld.env['DATADIR']), 'locale') + '"', - 'VAMP_DIR="' + os.path.join( - os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"' ] if bld.env['FPU_OPTIMIZATION']: session_load_tester.source += [ 'sse_functions_xmm.cc' ] @@ -532,8 +537,6 @@ def build(bld): 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"', 'LOCALEDIR="' + os.path.join( os.path.normpath(bld.env['DATADIR']), 'locale') + '"', - 'VAMP_DIR="' + os.path.join( - os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"' ] if bld.env['FPU_OPTIMIZATION']: profilingobj.source += [ 'sse_functions_xmm.cc' ] @@ -548,15 +551,13 @@ def create_ardour_test_program(bld, includes, name, target, sources): testobj.includes = includes + ['test', '../pbd', '..'] testobj.source = sources testobj.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD', - 'SAMPLERATE','XML','LRDF','COREAUDIO'] - testobj.use = ['libpbd','libmidipp','libevoral','libvampplugin', + 'SAMPLERATE','XML','LRDF','COREAUDIO','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND'] + testobj.use = ['libpbd','libmidipp','libevoral', 'libaudiographer','ardour','testcommon'] if bld.is_defined('USE_EXTERNAL_LIBS'): - testobj.uselib.extend(['RUBBERBAND', 'TAGLIB', 'LIBLTC', 'VAMPSDK', - 'VAMPHOSTSDK']) + testobj.uselib.extend(['LIBLTC']) else: - testobj.use.extend(['libltc', 'librubberband', 'libtaglib', - 'libvamphost']) + testobj.use.extend(['libltc']) testobj.name = name testobj.target = target @@ -568,8 +569,6 @@ def create_ardour_test_program(bld, includes, name, target, sources): 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"', 'LOCALEDIR="' + os.path.join( os.path.normpath(bld.env['DATADIR']), 'locale') + '"', - 'VAMP_DIR="' + os.path.join( - os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"' ] def shutdown(): |