public void Dispose()
		{
			if (source != null)
				source.Dispose();
			source = null;
			musicStream = null;
		}
예제 #2
0
 protected override void DisposeData()
 {
     base.DisposeData();
     openAL.DeleteBuffers(buffers);
     openAL.DeleteChannel(channelHandle);
     musicStream = null;
 }
예제 #3
0
 protected override void DisposeData()
 {
     base.DisposeData();
     openAL.DeleteBuffers(buffers);
     openAL.DeleteChannel(channelHandle);
     musicStream = null;
 }
예제 #4
0
		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;
		}
예제 #5
0
        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;
        }
예제 #6
0
 public void Dispose()
 {
     if (source != null)
     {
         source.Dispose();
     }
     source      = null;
     musicStream = null;
 }
예제 #7
0
		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;
		}
예제 #8
0
 protected override void DisposeData()
 {
     if (musicStream == null)
     {
         return;
     }
     base.DisposeData();
     musicStream = null;
     if (source != null)
     {
         DisposeSource();
     }
 }
예제 #9
0
		public bool FillFromStream(BaseMusicStream stream)
		{
			if (stream == null)
				return false;
			try
			{
				return TryFillFromStream(stream);
			}
			catch (Exception)
			{
				return false;
			}
		}
예제 #10
0
 public bool FillFromStream(BaseMusicStream stream)
 {
     if (stream == null)
     {
         return(false);
     }
     try
     {
         return(TryFillFromStream(stream));
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #11
0
        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);
        }
예제 #12
0
        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);
        }
예제 #13
0
 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);
     }
 }
예제 #14
0
		protected override void DisposeData()
		{
			if (musicStream == null)
				return;
			base.DisposeData();
			musicStream = null;
			if (source != null)
				DisposeSource();
		}