// Generate a musician in the scenario and close the recorder
    public void acceptCreation()
    {
        if (!pianoPlaying)
        {
            Sound sound = soundObj.GetComponent <Sound>();
            sound.items       = items;
            sound.name        = name;
            sound.objectIndex = currentObjectIndex;
            sound.timeControl = timeControl;
            sound.isPreset    = false;

            if (i - 1 >= 0 && items[i - 1].z == 1)
            {
                OSCHandler.Instance.SendSoundMessageToClient("SuperCollider", name, -1, items[i - 1].y, currentObjectIndex);
            }

            soundObjManager.addSoundObject(name, soundObj);
        }
    }
Exemplo n.º 2
0
    // Add a synth to the scene
    public void AddSynth(string name)
    {
        // Instantiate instrument in the scenario and add it to SuperCollider
        GameObject soundObj = null;

        switch (name)
        {
        case "/bellPreset":
            if (!usedPresets[0])
            {
                soundObj       = instrumentPrefabs[0];
                usedPresets[0] = true;
                disabledPresetObjs[0].SetActive(true);
            }
            break;

        case "/pianoPreset":
            if (!usedPresets[1])
            {
                soundObj       = instrumentPrefabs[1];
                usedPresets[1] = true;
                disabledPresetObjs[1].SetActive(true);
            }
            break;

        case "/drumPreset":
            if (!usedPresets[2])
            {
                soundObj       = instrumentPrefabs[2];
                usedPresets[2] = true;
                disabledPresetObjs[2].SetActive(true);
            }
            break;

        case "/violinPreset":
            if (!usedPresets[3])
            {
                soundObj       = instrumentPrefabs[3];
                usedPresets[3] = true;
                disabledPresetObjs[3].SetActive(true);
            }
            break;

        case "/guitarPreset":
            if (!usedPresets[4])
            {
                soundObj       = instrumentPrefabs[4];
                usedPresets[4] = true;
                disabledPresetObjs[4].SetActive(true);
            }
            break;

        case "/flutePreset":
            if (!usedPresets[5])
            {
                soundObj       = instrumentPrefabs[5];
                usedPresets[5] = true;
                disabledPresetObjs[5].SetActive(true);
            }
            break;

        default:
            break;
        }

        if (soundObj != null)
        {
            soundObj.GetComponent <Sound>().isPreset = true;
            soundObjManager.addSoundObject(name, soundObj);
        }
    }