Beispiel #1
0
    GameObject InstantiateChorus(ChorusScriptable c, Vector3 position)
    {
        GameObject go = (GameObject)Instantiate(audioSourcePrefab);

        go.name = c.instrumentName;

        CustomAudioSource source = go.GetComponent <CustomAudioSource>();

        source.SetSound(AudioMixer.Instance.Load(c.path));

        go.transform.SetParent(this.transform);
        go.AddComponent <Image>();
        go.GetComponent <Image>().sprite = c.instrumentImage;
        go.transform.localScale          = Vector3.one;
        go.transform.localPosition       = 10 * position;

        orchestraPrefab.AddSource(source);

        VolumeDisplay volume = Instantiate(VolumeDislayer, go.transform);

        volume.transform.localPosition = new Vector3(100, -50, 0);
        volume.Source = go.GetComponent <CustomAudioSource>();

        return(go);
    }
Beispiel #2
0
        async Task AnimationLoop()
        {
            stopwatch.Start();

            while (pageIsActive)
            {
                VolumeDisplay.InvalidateSurface();
                PressureDisplay.InvalidateSurface();
                await Task.Delay(TimeSpan.FromSeconds(1.0 / 15));
            }

            stopwatch.Stop();
        }