1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-16 16:20:50 +02:00

A few changes that will be needed for 64 bit Mac compilability

This commit is contained in:
Paul Licameli 2018-11-15 11:21:39 -05:00
commit 53fcd07b77
5 changed files with 46 additions and 22 deletions

View File

@ -890,7 +890,7 @@ class AudioThread {
}
static void *callback(void *p) {
AudioThread *th = (AudioThread *)p;
return (void *)th->Entry();
return reinterpret_cast<void *>( th->Entry() );
}
void Run() {
pthread_create(&mThread, NULL, callback, this);

View File

@ -109,7 +109,11 @@ bool VSTControl::Create(wxWindow *parent, VSTEffectLink *link)
}
#endif
if (!mView && !mHIView)
if (!mView
#if !defined(_LP64)
&& !mHIView
#endif
)
{
return false;
}

View File

@ -1114,12 +1114,12 @@ void VSTEffect::BundleDeleter::operator() (void* p) const
CFRelease(static_cast<CFBundleRef>(p));
}
void VSTEffect::ResourceDeleter::operator() (void *p) const
void VSTEffect::ResourceHandle::reset()
{
if (mpHandle) {
int resource = (int)p;
CFBundleCloseBundleResourceMap(mpHandle->get(), resource);
}
if (mpHandle)
CFBundleCloseBundleResourceMap(mpHandle, mNum);
mpHandle = nullptr;
mNum = 0;
}
#endif
@ -2061,10 +2061,8 @@ bool VSTEffect::Load()
mBundleRef = std::move(bundleRef);
// Open the resource map ... some plugins (like GRM Tools) need this.
mResource = ResourceHandle {
reinterpret_cast<char*>(
CFBundleOpenBundleResourceMap(mBundleRef.get())),
ResourceDeleter{&mBundleRef}
mResource = ResourceHandle{
mBundleRef.get(), CFBundleOpenBundleResourceMap(mBundleRef.get())
};
#elif defined(__WXMSW__)
@ -2267,7 +2265,7 @@ void VSTEffect::Unload()
if (mModule)
{
#if defined(__WXMAC__)
mResource = ResourceHandle{};
mResource.reset();
mBundleRef.reset();
#endif

View File

@ -302,15 +302,27 @@ private:
BundleHandle mBundleRef;
struct ResourceDeleter {
const BundleHandle *mpHandle;
ResourceDeleter(const BundleHandle *pHandle = nullptr)
: mpHandle(pHandle) {}
void operator() (void*) const;
struct ResourceHandle {
ResourceHandle(
CFBundleRef pHandle = nullptr, CFBundleRefNum num = 0)
: mpHandle{ pHandle }, mNum{ num }
{}
ResourceHandle& operator=( ResourceHandle &&other )
{
if (this != &other) {
mpHandle = other.mpHandle;
mNum = other.mNum;
other.mpHandle = nullptr;
other.mNum = 0;
}
return *this;
}
~ResourceHandle() { reset(); }
void reset();
CFBundleRef mpHandle{};
CFBundleRefNum mNum{};
};
using ResourceHandle = std::unique_ptr<
char, ResourceDeleter
>;
ResourceHandle mResource;
#endif

View File

@ -173,12 +173,20 @@ bool AUControl::Create(wxWindow *parent, AudioComponent comp, AudioUnit unit, bo
#endif
}
if (!mView && !mHIView)
if (!mView
#if !defined(_LP64)
&& !mHIView
#endif
)
{
CreateGeneric();
}
if (!mView && !mHIView)
if (!mView
#if !defined(_LP64)
&& !mHIView
#endif
)
{
return false;
}
@ -186,10 +194,12 @@ bool AUControl::Create(wxWindow *parent, AudioComponent comp, AudioUnit unit, bo
// wxWidgets takes ownership so safenew
SetPeer(safenew AUControlImpl(this, mAUView));
#if !defined(_LP64)
if (mHIView)
{
CreateCarbonOverlay();
}
#endif
// Must get the size again since SetPeer() could cause it to change
SetInitialSize(GetMinSize());