public override void ReleaseAudioBuffer(IAudioBuffer audioBuffer) { var openAlBuffer = audioBuffer as OpenAlAudioBuffer; AL.DeleteSource(openAlBuffer.SourceId); AL.DeleteBuffer(openAlBuffer.BufferId); AllSamples.Remove(audioBuffer); }
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); }
public override void Push(IAudioBuffer <T> sourceBuffer) { Ensure(sourceBuffer.DataLengthSamples); Inherit(sourceBuffer); DataLengthSamples = sourceBuffer.DataLengthSamples; Array.Copy(sourceBuffer.BufferData, BufferData, DataLengthSamples); }
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 ); }
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 ); }
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; }
public WaveProvider(IAudioBuffer buffer) { audioBuffer = buffer; }
public AudioProcessor() { r = cpuMemory.RegistersAPU; Buffer = new AudioBuffer(); InitializeChannels(); }
public void Play(IAudioBuffer buffer, bool loop, float pitch) => this.Play_((AudioBufferOpenTk)buffer, loop, pitch);
/// <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; }
public abstract void ReleaseAudioBuffer(IAudioBuffer audioBuffer);
public void Play(IAudioBuffer buffer, bool looping, float pitch) => this.sources_.Next.Play(buffer, looping, pitch);
private void PlayAtRandomPitch_(IAudioBuffer sound) { var pitch = (float)(.9f + .2f * FinRandom.Double()); this.source_.Play(sound, false, pitch); }
protected void FireBufferProcessed(IAudioBuffer buffer) { BufferProcessed?.Invoke(this, buffer); }
public abstract void SubmitBuffer(IAudioBuffer buffer);