can a vst plugin output midi data?

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

texture wrote:
jackle&hyde wrote: It's not my code. :D
good.
Glad to see some of your real work!
My real development work is none of your business. A lot of it is confidential.
VST stuff is just a hobby for me.
Be careful to teach experienced developers with a brunch of releases out there...
(I mean, the crators of those examples have also allot of those experiences!) :lol:
I was merely pointing out a nicer way of writing it. I did say not to take it as a personal attack - it wasn't intended to be one.

If experienced developers have lost thier enthusiasm for finding better ways to do things, then thats just fine. I personally quite like finding out little ways to do things better.
There are other people on here who might feel the same, and might have found it useful.

Wow, someone missed the sarcasm train, been up late coding texture? :hihi:
The armchair is more than the sum of the bastards

Post

texture wrote:
_niko_ wrote: a method should only have a single return statement, so I'd prefer to use a automatic variable, set that to a value depending on the conditions and return it at the end of the method
Generally I'd agree - I think it often makes the code more readable and maintainable to do this. I usually only bother when it would be confusing to someone reading the code if it hadn't been done.
_niko_ wrote: canDo is not really time critical code, but in theory the version with the multiple ifs is faster 'cause it doesn`t have to evaluate 5 string comparisons every time...
Neither does the second one.

Thanks for the examples guys. I think this 'one return' idea may be a generally good idea, but I have to say I prefer Texture's way of doing it. Assigning another variable for something like this ..well I don't think it really makes it better, just fits some folks style better. Stefans is probably best, but it is an area I'm not yet comfortable in.

cheers,

Wolf

Post

_niko_ wrote:both versions suck :lol:

a method should only have a single return statement, so I'd prefer to use a automatic variable, set that to a value depending on the conditions and return it at the end of the method :wink:

canDo is not really time critical code, but in theory the version with the multiple ifs is faster 'cause it doesn`t have to evaluate 5 string comparisons every time...

Niko

p.s. don't take this serious, I couldn't resist and in the end I think these things have a lot to do with personal preferences, coding habits etc. As long as it works and you understand what you're doing it is perfectly ok, imho.

Code: Select all

long YourPlugin::canDo (char* text)
{
    return ((0 == strcmp(text, "receiveVstEvents"))
     || (0 == strcmp(text, "receiveVstMidiEvent"))
     || (0 == strcmp(text, "receiveVstTimeInfo"))
     || (0 == strcmp(text, "sendVstEvents"))
     || (0 == strcmp(text, "sendVstMidiEvent"))
    )?1:-1;
} 
happy?
Image

Post

No no no...

What you want to do is hash all the cando strings and have those in an array. Then at runtime, you hash the 'text' parameter, and iterate through the array, performing an integer comparison between the hashes.... yes... that is definately the way to do it :P

:hihi:

Oh yeah, meeks.. I don't the sarcasm train was running... :roll:
We can conclude that the DCT of a pizza doesn’t resemble anything edible.

Post

fingerbib2000 wrote:this is like some kind of nerd playground!!
???

*looks around*

... um, yes, it is. Surely you'd noticed before. Great, innit? =^_^=

Remember kids: Without "nerds" you wouldn't have any "plugs."

Post Reply

Return to “DSP and Plugin Development”