diff options
author | Hans Fugal <hans@fugal.net> | 2006-08-08 21:11:23 +0000 |
---|---|---|
committer | Hans Fugal <hans@fugal.net> | 2006-08-08 21:11:23 +0000 |
commit | f07cb624c02c98a5ae375b26cb99c157df64d159 (patch) | |
tree | be7bffa8441cba361815afb8f4fc31cebd8b5ddf /libs | |
parent | 5756373841675a879833f98bb4008dd0c40714d3 (diff) |
pull from trunk
git-svn-id: svn://localhost/ardour2/branches/undo@764 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/audio_unit.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/state_manager.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/vst_plugin.h | 1 | ||||
-rw-r--r-- | libs/ardour/audio_unit.cc | 80 | ||||
-rw-r--r-- | libs/ardour/plugin_manager.cc | 2 | ||||
-rw-r--r-- | libs/ardour/state_manager.cc | 3 | ||||
-rw-r--r-- | libs/ardour/vst_plugin.cc | 8 | ||||
-rw-r--r-- | libs/libsndfile/src/flac.c | 12 |
8 files changed, 64 insertions, 46 deletions
diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index f437ae053a..63522d8d5c 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -88,6 +88,8 @@ class AUPlugin : public ARDOUR::Plugin private: CAComponent* comp; CAAudioUnit* unit; + + std::vector<std::pair<uint32_t, uint32_t> > parameter_map; }; class AUPluginInfo : public PluginInfo { diff --git a/libs/ardour/ardour/state_manager.h b/libs/ardour/ardour/state_manager.h index 19ee2e624a..99bfcfc3ce 100644 --- a/libs/ardour/ardour/state_manager.h +++ b/libs/ardour/ardour/state_manager.h @@ -35,6 +35,8 @@ class StateManager : public sigc::trackable state_id_t _current_state_id; + virtual bool should_save_state () const { return true; } + static void prohibit_save (); static void allow_save (const char* why, bool dosave); diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 3636fe275a..5253da7b0a 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -106,6 +106,7 @@ class VSTPlugin : public ARDOUR::Plugin class VSTPluginInfo : public PluginInfo { + public: VSTPluginInfo () {} ~VSTPluginInfo () {} diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 0756f55a59..59797f3288 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -82,13 +82,13 @@ AUPlugin::unique_id () const const char * AUPlugin::label () const { - return ""; + return "AUPlugin label"; } const char * AUPlugin::maker () const { - return ""; + return "AUplugin maker"; } uint32_t @@ -100,25 +100,30 @@ AUPlugin::parameter_count () const float AUPlugin::default_value (uint32_t port) { - return 0.0; + // AudioUnits don't have default values. Maybe presets though? + return 0; } jack_nframes_t AUPlugin::latency () const { - return 0; + return unit->Latency (); } void AUPlugin::set_parameter (uint32_t which, float val) { - + unit->SetParameter (parameter_map[which].first, parameter_map[which].second, 0, val); } float AUPlugin::get_parameter (uint32_t which) const { - return 0.0; + float outValue = 0.0; + + unit->GetParameter(parameter_map[which].first, parameter_map[which].second, 0, outValue); + + return outValue; } int @@ -136,13 +141,13 @@ AUPlugin::nth_parameter (uint32_t which, bool& ok) const void AUPlugin::activate () { - + unit->GlobalReset (); } void AUPlugin::deactivate () { - + // not needed. GlobalReset () takes care of it. } void @@ -154,7 +159,19 @@ AUPlugin::set_block_size (jack_nframes_t nframes) int AUPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, jack_nframes_t nframes, jack_nframes_t offset) { - return -1; + AudioUnitRenderActionFlags flags = 0; + AudioTimeStamp ts; + + AudioBufferList abl; + abl.mNumberBuffers = 1; + abl.mBuffers[0].mNumberChannels = 1; + abl.mBuffers[0].mDataByteSize = nframes * sizeof(Sample); + abl.mBuffers[0].mData = &bufs[0]; + + + unit->Render (&flags, &ts, 0, 0, &abl); + + return 0; } set<uint32_t> @@ -281,40 +298,31 @@ AUPluginInfo::discover () { PluginInfoList plugs; - int numTypes = 2; // this magic number was retrieved from the apple AUHost example. - CAComponentDescription desc; desc.componentFlags = 0; desc.componentFlagsMask = 0; desc.componentSubType = 0; desc.componentManufacturer = 0; + desc.componentType = kAudioUnitType_Effect; - for (int i = 0; i < numTypes; ++i) { - if (i == 1) { - desc.componentType = kAudioUnitType_MusicEffect; - } else { - desc.componentType = kAudioUnitType_Effect; - } + Component comp = 0; - Component comp = 0; - - comp = FindNextComponent (NULL, &desc); - while (comp != NULL) { - CAComponentDescription temp; - GetComponentInfo (comp, &temp, NULL, NULL, NULL); - - AUPluginInfoPtr plug(new AUPluginInfo); - plug->name = AUPluginInfo::get_name (temp); - plug->type = PluginInfo::AudioUnit; - plug->n_inputs = 0; - plug->n_outputs = 0; - plug->category = "AudioUnit"; - plug->desc = new CAComponentDescription(temp); - - plugs.push_back(plug); - - comp = FindNextComponent (comp, &desc); - } + comp = FindNextComponent (NULL, &desc); + while (comp != NULL) { + CAComponentDescription temp; + GetComponentInfo (comp, &temp, NULL, NULL, NULL); + + AUPluginInfoPtr plug(new AUPluginInfo); + plug->name = AUPluginInfo::get_name (temp); + plug->type = PluginInfo::AudioUnit; + plug->n_inputs = 0; + plug->n_outputs = 0; + plug->category = "AudioUnit"; + plug->desc = new CAComponentDescription(temp); + + plugs.push_back(plug); + + comp = FindNextComponent (comp, &desc); } return plugs; diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index 096696aca5..2a753617e8 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -382,7 +382,7 @@ PluginManager::vst_discover (string path) << endl; } - PluginInfoPtr info(new PluginInfo); + PluginInfoPtr info(new VSTPluginInfo); /* what a goddam joke freeware VST is */ diff --git a/libs/ardour/state_manager.cc b/libs/ardour/state_manager.cc index bcffe381c3..153773ed30 100644 --- a/libs/ardour/state_manager.cc +++ b/libs/ardour/state_manager.cc @@ -72,6 +72,9 @@ StateManager::use_state (state_id_t id) void StateManager::save_state (std::string why) { + if (!should_save_state()) + return; + if (!_allow_save) { SaveAllowed.connect (mem_fun (*this, &StateManager::save_state)); return; diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index a551a15d28..4c09ba3440 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -488,9 +488,11 @@ VSTPluginInfo::load (Session& session) if (Config->get_use_vst()) { FSTHandle* handle; - - if ((handle = fst_load (info->path.c_str())) == 0) { - error << string_compose(_("VST: cannot load module from \"%1\""), info->path) << endmsg; + + handle = fst_load(path.c_str()); + + if ( (int)handle == -1) { + error << string_compose(_("VST: cannot load module from \"%1\""), path) << endmsg; } else { plugin.reset (new VSTPlugin (session.engine(), session, handle)); } diff --git a/libs/libsndfile/src/flac.c b/libs/libsndfile/src/flac.c index 1f0872f0bd..b74a4e3253 100644 --- a/libs/libsndfile/src/flac.c +++ b/libs/libsndfile/src/flac.c @@ -128,38 +128,38 @@ static const int legal_sample_rates [] = { 8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000 } ; -static inline void +static void s2flac8_array (const short *src, FLAC__int32 *dest, int count) { while (--count >= 0) dest [count] = src [count] >> 8 ; } /* s2flac8_array */ -static inline void +static void s2flac16_array (const short *src, FLAC__int32 *dest, int count) { while (--count >= 0) dest [count] = src [count] ; } /* s2flac16_array */ -static inline void +static void s2flac24_array (const short *src, FLAC__int32 *dest, int count) { while (--count >= 0) dest [count] = src [count] << 8 ; } /* s2flac24_array */ -static inline void +static void i2flac8_array (const int *src, FLAC__int32 *dest, int count) { while (--count >= 0) dest [count] = src [count] >> 24 ; } /* i2flac8_array */ -static inline void +static void i2flac16_array (const int *src, FLAC__int32 *dest, int count) { while (--count >= 0) dest [count] = src [count] >> 16 ; } /* i2flac16_array */ -static inline void +static void i2flac24_array (const int *src, FLAC__int32 *dest, int count) { while (--count >= 0) dest [count] = src [count] >> 8 ; |