Giter VIP home page Giter VIP logo

Comments (32)

baconpaul avatar baconpaul commented on June 9, 2024 1

screen shot 2018-12-08 at 5 21 20 pm

So I think you sort of need to work down this list of differences and create a correct info.plist file. Not impossible but I have no idea how to put that into the premake5.lua. And anyway its' dinner time here so I'm done for the day. I'm going to declare partial victory and go do something else for a bit!

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Oh and I meant to tag @esaruoho in this since he and I were chatting about it in last few days

from surge.

esaruoho avatar esaruoho commented on June 9, 2024

@baconpaul could you provide an image or a list of the files you grabbed from @getdunne's folder in AudioKit? Would help immensely. :) (see comment below)

from surge.

esaruoho avatar esaruoho commented on June 9, 2024

no, sorry, i was misguided.. you already have /libs/AUPublic there! thanks!

from surge.

esaruoho avatar esaruoho commented on June 9, 2024

i went and added vst3sdk as an includedirs in premake5.lua just to see if that would also assist :)

from surge.

esaruoho avatar esaruoho commented on June 9, 2024

I got this far:

linker command failed with exit code 1 (use -v to see invocation) clang

surge-au_xcodeproj_and_getting_audio_unit_to_link_on_macos_ _issue__58_ _kurasu_surge

but yeah, i've never seen it get this far! amazing work, @baconpaul !

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Yeah I just changed two things which fix those errors. DO a fresh checkout.

This just worked for me, but it wouldn't have 10 minutes ago.

git clone [email protected]:baconpaul/surge.git
cd surge
git checkout au-build
git submodule update --init --recursive
./build-osx.sh 

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Oh and if you expand that linker error it has a bunch of stuff about AUBase::foo missing I bet. That's fixed with the push I just did, including the C++ in the premake.lua.

And I think when you checkout you will need to use the https:// not git: to my git repo. Figure you know that tho!

Really appreciate knowing if it works for you.

from surge.

esaruoho avatar esaruoho commented on June 9, 2024

I have grabbed the new au-build, let's see! am running ./build-osx.sh

...and got a nice ** BUILD SUCCEEDED **!!!
__work_pb_surge_ _-bash_ _126x50

now, in surge/target/au/Release, I'm seeing

Surge.dylib		Surge.dylib.dSYM

and in surge/target/au/Debug am seeing

Surge-Debug.dylib.dSYM

Gonna boot up Xcode and see what that says (after clean and build). i wonder if this is supposed to kick up a Surge.component ?

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Nope. We are now into the next part of the problem. If you look at how the vst is build it creates a dylib in Xcode then runs the package-vst.sh to copy things around. So we need to figure out how to actually make a .component from the dll. Choices are, I guess

1: Add a .component target to Xcode but then we get into the AU2/AU3 nastiness.
2: Look at some other AU2 component and figure out how to put the files in place by writing a fragile shell script
3: Bite the bullet and port the whole thing properly to AU3.

I think 1 is the hardest, and 3 is the best, so I was going to try 2. Chuckle.

from surge.

esaruoho avatar esaruoho commented on June 9, 2024

Weird thing is that package-au.sh is

#!/bin/bash


echo "This is now redundant"
exit 0

whereas the package-vst.sh and package-vst3.sh actually do take the vst dylib files and "do something" with them :)

from surge.

esaruoho avatar esaruoho commented on June 9, 2024

@baconpaul well, amazing work! i guess there might be plenty of different build scripts out there to package them out, but .. i suppose the key is in finding a non-brittle one :)

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

I was taking a look at dexed just now which does this (dexed is an oss implementation of something very close to the DX-7: https://github.com/asb2m10/dexed) but it uses Juce. I suppose we could also use Juce.

But the contents of an AU2 component look like this

paul:~/Library/Audio/Plug-Ins/Components$ find Dexed.component -print
Dexed.component
Dexed.component/Contents
Dexed.component/Contents/MacOS
Dexed.component/Contents/MacOS/Dexed
Dexed.component/Contents/Resources
Dexed.component/Contents/Resources/Dexed.rsrc
Dexed.component/Contents/Resources/RecentFilesMenuTemplate.nib
Dexed.component/Contents/Info.plist
Dexed.component/Contents/PkgInfo

And yeah I know about package-au.sh. I added those 2 lines since it was both empty and non-executable 30 minutes ago :)

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Oh duh the place to look is the same AudioKit place where I found the AUPublic files.

https://github.com/AudioKit/AudioKit/tree/master/Developer/AKSampler/Mac%20AUv2%20Plugin

I bet that .xcodeproj has the goods inside it....

from surge.

esaruoho avatar esaruoho commented on June 9, 2024

this ain't a partial victory, this is a victory and a half!! great job @baconpaul
thanks for keeping at it so very patiently!

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Thanks! Yeah lots of progress today. Fun stuff.

But I’ll declare victory when it works in logic with mpe working properly, and we can make a pr to put it back on the main branch. Still some work to do...

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

So in resources/osx-au there is both an Info.plist and a PkgInfo already in the source tree. I wonder if just copying those around in the script could do it for us... that seems to be what the vst.sh does.

I'll see if I can get some time to look at that route rather than looking at the premake partial implementation of Xcode features which I think could be a bit of a pain.

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

In the "things which don't work breadcrumps" camp, I tried copying package-vst to package-au, changed the vst file names to au, modified Info.plist to have the right case for the Surge executable, and made a .component. But that component wouldn't even load in auval so that's clearly not right.

Also the Info.plist generated by latest Juce is way bigger than the Info.plist in resources/osx-au so that's probably way out of date too.

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

OK and a bit more looking. Seems the dylib we have linked isn't ejecting an AUFactory method. Here's two components I have that work in my system. These Factory entry points are explicitly referenced in the Info.plist for both.

paul:~/Library/Audio/Plug-Ins/Components$ nm -gU s\(M\)exoscope.component/Contents/MacOS/s\(M\)exoscope 
000000000004de80 T __ZN4juce20repostCurrentNSEventEv
00000000001d4ec0 D __ZTINSt3__113basic_ostreamIcNS_11char_traitsIcEEEE
00000000001d4ea8 D __ZTINSt3__115basic_streambufIcNS_11char_traitsIcEEEE
00000000001d4ef0 D __ZTINSt3__19basic_iosIcNS_11char_traitsIcEEEE
000000000017c3b0 S __ZTSNSt3__113basic_ostreamIcNS_11char_traitsIcEEEE
000000000017c370 S __ZTSNSt3__115basic_streambufIcNS_11char_traitsIcEEEE
000000000017c3e0 S __ZTSNSt3__19basic_iosIcNS_11char_traitsIcEEEE
00000000000014d0 T _sMexoscopeAUEntry
000000000000f5d0 T _sMexoscopeAUFactory
paul:~/Library/Audio/Plug-Ins/Components$ nm -gU Dexed.component/Contents/MacOS/Dexed  
000000000002d820 T _DexedAUEntry
000000000002d82a T _DexedAUFactory
000000000012309a T _VSTPluginMain
0000000000123172 T _main_macho

so when I fixed up the Info.plist to add something which looked like a factory function it referenced one that wasn't exported.

From looking through a few plugins, though, it seems we don't even really need to put the factory function in the Info.plist if the name matches "AUFactory".

So more digging into what that src/au code is actually doing!

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Aha! The AUDIO_COMPONENT_ENTRY macro in aulayer.cpp wasn't quite right and didn't match the info.plist. With that all fixed, I can now make a VST component which logic loads and crashes on!

screen shot 2018-12-08 at 8 06 13 pm

So that's good enough for me to commit and push (again to baconpaul/au-build) the three changes I had to make to get that far.

Close. Really close.

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

OK so some stuff starting to come through!

auvaltool -vt aumu VmbA

    AU Validation Tool
    Version: 1.6.1a1 
    Copyright 2003-2013, Apple Inc. All Rights Reserved.
    Specify -h (-help) for command options

--------------------------------------------------
VALIDATING AUDIO UNIT: 'aumu' - 'Srge' - 'VmbA'
--------------------------------------------------
Manufacturer String: VmbA
AudioUnit Name: Surge
Component Version: 1.0.0 (0x10000)

* * PASS
--------------------------------------------------
TESTING OPEN TIMES:
COLD:
Time to open AudioUnit:         8.419 ms
WARM:
Time to open AudioUnit:         0.009  ms
Segmentation fault: 11

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Huh getting a core file and a stack trace is a bit of work. Here's how to do it if you want to.

  • cp /usr/bin/auvaltool .
    • you have to do this since mojave won't allow you to attach a debugger to stuff owned by root thanks to SIP
  • ulimit -c unlimited
  • touch /cores/foo
  • rm /cores/foo
    • if those don't work, then you need to set permissions on /cores properly
  • ./auvaltool -vt aumu VmbA
    • this should dump a nice big /cores/core.(pid) file
  • lldb ./auvaltool -c /cores/core.(pid)
  • bt all

and you'll get your stack trace. From the trace below, it's clear that we have found, opened, and entered the linked .dylib and are crashing in filesystem somewhere in SurgeStorage after constructing SurgeSyntehsizer. So now we know where to look tomorrow I guess!

(lldb) bt all
* thread #1, stop reason = signal SIGSTOP
  * frame #0: 0x00007fff7d8ed14b libsystem_pthread.dylib`pthread_mutex_lock
    frame #1: 0x00007fff7d76d9c1 libsystem_c.dylib`closedir + 25
    frame #2: 0x00000001048523de Surge`std::experimental::filesystem::is_directory(p=<unavailable>) at filesystem.cpp:92 [opt]
    frame #3: 0x000000010486f029 Surge`SurgeStorage::refresh_wtlist(this=0x0000000104bd1230) at SurgeStorage.cpp:256 [opt]
    frame #4: 0x000000010486dfda Surge`SurgeStorage::SurgeStorage(this=0x0000000104bd1230) at SurgeStorage.cpp:173 [opt]
    frame #5: 0x0000000104874415 Surge`SurgeSynthesizer::SurgeSynthesizer(this=0x0000000104bd1000, parent=0x00007fe3f3018240) at SurgeSynthesizer.cpp:25 [opt]
    frame #6: 0x000000010485dada Surge`aulayer::Initialize() [inlined] aulayer::InitializePlugin(this=0x00007fe3f3018240) at aulayer.cpp:112 [opt]
    frame #7: 0x000000010485dac2 Surge`aulayer::Initialize(this=0x00007fe3f3018240) at aulayer.cpp:130 [opt]
    frame #8: 0x00000001048370a6 Surge`AUBase::DoInitialize(this=0x00007fe3f3018240) at AUBase.cpp:206 [opt]
    frame #9: 0x0000000104844b6b Surge`AUMethodInitialize(self=<unavailable>) at AUPlugInDispatch.cpp:25 [opt]
    frame #10: 0x00000001035f016e auvaltool`___lldb_unnamed_symbol13$$auvaltool + 90
    frame #11: 0x00000001035ef971 auvaltool`___lldb_unnamed_symbol8$$auvaltool + 697
    frame #12: 0x00000001035fcfbd auvaltool`___lldb_unnamed_symbol115$$auvaltool + 417
    frame #13: 0x00000001035ee6af auvaltool`___lldb_unnamed_symbol3$$auvaltool + 2285
    frame #14: 0x00000001035edced auvaltool`___lldb_unnamed_symbol2$$auvaltool + 384
    frame #15: 0x00007fff7d6fd08d libdyld.dylib`start + 1
    frame #16: 0x00007fff7d6fd08d libdyld.dylib`start + 1
  thread #2, stop reason = signal SIGSTOP
    frame #0: 0x00007fff7d8375be libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff7d8ee661 libsystem_pthread.dylib`_pthread_wqthread + 446
    frame #2: 0x00007fff7d8ee435 libsystem_pthread.dylib`start_wqthread + 13
  thread #3, stop reason = signal SIGSTOP
    frame #0: 0x00007fff7d8ee428 libsystem_pthread.dylib`start_wqthread

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Huh wow filesystem actually had an error in is_directory! It did a closedir(dp) without checking if dp was null. Added a guard and pushed to au-build. Now my crash is somewhere else (it's in the xml parser).

Neat. There's now a clean workflow to build test stack trace and debug. I added a small script called install-local-au.sh which packages and installs the AU for you so you can run auval and see. I also added output with build time so you know what you are running.

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Hey the SurgePatch also was under-conservative with null checks so I fixed those also.

Now I'm getting a crash far later on. We get through a large amount of validation before we segfault. Seems we are now faulting on CFGetTypeID with a bit of a mangled stack, so I'm going to call it a night.

But hey we have a built audio unit linked from the code which actually enters the code under auvalidation so I think we can call this a partial victory plus!

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

GOT IT!!

I found the last bug making us segfault and I can now link and pass auvalidation with the Surge on baconpaul/au-build.

That let me load it into logic, instantiate it on a track, send midi to it, and have it make a horrible popping noise which seems like it may have been bad for my speakers! Use a limiter, folks!

The Cocoa UI is not loading properly so it is using the default parameter UI in logic. auval also says that it has no cocoa UI so that should be easy to fix.

And in the "pictures or it didn't happen" meme camp, here's a screenshot.

And now, I'm calling it a night. That was a fun day of hacking!!

screen shot 2018-12-08 at 9 21 35 pm

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Ha OK and the reason there is no UI is because aulayer has only implemented a carbon ui, not a cocoa one, and no way carbon runs on a modern mac. So some actual work to do there. Look at the #if MAC_COCOA in aulayer.cpp if you feel like some cocoa C++ hacking. I may get to that this week. Will see.

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

And hey if you pull to head this morning you will find a few more updates which mean it actually plays sounds and you can adjust at least one parameter and hear a change. I updated the README and all the scripts, and got the code in a state where we could contemplate a (big) pull request but there's a couple of other things I want to do before I go that route.

I think a pull request with "makes some sound, no UI" is a reasonable point though and will spend a bit of time this morning working towards that.

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Hey and if yo pull now, in addition to building and working, it will load all the presets and wavetables if you run the ./installer-local-au.sh script to stage them in the right place. (How to do this as a proper install is for the future).

I can now pick from 1000 odd presets and make them sound in logic 10.4 with a 64 bit AU! Wahey!

from surge.

Jorgeelalto avatar Jorgeelalto commented on June 9, 2024

Can't wait to get my hands dirty with the Win/Linux version, amazing work guys! We also had problems with GUIs in the Linux realm I think so for me it's very interesting to follow this thread :)

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Cool! Not sure how much of this will be in common with Linux or Windows. It seems almost all in mac /cocoa/au land. But happy to toss in any ideas!

Since au-build is in the PR, I am now working on au-build-ui with the UI stuff if you want to keep following at home. But nothing works there at all!

from surge.

esaruoho avatar esaruoho commented on June 9, 2024

@baconpaul did you see that #59 was merged in? :) so awesome!

from surge.

baconpaul avatar baconpaul commented on June 9, 2024

Yep; great this was merged. Move the UI action to a new issue #61 and am closing this one.

from surge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.