This forum is for Tips and Tricks. Please do not post any questions in this forum. It is only for information.
78 postsPage 1 of 4
1, 2, 3, 4
*** 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
______________________________________________________________________________

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.

    Image

After the project is created you should see the Windows form as shown below...

    Image

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.

    Image

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...

    Image

Now click the Start button on the toolbar or hit F5 to launch your application ...

    Image

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.
User avatar
by matthewgorman on Thu Jun 26, 2014 2:00 pm
Nice post.

Matt

Lenovo ThinkServer TS140 Win 10 64bit, 8GB RAM, Intel Xeon
Lenovo Thinkpad E520, Windows 7 64bit, 8 GB RAM, Intel i5 Processor

S1Pro V5
User avatar
by sirmonkey on Tue Jul 01, 2014 10:00 pm
This sounds interesting. What kind of stuff can you do with add-ons?

Atari 5200, 64K RAM S1PRO Radio Shack Cassette Recorder w/internal Mic, and too many plugins.
User avatar
by Lawrence on Tue Jul 01, 2014 10:12 pm
sirmonkey wroteThis sounds interesting. What kind of stuff can you do with add-ons?

Dunno. Whatever you can imagine that's viable or possible I suppose. This one below is probably the most musically useful one to date. The others tend to lean more towards housekeeping.

phpBB [video]
User avatar
by Waveformbakery on Wed Jul 02, 2014 3:57 am
Now i wish i was on pc 8-)

Mac Pro 8-Core Early 2008 | 16GB | OSX 10.9.2 Klein & Hummel O300 | RME Fireface 800 | Presonus Studio One | Chandler Germanium Pair | Avalon 2055 EQ | Eventide Eclipse | Roland Space Echo RE-201 | AKG BX-22E Spring Tank | Tapco 4400A Spring Reverb | Korg Mono/Poly | Roland Juno-60 |
User avatar
by Lawrence on Wed Jul 02, 2014 8:59 am
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.


phpBB [video]

Attachments
song_info_beta1.zip
(24.22 KiB) Downloaded 554 times
User avatar
by jBranam on Fri Jul 04, 2014 4:57 am
"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

“Life is so constructed, that the event does not, cannot, will not, match the expectation.”

Knot Hardly Productions
¯\_ { ͡• ͜ʖ ͡•} _/¯
User avatar
by Lawrence on Fri Jul 04, 2014 8:51 am
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".
User avatar
by Nelios on Sat Jul 05, 2014 6:58 am
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 :/
User avatar
by whitePhazer on Sat Jul 05, 2014 7:39 am
Lmike, I searched for "Interop.Shell32.dll" on my win 7 computer and couldn't find it.

Win 7 64bit
Studio One Professional x64 (always latest update)
Intel i5 3.30GHz overclocked @ 4.20 GHz
Azus deluxe Motherboard
8GB RAM
M-AUDIO - Audiophile 192
M-Audio Oxygen 49
Akai MPD26
American Fender Stratocaster Deluxe
Retired, plenty of spare time
User avatar
by Nelios on Sat Jul 05, 2014 12:47 pm
Well, never mind, couldn't wait, I had to find how to do it myself, here is the result:
phpBB [video]


I may release it (as well as source code) if someone is interested. Thanks for the idea :)
User avatar
by Lawrence on Sat Jul 05, 2014 2:00 pm
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. :D

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.
User avatar
by Lawrence on Sat Jul 05, 2014 2:15 pm
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.
User avatar
by Lawrence on Sat Jul 05, 2014 2:24 pm
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.
User avatar
by Nelios on Sat Jul 05, 2014 3:32 pm
Okay, here is a link, good luck trying to read the code, no comments or anything (and crappy code :lol:). 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 :D

I wish we could have access to an API or something, would be so cool & make life much, much easier for some tasks.
User avatar
by Lawrence on Sat Jul 05, 2014 4:03 pm
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...

Code: Select all
For Each p As Process In Process.GetProcesses
            If InStr(p.MainWindowTitle, "Studio One") > 0 And p.ProcessName = "Studio One" Then
             
             'Set the handle var or return value if function (p.MainWindowHandle)
           
             End If
Next

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. :)
User avatar
by Nelios on Sat Jul 05, 2014 4:30 pm
Good point, I wanted to check if the window name contained "Studio One" (was planning on implement it later) but checking its name directly is way easier, I'll update asap. Thanks!
User avatar
by Lawrence on Sat Jul 05, 2014 4:35 pm
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.
User avatar
by Nelios on Sat Jul 05, 2014 5:20 pm
Yeah, the way you handled chords looks like a mess :D.
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 :P). 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).
User avatar
by tshadgett on Sat Jul 05, 2014 5:34 pm
Nelios wroteOkay, here is a link, good luck trying to read the code, no comments or anything (and crappy code :lol:). 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 :D

I wish we could have access to an API or something, would be so cool & make life much, much easier for some tasks.


Hey, thanks for sharing Nelios - very generous and enlightening.
Looking forward to sinking my teeth into this during the week!

Cheers!!

78 postsPage 1 of 4
1, 2, 3, 4

Who is online

Users browsing this forum: No registered users and 19 guests