COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 09-04-2009, 02:32 PM   #1
debian
Human being with feelings
 
debian's Avatar
 
Join Date: Nov 2008
Posts: 35
Default instrument exampleproject?

Hi, thanks for a great framework IPlug :-)

Has any one got a simple instrument exampleproject to share?
Regards
__________________
ojoj...
debian is offline   Reply With Quote
Old 09-20-2009, 02:17 PM   #2
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

Here you go, a simple IPlug instrument project:

http://www.taletn.com/temp/IPlugInstrument.zip

It's a monophonic synth that plays non-band-limited square waves (with plenty of aliasing), so it probably isn't of much practical use. But it does show you how to handle basic MIDI messages (note on/off with velocity, CC and channel mode messages).

There's one thing that doesn't work as intended: When I send CC#7 to it, its volume parameter changes. However, this change isn't directly visible in the UI (at least not in REAPER). Should I perhaps let the host know the parameter has changed? This is a GUI-less plug BTW, but that shouldn't really matter, right?
Tale is offline   Reply With Quote
Old 09-21-2009, 12:07 AM   #3
cc_
Human being with feelings
 
Join Date: Mar 2009
Posts: 256
Default

Nice.

Quote:
Originally Posted by Tale View Post
There's one thing that doesn't work as intended: When I send CC#7 to it, its volume parameter changes. However, this change isn't directly visible in the UI (at least not in REAPER). Should I perhaps let the host know the parameter has changed?
You need to call InformHostOfParamChange() after you've updated the parameter.

Also, when the GUI is added, the call to SetNormalized() will need to be changed to SetParameterFromPlug() otherwise the GUI controls will not get updated.
cc_ is offline   Reply With Quote
Old 09-21-2009, 12:57 AM   #4
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

Quote:
Originally Posted by cc_ View Post
You need to call InformHostOfParamChange() after you've updated the parameter.
Thanks! I've just tried that, but it doesn't seem to work. However, another of my VSTi test projects made with only the VST SDK also doesn't update the GUI-less UI in REAPER, so perhaps this is a REAPER bug?

Quote:
Originally Posted by cc_ View Post
Also, when the GUI is added, the call to SetNormalized() will need to be changed to SetParameterFromPlug() otherwise the GUI controls will not get updated.
Like this you mean?

Code:
this->vol = value / 127.;
if (GetGUI())
	GetGUI()->SetParameterFromPlug(kVol, this->vol, true);
else
	GetParam(kVol)->SetNormalized(this->vol);
InformHostOfParamChange(kVol, this->vol);
Tale is offline   Reply With Quote
Old 09-28-2009, 01:14 PM   #5
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

I have updated my instrument example, so it now respects MIDI timing for note on/off messages. I have also replaced my own MIDI message parsing code with IPlug's IMidiMsg struct, and I have included the InformHostOfParamChange() call. The latter now successfully updates the volume parameter on screen in REAPER, but only when the parameter is shown in the track controls. But I do think this is a REAPER issue, not an IPlug issue.

A side note: A couple of CCs are missing from the IMidiMsg struct enum list (in IPlugStructs.h), namely most channel mode messages, so I had to "hard code" these in my example.
Tale is offline   Reply With Quote
Old 09-29-2009, 01:14 AM   #6
debian
Human being with feelings
 
debian's Avatar
 
Join Date: Nov 2008
Posts: 35
Default

Hi Tale,
Thanks a lot! An example is really helpful,
I'm looking forward to test your example.


I have had a few rats as pets
Rats are intelligent and are nice pets.

sorry for off topic.
__________________
ojoj...
debian is offline   Reply With Quote
Old 10-08-2009, 02:51 PM   #7
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

I've once again updated my example project:

* All MIDI messages are now handled with sample timing accuracy, because ProcessMidiMsg() no langer handles them, but rather just adds the messages to a queue. This queue is then processed in ProcessDoubleReplacing().

* I've added the required mutex locks (although without a GUI they are not stricly needed, I think).

Off topic: Yeah, rats make great pets. I have 4 males at the moment, I can hear them nibbling on something behind me. (I do hope it's not my internet cable though...)
Tale is offline   Reply With Quote
Old 11-02-2009, 05:45 AM   #8
Jeffos
Mortal
 
Jeffos's Avatar
 
Join Date: Dec 2008
Location: France
Posts: 1,969
Default

Thanks for sharing Tale!

Quote:
Originally Posted by Tale View Post
The latter now successfully updates the volume parameter on screen in REAPER, but only when the parameter is shown in the track controls. But I do think this is a REAPER issue, not an IPlug issue.
I confirm this issue in "generic UI mode". I also think it's a reaper bug: the fact that the param is present as a track control seems to force the refresh as well as clicking the "UI" button...
[edit] issue reported here: http://forum.cockos.com/project.php?issueid=1438

Last edited by Jeffos; 11-02-2009 at 05:52 AM.
Jeffos is offline   Reply With Quote
Old 02-22-2010, 11:06 AM   #9
Jeffos
Mortal
 
Jeffos's Avatar
 
Join Date: Dec 2008
Location: France
Posts: 1,969
Default

..another thread reminded me this one.

Update:
Even if the issue I reported above ended as "Live with it" (which is ok for me), I managed to make this thing work thanks to Reaper's API (btw, only works with that daw): the trick is to call TrackFX_SetParam() rather than InformHostOfParamChange(). The first reason I did that is not to polluate Reaper with useless undo points, but, as the cherry on the pie, it also makes the generic UI updating.. nice for "light" plugs..
Jeffos is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.