You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys I need to set a parameter from an audio plugin set to 1 from 0 so that it sends a bang and sets some values depending on another objects current value. Here's the screenshot. The desired parameters are on the top right
This is the script that controlls the Lowest and Highest parameters that when set to 1 will store the lowest fzero value when u sing a low note and hit L and when you press H it will store another fzero value. But I don't see it logging that it is setting anything. What is going wrong?
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class KeyParameterPress : MonoBehaviour
{
// Helper and plugin handle for Fzero1234New plugin
Fzero1234NewHelper fzeroHelper;
Fzero1234NewHandle fzeroPlugin;
// Constant representing the instance index of the plugin
const int instanceIndex = 1;
// Parameter indices for Lowest and Highest
readonly System.Int32 lowestParamIndex = (int)Fzero1234NewHandle.GetParamIndexById("Lowest");
readonly System.Int32 highestParamIndex = (int)Fzero1234NewHandle.GetParamIndexById("Highest");
void Start()
{
// Find the plugin instance using the helper
fzeroHelper = Fzero1234NewHelper.FindById(instanceIndex);
fzeroPlugin = fzeroHelper.Plugin;
if (fzeroPlugin == null)
{
Debug.LogError("Failed to retrieve plugin handle.");
}
else
{
Debug.Log("Successfully retrieved plugin handle.");
}
}
void Update()
{
if (fzeroPlugin == null) return; // Ensure the plugin is available
// Check if "L" key is pressed
if (Input.GetKeyDown(KeyCode.L))
{
// Set the "Lowest" parameter to 1
fzeroPlugin.SetParamValue(lowestParamIndex, 1f);
Debug.Log("Attempted to set 'Lowest' parameter to 1.");
// Check if the parameter was actually set
double lowestValue;
fzeroPlugin.GetParamValue(lowestParamIndex, out lowestValue);
Debug.Log("Current 'Lowest' parameter value: " + lowestValue);
}
// Check if "H" key is pressed
if (Input.GetKeyDown(KeyCode.H))
{
// Set the "Highest" parameter to 1
fzeroPlugin.SetParamValue(highestParamIndex, 1f);
Debug.Log("Attempted to set 'Highest' parameter to 1.");
// Check if the parameter was actually set
double highestValue;
fzeroPlugin.GetParamValue(highestParamIndex, out highestValue);
Debug.Log("Current 'Highest' parameter value: " + highestValue);
}
// Optional: Reset parameters when keys are released
if (Input.GetKeyUp(KeyCode.L))
{
fzeroPlugin.SetParamValue(lowestParamIndex, 0f);
Debug.Log("Reset 'Lowest' parameter to 0.");
}
if (Input.GetKeyUp(KeyCode.H))
{
fzeroPlugin.SetParamValue(highestParamIndex, 0f);
Debug.Log("Reset 'Highest' parameter to 0.");
}
}
}
`
The text was updated successfully, but these errors were encountered:
Hi Jim -- yes... you'd need to have a message inport that leads to your button in order to address that message inport from your script. So for example, instead of param Lowest @min 0 @max 1, you'd have something like an inport lowestTrigger in your patch, which you could connect up in C# like:
Hey guys I need to set a parameter from an audio plugin set to 1 from 0 so that it sends a bang and sets some values depending on another objects current value. Here's the screenshot. The desired parameters are on the top right
This is the script that controlls the Lowest and Highest parameters that when set to 1 will store the lowest fzero value when u sing a low note and hit L and when you press H it will store another fzero value. But I don't see it logging that it is setting anything. What is going wrong?
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class KeyParameterPress : MonoBehaviour
{
// Helper and plugin handle for Fzero1234New plugin
Fzero1234NewHelper fzeroHelper;
Fzero1234NewHandle fzeroPlugin;
}
`
The text was updated successfully, but these errors were encountered: