コード例 #1
0
    // lengthDest: set the array size in the patch
    // we consider it mandatory by convention
    // we do not rely on the [arraysize] object as it is not part of Pd core
    public void LoadClip(string name, AudioClip clip, string lengthDest)
    {
        var data = new float[clip.samples * 2];

        clip.GetData(data, 0);
        // Set PD array size
        Debug.Log("Pd send float: " + LibPD.LibPD_SendFloat(pdIndex, lengthDest, data.Length));
        // Fill it with sample data
        Debug.Log("Pd write array: " + LibPD.LibPD_WriteArray(pdIndex, name, data, data.Length));
    }