public void Dispose() { if (source != null) source.Dispose(); source = null; musicStream = null; }
protected override void DisposeData() { base.DisposeData(); openAL.DeleteBuffers(buffers); openAL.DeleteChannel(channelHandle); musicStream = null; }
private void TryLoadData(Stream fileData) { MemoryStream stream = new MemoryStream(); fileData.CopyTo(stream); stream.Seek(0, SeekOrigin.Begin); musicStream = new MusicStreamFactory().Load(stream); format = musicStream.Channels == 2 ? AudioFormat.Stereo16 : AudioFormat.Mono16; }
public void Dispose() { if (source != null) { source.Dispose(); } source = null; musicStream = null; }
private bool TryFillFromStream(BaseMusicStream stream) { int size = stream.Read(byteBuffer, BufferSize); if (size <= 0) return false; XAudioBuffer.AudioDataPointer = GetBufferHandle(); XAudioBuffer.AudioBytes = size; int blockAlign = stream.Channels * 2; XAudioBuffer.PlayLength = size / blockAlign; return true; }
protected override void DisposeData() { if (musicStream == null) { return; } base.DisposeData(); musicStream = null; if (source != null) { DisposeSource(); } }
public bool FillFromStream(BaseMusicStream stream) { if (stream == null) return false; try { return TryFillFromStream(stream); } catch (Exception) { return false; } }
public bool FillFromStream(BaseMusicStream stream) { if (stream == null) { return(false); } try { return(TryFillFromStream(stream)); } catch (Exception) { return(false); } }
private bool TryFillFromStream(BaseMusicStream stream) { int size = stream.Read(byteBuffer, BufferSize); if (size <= 0) { return(false); } XAudioBuffer.AudioDataPointer = GetBufferHandle(); XAudioBuffer.AudioBytes = size; int blockAlign = stream.Channels * 2; XAudioBuffer.PlayLength = size / blockAlign; return(true); }
private bool TryFillFromStream(BaseMusicStream stream) { int size = stream.Read(byteBuffer, BufferSize); if (size <= 0) { return(false); } bufferStream.Position = 0; bufferStream.Write(byteBuffer, 0, size); bufferStream.Position = 0; XAudioBuffer.AudioData = bufferStream; XAudioBuffer.AudioBytes = size; int blockAlign = stream.Channels * 2; XAudioBuffer.PlayLength = size / blockAlign; return(true); }
protected override void LoadData(Stream fileData) { try { var stream = new MemoryStream(); fileData.CopyTo(stream); stream.Seek(0, SeekOrigin.Begin); musicStream = new MusicStreamFactory().Load(stream); format = musicStream.Channels == 2 ? AudioFormat.Stereo16 : AudioFormat.Mono16; } catch (Exception ex) { Logger.Error(ex); if (Debugger.IsAttached) throw new CouldNotLoadMusicFromFilestream(Name, ex); } }
protected override void DisposeData() { if (musicStream == null) return; base.DisposeData(); musicStream = null; if (source != null) DisposeSource(); }