Exemplo n.º 1
0
    public object clipPlaying(ZstMethod methodData)
    {
        Dictionary <string, object> output = JsonConvert.DeserializeObject <Dictionary <string, object> >(methodData.output.ToString());
        int            trackIndex          = Convert.ToInt32(output["trackindex"]);
        int            slotIndex           = Convert.ToInt32(output["slotindex"]);
        InstrumentClip playingClip         = InstrumentController.Instance.GetInstrumentByTrackindex(trackIndex).playingClip;

        if (slotIndex < 0)
        {
            //Stopping
            if (playingClip != null)
            {
                playingClip.SetClipState(InstrumentClip.ClipState.IS_DISABLED);
            }
        }
        else
        {
            if (playingClip != null)
            {
                playingClip.SetClipState(InstrumentClip.ClipState.IS_DISABLED);
            }

            InstrumentClip clip = InstrumentController.Instance.FindClip(trackIndex, slotIndex);
            clip.SetClipState(InstrumentClip.ClipState.IS_PLAYING);
        }

        return(null);
    }
Exemplo n.º 2
0
        /*
         * Button
         * Pressable clip button
         */
        public static ClipButtonAttachment CreateClipButton(InstrumentClip clip, UIFrame.AnchorLocation anchor)
        {
            GameObject button = Instantiate(Instance.clipButtonPrefab) as GameObject;

            ClipButtonAttachment attach = button.GetComponent <ClipButtonAttachment>();

            attach.Init(clip);

            UIFrame frame = button.GetComponent <UIFrame>();

            frame.SetAnchor(anchor);

            return(attach);
        }
Exemplo n.º 3
0
    public object clipFired(ZstMethod methodData)
    {
        Dictionary <string, object> output = JsonConvert.DeserializeObject <Dictionary <string, object> >(methodData.output.ToString());
        int trackIndex = Convert.ToInt32(output["trackindex"]);
        int slotIndex  = Convert.ToInt32(output["slotindex"]);

        if (slotIndex >= 0)
        {
            InstrumentClip clip = InstrumentController.Instance.FindClip(trackIndex, slotIndex);
            clip.SetClipState(InstrumentClip.ClipState.IS_QUEUED);
        }

        return(null);
    }
Exemplo n.º 4
0
        public static ClipCubeAttachment CreateClipCube(InstrumentClip clip, bool autoResize)
        {
            GameObject cube = Instantiate(Instance.clipCubePrefab) as GameObject;

            ClipCubeAttachment attach = cube.GetComponent <ClipCubeAttachment>();

            attach.frame.SetMatchTextWidth(autoResize);

            if (clip != null)
            {
                attach.Init(clip);
            }

            return(attach);
        }
Exemplo n.º 5
0
 /*
  * ClipCube
  * Draggable clip cube
  */
 public static ClipCubeAttachment CreateClipCube(InstrumentClip clip)
 {
     return(CreateClipCube(clip, false));
 }
Exemplo n.º 6
0
    private IEnumerator ActivateDurationInstrumentClipCR(InstrumentClip clip)
    {
        //if (isPlaying)
        //    yield break;

        AudioSourceContainer container = PlayClip(clip);

        float dt = 0;

        while (dt < clip.MinDuration)
        {
            dt += Time.deltaTime;
            yield return null;
        }

        //Debug.Log("New Clip Possible");
        isPlaying = false;
    }
Exemplo n.º 7
0
 private void ActivateDurationInstrumentClip(InstrumentClip clip)
 {
     StartCoroutine(ActivateDurationInstrumentClipCR(clip));
 }
Exemplo n.º 8
0
    private AudioSourceContainer PlayClip(InstrumentClip clip)
    {
        // Find & PlayClip
        AudioSample sample = AudioManager.FindSampleFromCurrentLibrary(clip.SampleName);

        // Seperate the play from the clip
        AudioSourceContainer container = AudioManager.Play(sample);

        //Debug.Log("Play " + sample.Name);

        lastInstrumentClip = clip;
        LastSampleName = clip.SampleName;
        isPlaying = true;

        container.VolumeModifier = clip.Volume;
        //cont

        return container;
    }
Exemplo n.º 9
0
    private void ActivateSingleOverride(InstrumentClip clip)
    {
        // Find & StopClip
        if (lastInstrumentClip != null)
        {
            AudioSample sample = AudioManager.FindSampleFromCurrentLibrary(lastInstrumentClip.SampleName);
            AudioManager.Stop(sample);
        }

        AudioSourceContainer container = PlayClip(clip);
        isPlaying = false;
    }
Exemplo n.º 10
0
    private IEnumerator ActivateDurationSoundClipCR(InstrumentClip clip)
    {
        //if (isPlaying)
        //    yield break;

        AudioSourceContainer container = PlayClip(clip);

        while (container.AudioSource.isPlaying)
            yield return null;

        //Debug.Log("Not Playing");
        isPlaying = false;
    }