Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
MP3AudioTrack.cs
Go to the documentation of this file.
1using System.IO;
2using Microsoft.Xna.Framework.Audio;
3using XPT.Core.Audio.MP3Sharp;
4
5namespace Terraria.Audio;
6
8{
9 private Stream _stream;
10
11 private MP3Stream _mp3Stream;
12
13 public MP3AudioTrack(Stream stream)
14 {
15 //IL_000e: Unknown result type (might be due to invalid IL or missing references)
16 //IL_0014: Expected O, but got Unknown
17 _stream = stream;
18 MP3Stream val = new MP3Stream(stream);
19 int frequency = val.Frequency;
20 _mp3Stream = val;
21 CreateSoundEffect(frequency, AudioChannels.Stereo);
22 }
23
24 public override void Reuse()
25 {
26 ((Stream)(object)_mp3Stream).Position = 0L;
27 }
28
29 public override void Dispose()
30 {
31 _soundEffectInstance.Dispose();
32 ((Stream)(object)_mp3Stream).Dispose();
34 }
35
36 protected override void ReadAheadPutAChunkIntoTheBuffer()
37 {
38 byte[] bufferToSubmit = _bufferToSubmit;
39 if (((Stream)(object)_mp3Stream).Read(bufferToSubmit, 0, bufferToSubmit.Length) < 1)
40 {
41 Stop(AudioStopOptions.Immediate);
42 }
43 else
44 {
46 }
47 }
48}
void Dispose()
Definition Stream.cs:639
void CreateSoundEffect(int sampleRate, AudioChannels channels)
override void ReadAheadPutAChunkIntoTheBuffer()