Esempio n. 1
0
        protected override void OnCreate()
        {
            this._graph = this.World.GetOrCreateSystem <AudioSystem>()
                          .Graph;

            using (var block = this._graph.CreateCommandBlock())
            {
                this._current  = this.CreateNode(block);
                this._previous = this.CreateNode(block);
            }
        }
Esempio n. 2
0
        public void ChangeMusicTrack(AudioSampleSet sample)
        {
            var random = sample.RandomSample();

            if (!random.HasValue)
            {
                return;
            }

            // swap the current and previous
            var current = this._previous;

            this._previous = this._current;
            this._current  = current;

            using (var block = this._graph.CreateCommandBlock())
            {
                block.TriggerAudioSample(
                    this._current.node,
                    random.Value.ToReader(true),
                    Categories.Music
                    );

                block.SetAttenuation(
                    this._current.connection,
                    1f,
                    AudioSettings.outputSampleRate * 15
                    );

                block.SetAttenuation(
                    this._previous.connection,
                    0f,
                    AudioSettings.outputSampleRate * 4
                    );
            }
        }
Esempio n. 3
0
 private void RemoveState(Entity entity, ref AudioClipPlayerSystemState state)
 {
     this.PostUpdateCommands.RemoveComponent <AudioClipPlayerSystemState>(entity);
     this._graph.TerminateAudioSampleNode(state.node);
 }
Esempio n. 4
0
 private void UpdateState(Entity entity, ref AudioClipPlayerSystemState state)
 {
 }