From 5eb08fec11ba55ce726f800c6626be1564992665 Mon Sep 17 00:00:00 2001 From: Nahuel Rocchetti Date: Sat, 6 Jul 2024 01:05:27 -0300 Subject: [PATCH] Fix mp3 audio not restarting playback --- Assets/Scripts/OpenTS2/Content/DBPF/MP3AudioAsset.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/OpenTS2/Content/DBPF/MP3AudioAsset.cs b/Assets/Scripts/OpenTS2/Content/DBPF/MP3AudioAsset.cs index aae9de9..f5c317c 100644 --- a/Assets/Scripts/OpenTS2/Content/DBPF/MP3AudioAsset.cs +++ b/Assets/Scripts/OpenTS2/Content/DBPF/MP3AudioAsset.cs @@ -36,10 +36,11 @@ namespace OpenTS2.Content.DBPF private AudioClip _clip; private Mp3FileReader _mp3Reader; private ISampleProvider _sampleProvider; + private MemoryStream _stream; public MP3AudioAsset(byte[] data) : base(data) { - var stream = new MemoryStream(data); + _stream = new MemoryStream(data); _mp3Reader = new Mp3FileReader(stream); _sampleProvider = _mp3Reader.ToSampleProvider(); } @@ -58,8 +59,7 @@ namespace OpenTS2.Content.DBPF private void OnClipPositionSet(int position) { - // Hallo :3 - //_mp3Reader = new Mp3FileReader(_stream); + _mp3Reader = new Mp3FileReader(_stream); } } }