10-21-2019, 03:45 AM | #1 |
Human being with feelings
Join Date: Oct 2019
Posts: 3
|
VST3 Program Change: 0 never transmitted (FIXED)
Hi,
When trying to implement the Program Change support on my vst3 plugin, I find the following issue: * MSB message value between 0 and 127 are transmitted by the DAW * Program Change value 0 is never transmitted by the DAW * Program Change value between 1 and 127 are transmitted by the DAW It seems to me that Program Change should be able to send 128 values [0, 127] or [1, 128] Do you have any information ? |
10-21-2019, 03:52 AM | #2 |
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 24,859
|
Yeah, should be 0-127.
__________________
Edit poly aftertouch in MIDI editor! Entirely (un)dockable UI! | Improve Render Queue! |
10-21-2019, 03:59 AM | #3 |
Administrator
Join Date: Mar 2007
Location: NY
Posts: 16,501
|
Here is the code on our side:
Code:
int paramid=VST3_GetProgChgParamForUnit(m_vst3->m_controller, unitid); if (paramid >= 0) { int progidx=mevt->midiData[1]; int progcnt=0; int ui, un=uinfo->getUnitCount(); for (ui=0; ui < un; ++ui) { UnitInfo tuinfo={0}; uinfo->getUnitInfo(ui, tuinfo); if (tuinfo.id == unitid) { int li, ln=uinfo->getProgramListCount(); for (li=0; li < ln; ++li) { ProgramListInfo pinfo={0}; uinfo->getProgramListInfo(li, pinfo); if (pinfo.id == tuinfo.programListId) { progcnt=pinfo.programCount; break; } } break; } } double val=m_vst3->m_controller->plainParamToNormalized(paramid, progidx); if (val != (double)progidx && val >= 0.0 && val <= 1.0) { // plainParamToNormalized seemed to do something, accept } else if (progcnt > 0 && progidx >= 0 && progidx < progcnt) { val=(double)progidx/(double)progcnt; } else { val=-1.0; } if (val >= 0.0) { int paramidx=m_vst3->GetParamIdx(paramid); VST3_SetParameter(effect, paramidx, val, 0); } } |
10-29-2019, 08:55 AM | #4 |
Human being with feelings
Join Date: Oct 2019
Posts: 3
|
Here is what I suspect to happened when I receive a Program Change with value 0
int progidx=mevt->midiData[1] => 0 plainParamToNormalized -> [0, 1] => 0 so the check (val != (double)progidx) fail. Then, the progCnt is 0 on my side, and I go to the error case. There is 2 issues: - I should change progCnt on my side to ensure the progCnt is not null. - I should not pass in 2 differents cases when value is 0 and value is !=0, I think you should change the first check |
10-29-2019, 03:58 PM | #5 |
Human being with feelings
Join Date: Aug 2007
Location: Near Cambridge UK and Near Questembert, France
Posts: 22,756
|
As rule of thumb, some manufacturers use 0 to 127, some use 1 to 128.
This can often lead to fun situations like the one you appear to be in right now. Fortunately, Schwa has your back.
__________________
Ici on parles Franglais |
10-29-2019, 04:27 PM | #6 |
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 24,859
|
Actually AFAIK they all use 0-127 internally, but sometimes they display the values as 1-128 (since humans start counting from 1, heh).
__________________
Edit poly aftertouch in MIDI editor! Entirely (un)dockable UI! | Improve Render Queue! |
10-29-2019, 04:52 PM | #7 |
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 16,278
|
Finally I know what is wrong. I am not human
-Michael |
11-22-2019, 03:20 AM | #8 |
Human being with feelings
Join Date: Oct 2019
Posts: 3
|
|
Thread Tools | |
Display Modes | |
|
|