Exemplo n.º 1
0
 public override void ReleaseAudioBuffer(IAudioBuffer audioBuffer)
 {
     var openAlBuffer = audioBuffer as OpenAlAudioBuffer;
     AL.DeleteSource(openAlBuffer.SourceId);
     AL.DeleteBuffer(openAlBuffer.BufferId);
     AllSamples.Remove(audioBuffer);
 }
Exemplo n.º 2
0
        private void PlayingBufferProcessed(object?sender, IAudioBuffer e)
        {
            if (sender is AudioOutput output)
            {
                var read = Array.Empty <byte>();

                if (output == _playing)
                {
                    read = _currentSong.ReadFrame();
                }
                else if (output == _next)
                {
                    read = _nextSong.ReadFrame();
                }

                if (read.Length > 0)
                {
                    e.SetBuffer(read);
                    output.SubmitBuffer(e);
                }
                else
                {
                    e.Dispose();
                }
            }
        }
        public PlayerSoundsComponent(
            IAudio audio,
            Rigidbody rigidbody,
            PlayerStateMachine stateMachine)
        {
            this.source_ = audio.Factory.NewAudioSource(3);

            var sfx = LocalIo.Resources.GetSubpath("sfx/");

            this.bumpWallSound_ = audio.LoadAsBuffer(sfx.GetFile("bump_wall.ogg"));
            this.footstepHeavy_ =
                audio.LoadAsBuffer(sfx.GetFile("footstep_heavy.ogg"));
            this.footstepLight_ =
                audio.LoadAsBuffer(sfx.GetFile("footstep_light.ogg"));
            this.jumpSound_     = audio.LoadAsBuffer(sfx.GetFile("jump.ogg"));
            this.walljumpSound_ = audio.LoadAsBuffer(sfx.GetFile("walljump.ogg"));
            this.fallSound_     = audio.LoadAsBuffer(sfx.GetFile("fall.ogg"));
            this.landSound_     = audio.LoadAsBuffer(sfx.GetFile("land.ogg"));
            this.whipSound_     = audio.LoadAsBuffer(sfx.GetFile("whip.ogg"));

            this.rigidbody_    = rigidbody;
            this.stateMachine_ = stateMachine;

            this.HookIntoStateMachine_(stateMachine);
        }
Exemplo n.º 4
0
        public override void Push(IAudioBuffer <T> sourceBuffer)
        {
            Ensure(sourceBuffer.DataLengthSamples);

            Inherit(sourceBuffer);

            DataLengthSamples = sourceBuffer.DataLengthSamples;

            Array.Copy(sourceBuffer.BufferData, BufferData, DataLengthSamples);
        }
Exemplo n.º 5
0
		public override void Intro ( params object [] args )
		{
			contentManager = new ResourceTable ( FileSystemManager.GetFileSystem ( FileSystemManager.ManifestFileSystem ) );
			contentManager.AddDefaultContentLoader ();
			AudioContentLoader.AddDefaultDecoders ();
			AudioContentLoader.Decoders.Add ( new MpegDecoder () );

			Core.GraphicsDevice.BlendState = true;
			Core.GraphicsDevice.BlendOperation = BlendOperation.AlphaBlend;

			font = contentManager.Load<TrueTypeFont> ( "test.ttf", 40 );
			audio1 = contentManager.Load<IAudioBuffer> ( "test.mp3" );
			audio1.Play ();

			base.Intro ( args );
		}
Exemplo n.º 6
0
        public override void Intro( params object [] args )
        {
            Core.GraphicsDevice.ImmediateContext.BlendState = BlendState.AlphaBlend;

            contentManager = new ResourceTable ( FileSystemManager.GetFileSystem ( "ManifestFileSystem" ) );
            Texture2DContentLoader.AddDefaultDecoders ();
            AudioContentLoader.AddDefaultDecoders ();

            font = contentManager.Load<TrueTypeFont> ( "Resources/test.ttf", 24 );

            audio1 = contentManager.Load<IAudioBuffer> ( "Resources/Audio/audio1.ogg" );
            //audio2 = contentManager.Load<IAudioBuffer> ( "Resources/Audio/audio2.flac" );
            audio3 = contentManager.Load<IAudioBuffer> ( "Resources/Audio/audio3.ogg" );

            Add ( InputHelper.Instance );

            base.Intro ( args );
        }
Exemplo n.º 7
0
        public AudioSource(IAudioBuffer buffer)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }

            Source = AL.GenSource();
            Util.CheckOpenAlErrors();

            IsDisposed = false;

            Buffer = buffer;
            Buffer.Bind(Source);

            Loop = false;
            Position = Vector3.Zero;
            Velocity = Vector3.Zero;
        }
Exemplo n.º 8
0
 public WaveProvider(IAudioBuffer buffer)
 {
     audioBuffer = buffer;
 }
Exemplo n.º 9
0
 public AudioProcessor()
 {
     r      = cpuMemory.RegistersAPU;
     Buffer = new AudioBuffer();
     InitializeChannels();
 }
Exemplo n.º 10
0
 public void Play(IAudioBuffer buffer, bool loop, float pitch) =>
 this.Play_((AudioBufferOpenTk)buffer, loop, pitch);
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SharedAudioBufferCollection"/> class.
 /// </summary>
 /// <param name="parent">The parent audio buffer.</param>
 public SharedAudioBufferCollection(IAudioBuffer parent)
     : base()
 {
     this.Parent = parent;
 }
Exemplo n.º 12
0
 public abstract void ReleaseAudioBuffer(IAudioBuffer audioBuffer);
Exemplo n.º 13
0
 public void Play(IAudioBuffer buffer, bool looping, float pitch)
 => this.sources_.Next.Play(buffer, looping, pitch);
Exemplo n.º 14
0
        private void PlayAtRandomPitch_(IAudioBuffer sound)
        {
            var pitch = (float)(.9f + .2f * FinRandom.Double());

            this.source_.Play(sound, false, pitch);
        }
Exemplo n.º 15
0
 protected void FireBufferProcessed(IAudioBuffer buffer)
 {
     BufferProcessed?.Invoke(this, buffer);
 }
Exemplo n.º 16
0
 public abstract void SubmitBuffer(IAudioBuffer buffer);