Plug-ins, Hosts, Apps,
Hardware, Soundware
Developers
(Brands)
Videos Groups
Whats's in?
Banks & Patches
Download & Upload
Music Search
KVR
   
KVR Forum » DSP and Plug-in Development
Thread Read
Struggling with VSTs
pieroni
KVRer
- profile
- pm
PostPosted: Thu Jan 10, 2013 3:05 am reply with quote
Hi,

I'm attempting to learn how to code VSTs... I've done all the examples that come in the Steinberg SDK, modified them to do slightly different things, but now I'm trying to teach myself how to do more. I've found some useful sources on the internet... more specifically from here:

https://ccrma.stanford.edu/~medearis/220c/

I've been trying to compile this without the gui, just plain and simple, but for some reason when I try to use it there is no sound output. If anyone has seen this or knows what the issue might be, it would be greatly appreciated.

I've pulled all the code together into this vis studio project...

http://dl.dropbox.com/u/21696319/VstXSynth.rar

Any help would be greatly appreciated
^ Joined: 01 Dec 2012  Member: #293369  
bitwise
KVRist
- profile
- pm
PostPosted: Sun Jan 13, 2013 7:29 am reply with quote
Try it in "Release|Win32" configuration.
^ Joined: 18 Mar 2012  Member: #277127  
pieroni
KVRer
- profile
- pm
PostPosted: Mon Jan 21, 2013 2:30 am reply with quote
for whatever reason, when i compile a release version there is no dll file to use. Clearly I'm doing something wrong, do you have any ideas of what this could be?
^ Joined: 01 Dec 2012  Member: #293369  
bitwise
KVRist
- profile
- pm
PostPosted: Mon Jan 21, 2013 2:41 am reply with quote
Does it show some error?

I can't tell you more, i don't have VS2012.

Perhaps, when switching to the new configuration, you have to update some project's setting.
^ Joined: 18 Mar 2012  Member: #277127  
pieroni
KVRer
- profile
- pm
PostPosted: Mon Jan 21, 2013 2:52 am reply with quote
Sorry, it was my bad. It was just in another directory that I didn't bother checking haha.

After checking to see whether that works though, it appears I do get some sort of output, but its incredibly distorted and quiet and doesnt do anything near to what I want it to.
^ Joined: 01 Dec 2012  Member: #293369  
bitwise
KVRist
- profile
- pm
PostPosted: Mon Jan 21, 2013 4:53 am reply with quote
It could be the std::vector class inside the audio loop, which is not fast enough. The fact that it starts working in Release mode seems to show that, in fact, some checks are removed in the Release code.
^ Joined: 18 Mar 2012  Member: #277127  
kuniklo
KVRAF
- profile
- pm
- www
PostPosted: Tue Jan 22, 2013 1:36 am reply with quote
bitwise wrote:
It could be the std::vector class inside the audio loop, which is not fast enough. The fact that it starts working in Release mode seems to show that, in fact, some checks are removed in the Release code.

I'd expect this to increase the CPU load but not to prevent the VST from working entirely.
^ Joined: 28 Jan 2004  Member: #12072  Location: Nha Trang, Vietnam
bitwise
KVRist
- profile
- pm
PostPosted: Tue Jan 22, 2013 4:46 am reply with quote
I experienced this, once. It was a stand alone application and i was using either a std::list or a std::vector. No sound. Then i measured the time it took to fill a buffer or something (if i remember). The precision was in milliseconds. I got numbers with 2 digits, sometimes 3. Perhaps i didn't try the Release version, but i replaced the list with a list wrapped around an array. I got numbers with "zero" digits (less than 1 msec). Perhaps the use of the vector was a bit more intensive than the vstxsynth one.
^ Joined: 18 Mar 2012  Member: #277127  
pieroni
KVRer
- profile
- pm
PostPosted: Tue Jan 22, 2013 10:30 am reply with quote
so do you think it would be this area causing me the grief? is this where i should be spending most of my time and efforts?
^ Joined: 01 Dec 2012  Member: #293369  
Mayae
KVRer
- profile
- pm
PostPosted: Tue Jan 22, 2013 1:36 pm reply with quote
I didn't check the code, but almost certainly wont be a using a vector. Those are optimized to hell, unless you use them wrongly (ie. pushing something back in thousands of times instead of reallocating). You will experience buffer underruns and in extreme cases no sound if you cannot generate samples quicker than 1 sec / sample_rate. You can check how much cpu it uses.
^ Joined: 01 Jan 2013  Member: #295503  
bitwise
KVRist
- profile
- pm
PostPosted: Tue Jan 22, 2013 2:48 pm reply with quote
pieroni wrote:
so do you think it would be this area causing me the grief? is this where i should be spending most of my time and efforts?


I had to compile your code. I couldn't hear any sound, not even in the Release version. So it doesn't depend on some lag.

I noticed that the output was always zero.

You were not incrementing "fPhase1". And why you were not?

Because of this commented line:

//fPhase1 += baseFreq + (parent->fModIndex * MAX_MOD_INDEX * modulation * parent->fScaler);

Once uncommented, i got a couple of errors:

"fModIndex" and "MAX_MOD_INDEX" not defined.

They are not defined in your example, but they are in the original code that i can find online.

Anyway, i replaced "parent->fModIndex * MAX_MOD_INDEX" with "1" and i could hear sounds in the Debug version.
^ Joined: 18 Mar 2012  Member: #277127  
pieroni
KVRer
- profile
- pm
PostPosted: Sat Jan 26, 2013 2:11 am reply with quote
thankyou so much for checking it over for me, like I said, I'm new to this I'm just trying to learn so all I'm doing at the moment is changing things and seeing what does what.
^ Joined: 01 Dec 2012  Member: #293369  
whyterabbyt
Beware the Quoth
- profile
- pm
PostPosted: Sat Jan 26, 2013 2:19 am reply with quote
pieroni wrote:
thankyou so much for checking it over for me, like I said, I'm new to this I'm just trying to learn so all I'm doing at the moment is changing things and seeing what does what.


my opinion so just a suggestion but if you're changing things to see what it does, and then you get no sound, then revert the change rather than ask for someone to tell you why its making no sound. given that you know you changed stuff, and they dont, its just a touch rude to expect someone to spend time 'fixing' something you randomly broke. especially if you dont tell people until after they did all the work.

as for trying to work out what stuff does, you'd be far better off tracing what's going on than just changing stuff to see what happens. break it down into smaller steps, and keep track of what things are doing (which you cant do by just removing them).
what'll almost invariably happen is that you break something that had a purpose, and if you dont know what it was originally doing, you're not going to discover what if its not there. thats a bit like bashing some component in a car our of shape to see how the car runs with it in a new shape...
----
To laymen, software development is something akin to wizardry. Neither time, nor effort are involved. If software is missing features they want, or has bugs, it is solely because someone has been too lazy to wave their magic wand.
^ Joined: 03 Sep 2001  Member: #1041  
All times are GMT - 8 Hours

Printable version
Page 1 of 1
Display posts from previous:   
ReplyNew TopicPrevious TopicNext Topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Username: Password:  
KVR Developer Challenge 2012