Beispiel #1
0
    private void PlayBlock(int blockId, BEAT_TIMING timing, Action callbackAtSoundBeginning = null)
    {
        SequencerOneshot shot = GetFreeSequencer();

        if (!shot)
        {
            Debug.LogError("no free sequencer");
            return;
        }

        activeSequencer = shot;

        actualBlock = scenarioManager.GetSoundBlock(blockId);
        AudioClip clip = resourcesManager.GetResource(actualBlock.clipId).Clip;

        if (!clip)
        {
            Debug.LogError("no clip for " + actualBlock.clipId);
            return;
        }

        shot.sequence[(int)timing] = true;
        shot.SetAudioClip(clip);
        shot.SetLoop(actualBlock.isLooping);
        shot.OnAnyStep += () => { Debug.Log("onanystep"); };
        shot.OnBeat    += () => { Debug.Log("onbeat"); };

        if (callbackAtSoundBeginning != null)
        {
            //shot.SetSoundBeginCallback(action);
        }

        if (actualBlock.nextBlock != null)
        {
            //shot.SetNextSoundCallback(NextSoundblock, BEAT_TIMING.ON_2);
        }
    }
Beispiel #2
0
 public void SetCallback(Action <Action> _callback, BEAT_TIMING beatTiming)
 {
     callback       = _callback;
     callbackTiming = beatTiming;
 }