-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. An attempt at a moderately reasonable hash for the subt in multi-mode. 2. Actually load the description
- Loading branch information
Showing
5 changed files
with
183 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* document | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <AudioUnitSDK/AUEffectBase.h> | ||
#include <AudioUnitSDK/AUMIDIEffectBase.h> | ||
#include <AudioUnitSDK/MusicDeviceBase.h> | ||
|
||
#include <iostream> | ||
#include "auv2_shared.h" | ||
#include <memory> | ||
|
||
namespace free_audio::auv2_wrapper | ||
{ | ||
|
||
// ------------------------------------------------------------------------------------------------- | ||
|
||
class ClapWrapper_AUV2_Effect : public ausdk::AUEffectBase | ||
{ | ||
using Base = ausdk::AUEffectBase; | ||
ClapBridge bridge; | ||
public: | ||
explicit ClapWrapper_AUV2_Effect(const std::string &clapname, const std::string &clapid, | ||
int clapidx, AudioComponentInstance ci) | ||
: Base{ci, true}, bridge(clapname, clapid, clapidx) | ||
{ | ||
std::cout << "[clap-wrapper] auv2: creating effect" << std::endl; | ||
std::cout << "[clap-wrapper] auv2: id='" << clapid << "' index=" << clapidx | ||
<< std::endl; | ||
|
||
bridge.initialize(); | ||
} | ||
}; | ||
|
||
class ClapWrapper_AUV2_NoteEffect : public ausdk::AUMIDIEffectBase | ||
{ | ||
using Base = ausdk::AUMIDIEffectBase; | ||
ClapBridge bridge; | ||
|
||
public: | ||
explicit ClapWrapper_AUV2_NoteEffect(const std::string &clapname, const std::string &clapid, | ||
int clapidx, AudioComponentInstance ci) | ||
: Base{ci, true}, bridge(clapname, clapid, clapidx) | ||
{ | ||
std::cout << "[clap-wrapper] auv2: creating note effect" << std::endl; | ||
std::cout << "[clap-wrapper] auv2: id='" << clapid << "' index=" << clapidx | ||
<< std::endl; | ||
|
||
|
||
bridge.initialize(); | ||
} | ||
}; | ||
|
||
// ------------------------------------------------------------------------------------------------- | ||
|
||
class ClapWrapper_AUV2_Instrument : public ausdk::MusicDeviceBase | ||
{ | ||
using Base = ausdk::MusicDeviceBase; | ||
ClapBridge bridge; | ||
|
||
public: | ||
explicit ClapWrapper_AUV2_Instrument(const std::string &clapname, const std::string &clapid, | ||
int clapidx, AudioComponentInstance ci) | ||
: Base{ci, 0, 1}, bridge(clapname, clapid, clapidx) | ||
{ | ||
std::cout << "[clap-wrapper] auv2: creating instrument" << std::endl; | ||
std::cout << "[clap-wrapper] auv2: id='" << clapid << "' index=" << clapidx | ||
<< std::endl; | ||
|
||
bridge.initialize(); | ||
} | ||
|
||
bool StreamFormatWritable(AudioUnitScope, AudioUnitElement) override { return true; } | ||
|
||
bool CanScheduleParameters() const override { return false; } | ||
}; | ||
} // namespace free_audio: auv2_wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
|
||
#pragma once | ||
|
||
#include "detail/clap/fsutil.h" | ||
|
||
namespace free_audio::auv2_wrapper | ||
{ | ||
struct ClapBridge | ||
{ | ||
std::string _clapname; | ||
std::string _clapid; | ||
int _idx; | ||
|
||
Clap::Library _library; | ||
|
||
const clap_plugin_descriptor_t *_desc{nullptr}; | ||
|
||
ClapBridge(const std::string &clapname, | ||
const std::string &clapid, | ||
int idx) : _clapname(clapname), _clapid(clapid), _idx(idx) | ||
{ | ||
} | ||
|
||
void initialize() | ||
{ | ||
if (!_library.hasEntryPoint()) | ||
{ | ||
if (!_library.load(_clapname.c_str())) | ||
{ | ||
std::cout << "[ERROR] cannot load either by internal entry nor _clapname" << std::endl; | ||
return; | ||
} | ||
} | ||
|
||
if (_clapid.empty()) | ||
{ | ||
if (_idx < 0 || _idx >= _library.plugins.size()) | ||
{ | ||
std::cout << "[ERROR] cannot load by index" << std::endl; | ||
return; | ||
} | ||
_desc = _library.plugins[_idx]; | ||
} | ||
else | ||
{ | ||
for (auto *d : _library.plugins) | ||
{ | ||
if (strcmp(d->id, _clapid.c_str()) == 0) | ||
{ | ||
_desc = d; | ||
} | ||
} | ||
} | ||
|
||
if (!_desc) | ||
{ | ||
std::cout << "[ERROR] cannot determine plugin description" << std::endl; | ||
return; | ||
} | ||
|
||
std::cout << "[clap-wrapper] auv2: Initialized '" << _desc->id << "' / '" << _desc->name << "'" << std::endl; | ||
} | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters