*** Disclaimer ***
PreSonus does not officially encourage nor support the use of these kinds of end user created third party or external add-ons nor any other relative hacks. These tools are created and supported by end users and have no official relation to or with PreSonus Inc. nor to any of it's employees or representatives. General Warning You should never run these types of Windows applications from anyone other than someone you deem to be completely trustworthy. Given that these development languages can very easily expose your system via the Win API's, malicious intent should always be assumed unless you actually know or trust the developer and/or you can actually read and compile the source code yourself to be certain of what it's doing, or rather, not doing. ______________________________________________________________________________ Objective This thread will cover how to create external add-ons for Studio One Windows. The process is easy even if you have no coding skills or experience and the language being used, Visual Basic, is very easy to learn and grasp in a really short time. Hopefully this tutorial will be useful for anyone who wants to create add-on tools for Studio One for Windows. ______________________________________________________________________________ General Overview This thread was inspired by fellow forumite Johnny Geib who suggested during a phone conversation that "he wished he could do that stuff" things like this, by himself, and the reality is that he or anyone easily can, with a really small and short learning curve. Studio One is a really great application as we all know, but it's still relatively young. With that being the case, some third party tools can help extend the application while development continues, so (at least on Windows) using something like Visual Basic is a really easy way to get that done. While the add-ons I've created for Studio One like the Chord Generator are not optimal solutions and would be easily bested by any decent native code solution, they can serve as good temporary fillers, useful tools in the interim. With that said, we'll walk through some of the basics. ______________________________________________________________________________ Getting Started Download and install Visual Studio Express for Windows Desktop If you work on Windows 8.1 exclusively install Visual Studio 2013 for Windows Desktop. If you have systems with both Win 7 and 8.1, install Visual Studio 2012 for Windows Desktop I've Never Written A Single Line of Code So ... What Now? Don't fret. It's very easy and I'll take you through some basic steps below and then we'll talk more later about how to talk to Studio One via your custom application. Our examples will skip over some of the more complex coding techniques and focus more on some basic useful things. ______________________________________________________________________________ Your First Application When you launch Visual Studio your should see a New Project link on the left of the start page. Click it to create a new project. On the left of the New Project dialog you'll see the templates. Make sure you select Visual Basic and also,select Windows Forms Application as shown in the graphic below, Give your project a name in the box at the bottom and click OK. My sample application below is simply named "My Application". Name yours whatever you like. After the project is created you should see the Windows form as shown below... In keeping with tradition, our first app will be a Hello World application. Double click anywhere on the form to open the code editor and you'll see a sub routine named Form1_Load. This is the code block that will run when Form1 loads, when the application starts. Add the following code line into that code block as shown below, the line beginning with MsgBox, in between the Private Sub and End Sub lines... Now click the Start button on the toolbar or hit F5 to launch your application ... Congratulations. You've just created your first Windows application. ______________________________________________________________________________ How To Make Your Application Talk To Studio One and Maybe Do Some Cool Stuff You may be surprised at how easy that actually is, even for people who've never written a line of code. In subsequent posts we'll talk about how to get the application window identifier for Studio One (technically known as the window handle or hWnd), and how to make your custom application send keystrokes or other system messages to Studio One, and later maybe how to drag and drop things from your custom application into Studio One and vice versa. Later on we can also get into some other techniques like looping, loading list boxes, writing files, etc, etc, which is all really easy in this language. If anyone is interested in pursuing this, drop in some suggestions here about what to develop, a community add-on project to pursue as a simple learning tool for those wanting to learn how to do this kind of thing. |
Now i wish i was on pc
|
Here's a beta of the song browser thingy if anyone wants to try it.
Note: One thing I need to know is if the COM object being used for unzip is common on Win systems [Interop.Shell32.dll] and if not, I'll need to include it when distributing the exe file. If it's not a common system bit on Win 7/8, the unzip will probably fail badly when you run the beta.
|
"Hello World" what memories... i taught myself to program in BASIC (an acronym for Beginner's All-purpose Symbolic Instruction Code) out of the back of magazines. i started on the Tandy/Radioshack TRS-80 Color Computer (The CoCo) a day before it was released to the public. that was the first program i wrote (in BASIC) and even on into college when learning Pascal and Cobalt that was always the first tutorial... to print "Hello World" to the screen no matter what programming language used. in machine language and binary we had to draw a candle on the screen a pixel at a time. enough about my memories... just wanted to say thank you for stirring those memories back up. i haven't programmed since leaving college. i used to do it just for fun and i loved it. but i would prefer to dig ditches than to program for a living. at least with digging ditches... you can go home, prop up your feet and relax. but with programming... you could NEVER leave the job. your mind would ALWAYS try to work out that sub-routine... or how you should flag things... and OH the PAIN of finding errors.
who knows... i will go over your tutorials a few times and see if i can understand the syntax. maybe i will try my hand at programming again. but i am almost 30 yrs behind the times as far as languages go. i will see if i can get my head around it. when i was manic once i spent four days in the chair manually installing linux by command line. did not eat or sleep for four days. lol |
As a general side note for anyone currently using the track naming tool...
I inadvertently (like... completely by accident) stumbled onto a key combo that appears to sometimes directly enable a track name field for editing instead of double clicking on it, Shift+Tab, but the conditions of exactly when that happens and how it happens (it seems to enable the previous track track's name field from no field being enabled, not the currently selected track), is still somewhat ambiguous. If I can narrow that down to a predictable pattern of behavior, that will have good implications for the track naming tool, not having to always double click a track field first to enable an edit field to begin doing "stuff". |
You mean you want to rename the currently selected track? Shift + Tab, as you said, allows you to rename the track on top of your selection, Tab allows you to rename the one under your selection. You can either do Tab -> Shift + Tab, or Shift + Tab -> Tab to rename your selected track. Doesn't work if you only have one track though.
Also, I'd love to see how you code your addons (source maybe?). I'm coding in C# most of the time and I'd love to write custom addons for Studio One. Here is the last tool I did and I'd like it to interact with Studio One. Thanks! PS: None of your tools work on my computer :/ |
Lmike, I searched for "Interop.Shell32.dll" on my win 7 computer and couldn't find it.
|
Nice.
Share, with source so I can see how some of the lower level approaches compare. Your UI is certainly way flashier than my little keyboard thing and the UNDO button is a nice touch. As to Tab and Shift + Tab, yes, I know how they typically work but what I was trying to do was find a way to make something like that work without the track panel being in focus. Even with Tab or Shift Tab (from no field enabled) you still have to "touch" a track panel with the mouse first to put the focus there. Of course, if there was an action to edit the selected track name it would all be moot. |
Also, I'd love to see how you code your addons (source maybe?). I can do that. But you can view the source from any non-obfuscated .Net app with IlSpy http://ilspy.net and i certainly haven't bothered to try to make any of those free tools source code unreadable by those types of tools. |
whitePhazer wroteLmike, I searched for "Interop.Shell32.dll" on my win 7 computer and couldn't find it. Ah, ok, thanks. If i continue sharing that beta I'll package that dll in the zip... or try try to find a way to compile it into the executable or reference it as a resource so i will only have to distribute one file. Appreciated. |
Okay, here is a link, good luck trying to read the code, no comments or anything (and crappy code ). If it doesn't work or you have any questions, tell me.
I'm using VS2012 to compile (UI is WPF & code in C#). By the way, the undo button is just a couple delete inputs, as I've shown in the video it doesn't work unless you've selected ONE note of your LAST chord. In order to use it, you need to create a C note (any octave) & copy or cut it (if you copy, don't forget to delete it). Then you just have to click on Studio One & on a chord (on the left). See the video above, it shows everything. No custom chords as of now, you're only able to use the ones on the left. I want to keep this tool as simple as possible for now. I've already decompiled your code to check how you handled a few things, as I said, couldn't wait I wish we could have access to an API or something, would be so cool & make life much, much easier for some tasks. |
Cool. I just looked over some of the C# code on my iPad. Nice.
Re: FindWindow... One thing Jeff and I ran into last year with the FindWindow API is a conflict with CCLWindowClass when some other PreSonus window classes are running, like the Universal Mixer thing, which have the same class names. After bumping into that we stopped using FindWindow and started parsing the handle by process, which is more reliable in this particular case...
That combination of conditions could only ever be the Studio One main application window, so it was a safer code bit, for us anyway. Jeff debugged a good bit of my sloppy "just make it work for now and worry about trapping bugs later" Speedy Gonzales code. |
Yeah, when I first ran into that class name conflict I added a GetWindowText API call as a verifier, to make sure I had the right window, but the process method is much cleaner than making those two API calls and cross checking all that stuff.
Anyway, i like the way you laid out the chords structures in code. If you de-compiled my code I'm pretty sure you saw that relative mess. The way you did it is much cleaner and way more readable. |
Yeah, the way you handled chords looks like a mess .
Personally, when I code something like that, I think about the simplest way possible. For this project, well, I just thought about how scales are working: you take a root note & use the scales' intervals. So I just did that: -> Lay down the possible roots (from C to B) -> List scales & their intervals. From there, when I want to compute a specific scale, I start with the root note, write it down, & continue with intervals. Example: C = 0, C# = 1, ... B = 11 (see comments in Utils.cs 78/79) So, let's say I want a C Major: I start from 0, write it down -> {0}, then add the first interval (2) -> 0+2 = 2. You now have {0,2}. And we continue from the last note (2 -> D): 2+2 -> 4+1 -> 5+2 -> 7+2 -> 9+2 etc etc Finally, we have {0,2,4,5,7,9,11}. Want to continue an octave higher? Add 12. Seems complicated at first, but it's quite simple in the end (okay, it's a bit complicated in code ). Plus I can add a scale really quickly with that method. In fact I'm not limited at all, I can even add a scale that doesn't exist. Just updated the code to check the process, shouldn't conflict with Universal Mixer etc now. Oh, almost forgot, the way you're handling chords doesn't work with user presets, try to save a chord made with a root different than C & load it (with the same root). You should have a wrong chord. To make them work you have to make a chord in C, save it, load it in C and THEN you can change the root (if you load it with a different root it'll be wrong). |
Nelios wroteOkay, here is a link, good luck trying to read the code, no comments or anything (and crappy code ). If it doesn't work or you have any questions, tell me. Hey, thanks for sharing Nelios - very generous and enlightening. Looking forward to sinking my teeth into this during the week! Cheers!! |
Users browsing this forum: No registered users and 19 guests