NO-OP: whitespace

This commit is contained in:
Robin Gareus 2020-12-03 22:10:26 +01:00
parent 60901d26b7
commit 34769a9062
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 539 additions and 392 deletions

View File

@ -20,9 +20,9 @@
#define _ardour_vst3_host_h_
#include <map>
#include <vector>
#include <string>
#include <stdint.h>
#include <string>
#include <vector>
#include <glib.h>
@ -41,11 +41,11 @@ tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) SMTG_OVERRIDE \
}
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wnon-virtual-dtor"
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wnon-virtual-dtor"
#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#endif
namespace Steinberg {
@ -56,11 +56,11 @@ LIBARDOUR_API extern bool utf8_to_tchar (Vst::TChar* rv, std::string const& s, s
namespace Vst {
/* see public.sdk/source/vst/vstpresetfile.cpp */
typedef char ChunkID[4]; // using ChunkID = char[4];
static const int32 kClassIDSize = 32; // ASCII-encoded FUID
static const int32 kHeaderSize = sizeof (ChunkID) + sizeof (int32) + kClassIDSize + sizeof (TSize);
typedef char ChunkID[4]; // using ChunkID = char[4];
static const int32 kClassIDSize = 32; // ASCII-encoded FUID
static const int32 kHeaderSize = sizeof (ChunkID) + sizeof (int32) + kClassIDSize + sizeof (TSize);
static const int32 kListOffsetPos = kHeaderSize - sizeof (TSize);
}
} // namespace Vst
class LIBARDOUR_API HostAttribute
{
@ -161,8 +161,16 @@ public:
virtual ~HostAttributeList ();
QUERY_INTERFACE_IMPL (Vst::IAttributeList);
uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return RefObject::addRef (); }
uint32 PLUGIN_API release () SMTG_OVERRIDE { return RefObject::release (); }
uint32 PLUGIN_API addRef () SMTG_OVERRIDE
{
return RefObject::addRef ();
}
uint32 PLUGIN_API release () SMTG_OVERRIDE
{
return RefObject::release ();
}
tresult PLUGIN_API setInt (AttrID aid, int64 value) SMTG_OVERRIDE;
tresult PLUGIN_API getInt (AttrID aid, int64& value) SMTG_OVERRIDE;
@ -186,8 +194,16 @@ public:
virtual ~HostMessage ();
QUERY_INTERFACE_IMPL (Vst::IMessage);
uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return RefObject::addRef (); }
uint32 PLUGIN_API release () SMTG_OVERRIDE { return RefObject::release (); }
uint32 PLUGIN_API addRef () SMTG_OVERRIDE
{
return RefObject::addRef ();
}
uint32 PLUGIN_API release () SMTG_OVERRIDE
{
return RefObject::release ();
}
const char* PLUGIN_API getMessageID () SMTG_OVERRIDE;
void PLUGIN_API setMessageID (const char* messageID) SMTG_OVERRIDE;
@ -205,8 +221,16 @@ public:
~ConnectionProxy () SMTG_OVERRIDE;
QUERY_INTERFACE_IMPL (Vst::IConnectionPoint);
uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return RefObject::addRef (); }
uint32 PLUGIN_API release () SMTG_OVERRIDE { return RefObject::release (); }
uint32 PLUGIN_API addRef () SMTG_OVERRIDE
{
return RefObject::addRef ();
}
uint32 PLUGIN_API release () SMTG_OVERRIDE
{
return RefObject::release ();
}
/* IConnectionPoint API */
tresult PLUGIN_API connect (Vst::IConnectionPoint*) SMTG_OVERRIDE;
@ -225,8 +249,16 @@ class LIBARDOUR_API PlugInterfaceSupport : public Vst::IPlugInterfaceSupport
public:
PlugInterfaceSupport ();
QUERY_INTERFACE_IMPL (Vst::IPlugInterfaceSupport);
uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API release () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API addRef () SMTG_OVERRIDE
{
return 1;
}
uint32 PLUGIN_API release () SMTG_OVERRIDE
{
return 1;
}
tresult PLUGIN_API isPlugInterfaceSupported (const TUID) SMTG_OVERRIDE;
@ -249,8 +281,15 @@ public:
virtual ~HostApplication () {}
tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) SMTG_OVERRIDE;
uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API release () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API addRef () SMTG_OVERRIDE
{
return 1;
}
uint32 PLUGIN_API release () SMTG_OVERRIDE
{
return 1;
}
tresult PLUGIN_API getName (Vst::String128 name) SMTG_OVERRIDE;
tresult PLUGIN_API createInstance (TUID cid, TUID _iid, void** obj) SMTG_OVERRIDE;
@ -263,61 +302,91 @@ class LIBARDOUR_LOCAL Vst3ParamValueQueue : public Vst::IParamValueQueue
{
public:
QUERY_INTERFACE_IMPL (Vst::IParamValueQueue);
uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API release () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API addRef () SMTG_OVERRIDE
{
return 1;
}
uint32 PLUGIN_API release () SMTG_OVERRIDE
{
return 1;
}
static const int maxNumPoints = 64;
Vst3ParamValueQueue() {
Vst3ParamValueQueue ()
{
_values.reserve (maxNumPoints);
_id = Vst::kNoParamId;
}
Vst::ParamID PLUGIN_API getParameterId() SMTG_OVERRIDE { return _id; }
Vst::ParamID PLUGIN_API getParameterId () SMTG_OVERRIDE
{
return _id;
}
void setParameterId (Vst::ParamID id) {
_values.clear();
void setParameterId (Vst::ParamID id)
{
_values.clear ();
_id = id;
}
int32 PLUGIN_API getPointCount() SMTG_OVERRIDE { return _values.size(); }
int32 PLUGIN_API getPointCount () SMTG_OVERRIDE
{
return _values.size ();
}
tresult PLUGIN_API getPoint (int32 index, int32&, Vst::ParamValue&) SMTG_OVERRIDE;
tresult PLUGIN_API addPoint (int32, Vst::ParamValue, int32&) SMTG_OVERRIDE;
protected:
struct Value {
Value (Vst::ParamValue v, int32 offset)
: value(v)
, sampleOffset(offset)
: value (v)
, sampleOffset (offset)
{}
Vst::ParamValue value;
int32 sampleOffset;
int32 sampleOffset;
};
std::vector<Value> _values;
Vst::ParamID _id;
Vst::ParamID _id;
};
class LIBARDOUR_LOCAL Vst3ParameterChanges : public Vst::IParameterChanges
{
public:
QUERY_INTERFACE_IMPL (Vst::IParameterChanges);
uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API release () SMTG_OVERRIDE { return 1; }
Vst3ParameterChanges () {
uint32 PLUGIN_API addRef () SMTG_OVERRIDE
{
return 1;
}
uint32 PLUGIN_API release () SMTG_OVERRIDE
{
return 1;
}
Vst3ParameterChanges ()
{
clear ();
}
void set_n_params (int n) {
_queue.resize(n);
void set_n_params (int n)
{
_queue.resize (n);
}
void clear () {
void clear ()
{
_used_queue_count = 0;
}
int32 PLUGIN_API getParameterCount() SMTG_OVERRIDE {
int32 PLUGIN_API getParameterCount () SMTG_OVERRIDE
{
return _used_queue_count;
}
@ -326,25 +395,36 @@ public:
protected:
std::vector<Vst3ParamValueQueue> _queue;
int _used_queue_count;
int _used_queue_count;
};
class LIBARDOUR_LOCAL Vst3EventList : public Vst::IEventList
{
public:
Vst3EventList() {
Vst3EventList ()
{
_events.reserve (128);
}
QUERY_INTERFACE_IMPL (Vst::IEventList)
uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API release () SMTG_OVERRIDE { return 1; }
int32 PLUGIN_API PLUGIN_API getEventCount() SMTG_OVERRIDE {
uint32 PLUGIN_API addRef () SMTG_OVERRIDE
{
return 1;
}
uint32 PLUGIN_API release () SMTG_OVERRIDE
{
return 1;
}
int32 PLUGIN_API PLUGIN_API getEventCount () SMTG_OVERRIDE
{
return _events.size ();
}
tresult PLUGIN_API getEvent (int32 index, Vst::Event& e) SMTG_OVERRIDE {
tresult PLUGIN_API getEvent (int32 index, Vst::Event& e) SMTG_OVERRIDE
{
if (index >= 0 && index < (int32)_events.size ()) {
e = _events[index];
return kResultTrue;
@ -353,13 +433,15 @@ public:
}
}
tresult PLUGIN_API addEvent (Vst::Event& e) SMTG_OVERRIDE {
tresult PLUGIN_API addEvent (Vst::Event& e) SMTG_OVERRIDE
{
_events.push_back (e);
return kResultTrue;
}
void clear() {
_events.clear();
void clear ()
{
_events.clear ();
}
protected:
@ -376,8 +458,16 @@ public:
virtual ~RAMStream ();
tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) SMTG_OVERRIDE;
uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API release () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API addRef () SMTG_OVERRIDE
{
return 1;
}
uint32 PLUGIN_API release () SMTG_OVERRIDE
{
return 1;
}
/* IBStream API */
tresult PLUGIN_API read (void* buffer, int32 numBytes, int32* numBytesRead) SMTG_OVERRIDE;
@ -390,12 +480,19 @@ public:
tresult PLUGIN_API setStreamSize (int64) SMTG_OVERRIDE;
/* IStreamAttributes API */
tresult PLUGIN_API getFileName (Vst::String128 name) SMTG_OVERRIDE;
tresult PLUGIN_API getFileName (Vst::String128 name) SMTG_OVERRIDE;
Vst::IAttributeList* PLUGIN_API getAttributes () SMTG_OVERRIDE;
/* convenience API for state I/O */
void rewind () { _pos = 0; }
bool readonly () const { return _readonly; }
void rewind ()
{
_pos = 0;
}
bool readonly () const
{
return _readonly;
}
bool write_int32 (int32 i);
bool write_int64 (int64 i);
@ -408,8 +505,15 @@ public:
bool read_TUID (TUID& tuid);
/* direct access */
uint8_t const* data () const { return _data; }
int64 size () const { return _size; }
uint8_t const* data () const
{
return _data;
}
int64 size () const
{
return _size;
}
#ifndef NDEBUG
void hexdump (int64 max_len = 64) const;
@ -418,16 +522,20 @@ public:
private:
bool reallocate_buffer (int64 size, bool exact);
template<typename T> bool read_pod (T& t) {
template <typename T>
bool read_pod (T& t)
{
int32 n_read = 0;
read ((void *)&t, sizeof(T), &n_read);
return n_read == sizeof(T);
read ((void*)&t, sizeof (T), &n_read);
return n_read == sizeof (T);
}
template<typename T> bool write_pod (const T& t) {
template <typename T>
bool write_pod (const T& t)
{
int32 written = 0;
write (const_cast<void*>((const void *)&t), sizeof(T), &written);
return written == sizeof(T);
write (const_cast<void*> ((const void*)&t), sizeof (T), &written);
return written == sizeof (T);
}
uint8_t* _data;
@ -446,8 +554,16 @@ public:
virtual ~ROMStream ();
tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) SMTG_OVERRIDE;
uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API release () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API addRef () SMTG_OVERRIDE
{
return 1;
}
uint32 PLUGIN_API release () SMTG_OVERRIDE
{
return 1;
}
/* IBStream API */
tresult PLUGIN_API read (void* buffer, int32 numBytes, int32* numBytesRead) SMTG_OVERRIDE;
@ -455,7 +571,11 @@ public:
tresult PLUGIN_API seek (int64 pos, int32 mode, int64* result) SMTG_OVERRIDE;
tresult PLUGIN_API tell (int64* pos) SMTG_OVERRIDE;
void rewind () { _pos = 0; }
void rewind ()
{
_pos = 0;
}
protected:
IBStream& _stream;
int64 _offset;
@ -463,11 +583,10 @@ protected:
int64 _pos;
};
#if defined(__clang__)
# pragma clang diagnostic pop
#pragma clang diagnostic pop
#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
# pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
} // namespace Steinberg

View File

@ -25,27 +25,27 @@
#include <boost/optional.hpp>
#include "pbd/signals.h"
#include "pbd/search_path.h"
#include "pbd/signals.h"
#include "ardour/plugin.h"
#include "ardour/vst3_host.h"
namespace ARDOUR {
namespace ARDOUR
{
class VST3PluginModule;
class AutomationList;
}
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wnon-virtual-dtor"
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wnon-virtual-dtor"
#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#endif
namespace Steinberg {
/* VST3 hosted Plugin abstraction Implementation
*
* For convenience this is placed in the Steinberg namespace.
@ -92,32 +92,35 @@ public:
tresult PLUGIN_API endEditContextInfoValue (FIDString) SMTG_OVERRIDE;
/* GUI */
bool has_editor () const;
bool has_editor () const;
IPlugView* view ();
void close_view ();
PBD::Signal2<void, int, int> OnResizeView;
void close_view ();
void update_contoller_param ();
#if SMTG_OS_LINUX
void set_runloop (Linux::IRunLoop*);
#endif
void update_contoller_param ();
PBD::Signal2<void, int, int> OnResizeView;
tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) SMTG_OVERRIDE;
uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return 1; }
uint32 PLUGIN_API release () SMTG_OVERRIDE { return 1; }
FUID const& fuid () const { return _fuid; }
/* Ardour Preset Helpers */
Vst::IUnitInfo* unit_info ();
FUID const& fuid() const { return _fuid; }
Vst::ParameterInfo const& program_change_port() const { return _program_change_port; }
void set_n_factory_presets (size_t n) { _n_factory_presets = n; }
Vst::ParameterInfo const& program_change_port () const { return _program_change_port; }
void set_n_factory_presets (size_t n) { _n_factory_presets = n; }
size_t n_factory_presets () const { return _n_factory_presets; }
/* API for Ardour -- Ports */
uint32_t designated_bypass_port () const { return _port_id_bypass; }
uint32_t parameter_count () const { return _ctrl_params.size (); }
bool parameter_is_automatable (uint32_t p) const { return _ctrl_params[p].automatable; }
bool parameter_is_readonly (uint32_t p) const { return _ctrl_params[p].read_only; }
std::string parameter_label (uint32_t p) const { return _ctrl_params[p].label; }
uint32_t designated_bypass_port () const { return _port_id_bypass; }
uint32_t parameter_count () const { return _ctrl_params.size (); }
bool parameter_is_automatable (uint32_t p) const { return _ctrl_params[p].automatable; }
bool parameter_is_readonly (uint32_t p) const { return _ctrl_params[p].read_only; }
std::string parameter_label (uint32_t p) const { return _ctrl_params[p].label; }
float default_value (uint32_t p) const;
void get_parameter_descriptor (uint32_t, ARDOUR::ParameterDescriptor&) const;
std::string print_parameter (uint32_t p) const;
@ -147,20 +150,28 @@ public:
std::string format_parameter (uint32_t p) const;
Vst::ParamID index_to_id (uint32_t) const;
enum ParameterChange { BeginGesture, EndGesture , ValueChange, InternalChange, PresetChange };
enum ParameterChange { BeginGesture,
EndGesture,
ValueChange,
InternalChange,
PresetChange };
PBD::Signal3<void, ParameterChange, uint32_t, float> OnParameterChange;
/* API for Ardour -- Setup/Processing */
uint32_t plugin_latency ();
bool set_block_size (int32_t);
bool activate ();
bool deactivate ();
uint32_t plugin_latency ();
bool set_block_size (int32_t);
bool activate ();
bool deactivate ();
/* State */
bool save_state (RAMStream& stream);
bool load_state (RAMStream& stream);
Vst::ProcessContext& context () { return _context; }
Vst::ProcessContext& context ()
{
return _context;
}
void set_owner (ARDOUR::SessionObject* o);
@ -169,7 +180,10 @@ public:
void process (float** ins, float** outs, uint32_t n_samples);
/* PSL Extension */
Vst::IEditController* controller () const { return _controller; }
Vst::IEditController* controller () const
{
return _controller;
}
bool add_slave (Vst::IEditController*, bool);
bool remove_slave (Vst::IEditController*);
@ -197,7 +211,7 @@ private:
void set_event_bus_state (bool enabled);
bool midi_controller (int32_t, int16_t, Vst::CtrlNumber, Vst::ParamID &id);
bool midi_controller (int32_t, int16_t, Vst::CtrlNumber, Vst::ParamID& id);
bool live_midi_cc (int32_t, int16_t, Vst::CtrlNumber);
bool setup_info_listener ();
@ -304,21 +318,25 @@ public:
uint32_t nth_parameter (uint32_t port, bool& ok) const;
bool print_parameter (uint32_t, std::string&) const;
bool parameter_is_audio (uint32_t) const { return false; }
bool parameter_is_audio (uint32_t) const { return false; }
bool parameter_is_control (uint32_t) const { return true; }
bool parameter_is_input (uint32_t) const;
bool parameter_is_output (uint32_t) const;
uint32_t designated_bypass_port ();
std::set<Evoral::Parameter> automatable () const;
std::string describe_parameter (Evoral::Parameter);
IOPortDescription describe_io_port (DataType dt, bool input, uint32_t id) const;
PluginOutputConfiguration possible_output () const;
std::string describe_parameter (Evoral::Parameter);
IOPortDescription describe_io_port (DataType dt, bool input, uint32_t id) const;
PluginOutputConfiguration possible_output () const;
void set_automation_control (uint32_t, boost::shared_ptr<ARDOUR::AutomationControl>);
std::string state_node_name () const { return "vst3"; }
std::string state_node_name () const
{
return "vst3";
}
void add_state (XMLNode*) const;
int set_state (const XMLNode&, int version);
@ -327,8 +345,15 @@ public:
std::string do_save_preset (std::string);
void do_remove_preset (std::string);
void activate () { _plug->activate (); }
void deactivate () { _plug->deactivate (); }
void activate ()
{
_plug->activate ();
}
void deactivate ()
{
_plug->deactivate ();
}
int set_block_size (pframes_t);
@ -342,13 +367,13 @@ public:
ChanMapping const& in, ChanMapping const& out,
pframes_t nframes, samplecnt_t offset);
bool has_editor () const;
bool has_editor () const;
Steinberg::IPlugView* view ();
void close_view ();
void close_view ();
void update_contoller_param ();
#if SMTG_OS_LINUX
void set_runloop (Steinberg::Linux::IRunLoop*);
#endif
void update_contoller_param ();
PBD::Signal2<void, int, int> OnResizeView;
@ -362,9 +387,10 @@ private:
PBD::Searchpath preset_search_path () const;
Steinberg::VST3PI* _plug;
PBD::ScopedConnectionList _connections;
std::map <std::string, std::string> _preset_uri_map;
std::map<std::string, std::string> _preset_uri_map;
std::vector<bool> _connected_inputs;
std::vector<bool> _connected_outputs;
@ -380,7 +406,7 @@ public:
PluginPtr load (Session& session);
std::vector<Plugin::PresetRecord> get_presets (bool user_only) const;
bool is_instrument () const;
bool is_instrument () const;
boost::shared_ptr<VST3PluginModule> m;
};

View File

@ -17,8 +17,8 @@
*
*/
#include <ctype.h>
#include <algorithm>
#include <ctype.h>
#if (__cplusplus >= 201103L)
#include <boost/make_unique.hpp>
@ -27,8 +27,8 @@
#include "ardour/vst3_host.h"
#ifndef VST3_SCANNER_APP
#include "pbd/compose.h"
#include "ardour/debug.h"
#include "pbd/compose.h"
#endif
using namespace Steinberg;
@ -102,7 +102,7 @@ Steinberg::utf8_to_tchar (Vst::TChar* rv, const char* s, size_t l)
memset (rv, 0, sizeof (Vst::TChar));
return false;
}
if (l > 0 && l <= (size_t) len) {
if (l > 0 && l <= (size_t)len) {
len = l - 1;
}
memcpy (rv, s16, len * sizeof (Vst::TChar));
@ -114,7 +114,7 @@ Steinberg::utf8_to_tchar (Vst::TChar* rv, const char* s, size_t l)
bool
Steinberg::utf8_to_tchar (Vst::TChar* rv, std::string const& s, size_t l)
{
return utf8_to_tchar (rv, s.c_str(), l);
return utf8_to_tchar (rv, s.c_str (), l);
}
/* ****************************************************************************/
@ -341,13 +341,13 @@ ConnectionProxy::connect (Vst::IConnectionPoint* dst)
}
tresult
ConnectionProxy::disconnect (Vst::IConnectionPoint* dst)
ConnectionProxy::disconnect (Vst::IConnectionPoint* dst)
{
if (!dst) {
return kInvalidArgument;
if (!dst) {
return kInvalidArgument;
}
if (dst != _dst) {
if (dst != _dst) {
return kInvalidArgument;
}
@ -360,15 +360,14 @@ tresult
return kResultTrue;
}
tresult
ConnectionProxy::notify (Vst::IMessage* message)
{
if (!_dst) {
if (!_dst) {
return kResultFalse;
}
#if 0
if (strcmp ("ArdourGUI", pthread_name ())) {
if (strcmp ("ArdourGUI", pthread_name ())) {
return kResultFalse;
}
#endif
@ -378,7 +377,7 @@ ConnectionProxy::notify (Vst::IMessage* message)
bool
ConnectionProxy::disconnect ()
{
return kResultTrue == disconnect (_dst);
return kResultTrue == disconnect (_dst);
}
/* ****************************************************************************/
@ -491,7 +490,7 @@ HostApplication::queryInterface (const char* _iid, void** obj)
#endif
#ifndef VST3_SCANNER_APP
if (DEBUG_ENABLED(PBD::DEBUG::VST3Config)) {
if (DEBUG_ENABLED (PBD::DEBUG::VST3Config)) {
char fuid[33];
FUID::fromTUID (_iid).toString (fuid);
DEBUG_TRACE (PBD::DEBUG::VST3Config, string_compose ("HostApplication::queryInterface not supported: %1\n", fuid));
@ -530,14 +529,13 @@ HostApplication::createInstance (TUID cid, TUID _iid, void** obj)
tresult
Vst3ParamValueQueue::getPoint (int32 index, int32& sampleOffset, Vst::ParamValue& value)
{
if (index >=0 && index < (int32)_values.size ()) {
if (index >= 0 && index < (int32)_values.size ()) {
const Value& v = _values[index];
sampleOffset = v.sampleOffset;
value = v.value;
sampleOffset = v.sampleOffset;
value = v.value;
return kResultTrue;
}
return kResultFalse;
}
tresult
@ -547,7 +545,7 @@ Vst3ParamValueQueue::addPoint (int32 sampleOffset, Vst::ParamValue value, int32&
for (uint32 i = 0; i < _values.size (); ++i) {
if (_values[i].sampleOffset == sampleOffset) {
_values[i].value = value;
index = i;
index = i;
return kResultTrue;
} else if (_values[i].sampleOffset > sampleOffset) {
dest_index = i;
@ -571,27 +569,27 @@ Vst3ParamValueQueue::addPoint (int32 sampleOffset, Vst::ParamValue value, int32&
Vst::IParamValueQueue*
Vst3ParameterChanges::getParameterData (int32 index)
{
if (index < _used_queue_count) {
return &_queue[index];
if (index < _used_queue_count) {
return &_queue[index];
}
return 0;
return 0;
}
Vst::IParamValueQueue*
Vst3ParameterChanges::addParameterData (Vst::ParamID const& pid, int32& index)
{
for (int32 i = 0; i < _used_queue_count; ++i) {
if (_queue[i].getParameterId () == pid) {
index = i;
return &_queue[i];
}
}
for (int32 i = 0; i < _used_queue_count; ++i) {
if (_queue[i].getParameterId () == pid) {
index = i;
return &_queue[i];
}
}
if (_used_queue_count < (int32)_queue.size ()) {
if (_used_queue_count < (int32)_queue.size ()) {
index = _used_queue_count++;
_queue[index].setParameterId (pid);
return &_queue[index];
}
}
index = 0;
return 0;
}
@ -628,7 +626,7 @@ RAMStream::RAMStream (std::string const& fn)
, _pos (0)
, _readonly (true)
{
gchar* buf = NULL;
gchar* buf = NULL;
gsize length = 0;
if (!g_file_get_contents (fn.c_str (), &buf, &length, NULL)) {
@ -649,15 +647,15 @@ RAMStream::~RAMStream ()
tresult
RAMStream::queryInterface (const TUID _iid, void** obj)
{
QUERY_INTERFACE (_iid, obj, FUnknown::iid, IBStream)
QUERY_INTERFACE (_iid, obj, IBStream::iid, IBStream)
QUERY_INTERFACE (_iid, obj, FUnknown::iid, ISizeableStream)
QUERY_INTERFACE (_iid, obj, ISizeableStream::iid, ISizeableStream)
QUERY_INTERFACE (_iid, obj, FUnknown::iid, Vst::IStreamAttributes)
QUERY_INTERFACE (_iid, obj, Vst::IStreamAttributes::iid, Vst::IStreamAttributes)
QUERY_INTERFACE (_iid, obj, FUnknown::iid, IBStream)
QUERY_INTERFACE (_iid, obj, IBStream::iid, IBStream)
QUERY_INTERFACE (_iid, obj, FUnknown::iid, ISizeableStream)
QUERY_INTERFACE (_iid, obj, ISizeableStream::iid, ISizeableStream)
QUERY_INTERFACE (_iid, obj, FUnknown::iid, Vst::IStreamAttributes)
QUERY_INTERFACE (_iid, obj, Vst::IStreamAttributes::iid, Vst::IStreamAttributes)
*obj = nullptr;
return kNoInterface;
*obj = nullptr;
return kNoInterface;
}
bool
@ -665,7 +663,7 @@ RAMStream::reallocate_buffer (int64 size, bool exact)
{
if (size <= 0) {
free (_data);
_data = 0;
_data = 0;
_alloc = 0;
return true;
}
@ -686,7 +684,7 @@ RAMStream::reallocate_buffer (int64 size, bool exact)
}
}
_data = (uint8_t*) realloc (_data, size);
_data = (uint8_t*)realloc (_data, size);
if (_data) {
_alloc = size;
@ -710,7 +708,7 @@ RAMStream::read (void* buffer, int32 n_bytes, int32* n_read)
}
if (n_bytes > 0) {
memcpy(buffer, &_data[_pos], n_bytes);
memcpy (buffer, &_data[_pos], n_bytes);
_pos += n_bytes;
}
if (n_read) {
@ -786,7 +784,8 @@ RAMStream::tell (int64* pos)
}
bool
RAMStream::write_int32 (int32 i) {
RAMStream::write_int32 (int32 i)
{
/* pluginterfaces/base/ftypes.h */
#if BYTEORDER == kBigEndian
SWAP_32 (i)
@ -816,33 +815,34 @@ struct GUIDStruct {
uint32_t data1;
uint16_t data2;
uint16_t data3;
uint8_t data4[8];
uint8_t data4[8];
};
#endif
bool
RAMStream::write_TUID (const TUID& tuid)
{
int i = 0;
int i = 0;
int32 n_bytes = 0;
char buf[Vst::kClassIDSize + 1];
char buf[Vst::kClassIDSize + 1];
#if COM_COMPATIBLE
GUIDStruct guid;
memcpy (&guid, tuid, sizeof(GUIDStruct));
sprintf(buf, "%08X%04X%04X", guid.data1, guid.data2, guid.data3);
memcpy (&guid, tuid, sizeof (GUIDStruct));
sprintf (buf, "%08X%04X%04X", guid.data1, guid.data2, guid.data3);
i += 8;
#endif
for (; i < (int)sizeof(TUID); ++i){
sprintf(buf + 2 * i, "%02X", (uint8_t)tuid[i]);
for (; i < (int)sizeof (TUID); ++i) {
sprintf (buf + 2 * i, "%02X", (uint8_t)tuid[i]);
}
write (buf, Vst::kClassIDSize, &n_bytes);
return n_bytes == Vst::kClassIDSize;
}
bool
RAMStream::read_int32 (int32& i) {
RAMStream::read_int32 (int32& i)
{
if (!read_pod (i)) {
return false;
}
@ -853,7 +853,8 @@ RAMStream::read_int32 (int32& i) {
}
bool
RAMStream::read_int64 (int64& i) {
RAMStream::read_int64 (int64& i)
{
if (!read_pod (i)) {
return false;
}
@ -872,11 +873,11 @@ RAMStream::read_ChunkID (Vst::ChunkID& id)
bool
RAMStream::read_TUID (TUID& tuid)
{
int i = 0;
int i = 0;
int32 n_bytes = 0;
char buf[Vst::kClassIDSize+1];
char buf[Vst::kClassIDSize + 1];
read((void *)buf, Vst::kClassIDSize, &n_bytes);
read ((void*)buf, Vst::kClassIDSize, &n_bytes);
if (n_bytes != Vst::kClassIDSize) {
return false;
}
@ -885,14 +886,14 @@ RAMStream::read_TUID (TUID& tuid)
#if COM_COMPATIBLE
GUIDStruct guid;
sscanf (buf, "%08x", &guid.data1);
sscanf (buf+8, "%04hx", &guid.data2);
sscanf (buf+12, "%04hx", &guid.data3);
memcpy (tuid, &guid, sizeof(TUID) >> 1);
sscanf (buf, "%08x", &guid.data1);
sscanf (buf + 8, "%04hx", &guid.data2);
sscanf (buf + 12, "%04hx", &guid.data3);
memcpy (tuid, &guid, sizeof (TUID) >> 1);
i += 16;
#endif
for (; i < Vst::kClassIDSize; i += 2){
for (; i < Vst::kClassIDSize; i += 2) {
uint32_t temp;
sscanf (buf + i, "%02X", &temp);
tuid[i >> 1] = temp;
@ -931,9 +932,9 @@ RAMStream::getAttributes ()
#ifndef NDEBUG
#include <iomanip>
#include <iostream>
#include <sstream>
#include <iomanip>
void
RAMStream::hexdump (int64 max_len) const
@ -941,14 +942,14 @@ RAMStream::hexdump (int64 max_len) const
std::ostringstream out;
size_t row_size = 16;
size_t length = max_len > 0 ? std::min (max_len, _size) : _size;
size_t length = max_len > 0 ? std::min (max_len, _size) : _size;
out << std::setfill('0');
out << std::setfill ('0');
for (size_t i = 0; i < length; i += row_size) {
out << "0x" << std::setw(6) << std::hex << i << ": ";
out << "0x" << std::setw (6) << std::hex << i << ": ";
for (size_t j = 0; j < row_size; ++j) {
if (i + j < length) {
out << std::hex << std::setw(2) << static_cast<int>(_data[i + j]) << " ";
out << std::hex << std::setw (2) << static_cast<int> (_data[i + j]) << " ";
} else {
out << " ";
}
@ -957,8 +958,8 @@ RAMStream::hexdump (int64 max_len) const
if (true) {
for (size_t j = 0; j < row_size; ++j) {
if (i + j < length) {
if (isprint(_data[i + j])) {
out << static_cast<char>(_data[i + j]);
if (isprint (_data[i + j])) {
out << static_cast<char> (_data[i + j]);
} else {
out << ".";
}
@ -975,7 +976,7 @@ ROMStream::ROMStream (IBStream& src, TSize offset, TSize size)
: _stream (src)
, _offset (offset)
, _size (size)
, _pos (0)
, _pos (0)
{
_stream.addRef ();
}
@ -988,11 +989,11 @@ ROMStream::~ROMStream ()
tresult
ROMStream::queryInterface (const TUID _iid, void** obj)
{
QUERY_INTERFACE (_iid, obj, FUnknown::iid, IBStream)
QUERY_INTERFACE (_iid, obj, IBStream::iid, IBStream)
QUERY_INTERFACE (_iid, obj, FUnknown::iid, IBStream)
QUERY_INTERFACE (_iid, obj, IBStream::iid, IBStream)
*obj = nullptr;
return kNoInterface;
*obj = nullptr;
return kNoInterface;
}
tresult
@ -1019,16 +1020,16 @@ ROMStream::read (void* buffer, int32 n_bytes, int32* n_read)
}
int32 _n_read = 0;
result = _stream.read (buffer, n_bytes, &_n_read);
result = _stream.read (buffer, n_bytes, &_n_read);
if (_n_read > 0) {
_pos += _n_read;
if (_n_read > 0) {
_pos += _n_read;
}
if (n_read) {
*n_read = _n_read;
if (n_read) {
*n_read = _n_read;
}
return result;
return result;
}
tresult

File diff suppressed because it is too large Load Diff