Page 1 of 1
Posted: 21 Sep 2017, 13:03
by sephult
Hello All!
So finally decided to dive in the SDK.
I am just looking now with some examples and trial and error...but mostly error.
I took the MIDI Transpose demonstration and was looking at how to start adding nodes/parameters.
I copied the following from case 2 of the
Code: Select all
void MidiTransposeExampleExample::onGetParamInfo (int ParamIndex, TParamInfo* pParamInfo)
Code: Select all
case 3:
pParamInfo->ParamType = ptDataFader;
pParamInfo->Caption = "velo";
pParamInfo->IsInput = TRUE;
pParamInfo->IsOutput = FALSE;
pParamInfo->MinValue = 0.0f;
pParamInfo->MaxValue = 127.0f;
pParamInfo->DefaultValue = 85.0f;
pParamInfo->Symbol = "v";
pParamInfo->Format = "%.0f";
pParamInfo->IsStoredInPreset = TRUE;
pParamInfo->CallBackType = ctImmediate;
pParamInfo->EventPtr = &fdrVelo;
break;
My assumption is I am declaring this node here. At first I rebuilt the solution and the node did not show up in my module.
I also went further to read in the value maybe thinking since I did not access it, for some reason it was not created. so OnProcess I put the following:
Code: Select all
int velo = (int)sdkGetEvtData(fdrVelo);
Doing a quick reference to how the &fdrPitch is being done, I could not find much difference in how I added the &fdrVelo.
Am I doing something wrong, or missing something?
Like I said I literally just jumped back in on the SDK, it's been many years (since the first HH SDKs, that I even messed around with).
-s
Posted: 21 Sep 2017, 13:13
by sephult
I was not finding the # of parameters....but I just found it finally!
Funny how you write a message for some help, and then solve it.
Well regardless here is some beginner information for adding your first parameter to a module:
Here you will define the number of node parameters:
Code: Select all
void MidiTransposeExampleExample::onGetModuleInfo (MasterInfo* pMasterInfo, ModuleInfo* pModuleInfo)
When you add the additional Switch Case(s), you can then just modify the onGetParamInfo
Code: Select all
void MidiTransposeExampleExample::onGetParamInfo (int ParamIndex, TParamInfo* pParamInfo)
by adding your new Switch Case Declaration:
Code: Select all
case 3:
pParamInfo->ParamType = ptDataFader;
pParamInfo->Caption = "velo";
pParamInfo->IsInput = TRUE;
pParamInfo->IsOutput = FALSE;
pParamInfo->MinValue = 0.0f;
pParamInfo->MaxValue = 127.0f;
pParamInfo->DefaultValue = 85.0f;
pParamInfo->Symbol = "v";
pParamInfo->Format = "%.0f";
pParamInfo->IsStoredInPreset = TRUE;
pParamInfo->CallBackType = ctImmediate;
pParamInfo->EventPtr = &fdrVelo;
break;
-s
Posted: 21 Sep 2017, 14:23
by 23fx23
niice

welcome to the big rabbit hole

Posted: 21 Sep 2017, 14:30
by nay-seven
Great sephult ! if you have fun with it and a bit of time, could be a great idea to note all your progressions this way to create a "my first module with Usine SDK" manual ?
you have the best place for this job ? what do you think ?
Posted: 21 Sep 2017, 16:12
by sephult
I completely agree Nay, I will expand the SDK tutorials and help make it easier for others hopefully to follow. I feel like I'm cheating on my scripts though....hahaha
Posted: 21 Sep 2017, 16:33
by nay-seven
Cool !
Posted: 22 Sep 2017, 12:56
by oli_lab
Welcome To the spleeness nights.
Posted: 22 Sep 2017, 12:57
by sephult
ugg, I'm already at it guys....already at it....haha
Posted: 23 Sep 2017, 01:18
by sephult
Hello!!!!
Question #2
MIDI Array Sizing:
I'm slicing and dicing and found that this was a slightly different method.
I am wondering....is the MIDI Out Size handled as a part of the SDK functions now?
I do see where the stream is clamped off like normal before the input size detection.
Interesting though, if this is the case....is there any way to get rid of the clamp as well?
I assume no that we still have the issue where they cannot co-exist....is this right?
Code: Select all
1. Read Input Size
2. Loop Looking for Size to be Greater than 0. (MIDI Message has Arrived!)
3. Enter Processing Loop and copy the MIDI Input to the MIDI Output
4. Read the Value of the Fader
5. Enter “For" Loop. Process on each of the MIDI Messages Received.
6. Get the MIDI Message copied to the MIDI Output earlier and use to modify ‘code’
7. Only make changes to MIDI Messages that are Note ON/OFF Messages
8. MIDI Messages contain Data1 and Data2, Data2 in this case is velocity.
9. Change the velocity equal to the fader value that was placed in ‘velo’
10. Set the MIDI Output with the ‘code’ that was just modified.
// Process
void MidiTransposeExampleExample::onProcess ()
{
int sizeMidiIn = sdkGetEvtSize (midiIn); //===============Get size of MIDI place in sizeMidiIn
sdkSetEvtSize (midiOut, 0); //=============================Set MIDI Out stream to Off
if (sizeMidiIn > 0) //=====================================Only do if sizeMidiIn is active
{
sdkCopyEvt (midiIn, midiOut); //=====Copy MIDI Input to the MIDI Output
int velo = (int)sdkGetEvtData(fdrVelo); //=======Read fader and place in ‘velo’
for (int i = 0; i < sizeMidiIn; i++)//==============Do this while the count is less
{ //=========than ‘i’. (i.e. Do for all incoming MIDI)
UsineMidiCode code = sdkGetEvtArrayMidi (midiOut, i); //======Get MIDI, put in code
if (code.Msg == MIDI_NOTEON || code.Msg == MIDI_NOTEOFF) //====Only for Note ON/OFF
{
code.Data2 = velo; //=======set the Data2(velocity) code equal to the fader value
sdkSetEvtArrayMidi (midiOut, i, code); //====== (Send MIDI!)
}
}
}
}
-s