mirror of
https://github.com/LazyDuchess/OpenTS2.git
synced 2025-01-22 08:11:47 -05:00
Bring back NAudio - NLayer was kinda buggy.
This commit is contained in:
parent
4798f3e32a
commit
4353a8d968
12 changed files with 22724 additions and 14 deletions
8
Assets/Plugins/NAudio.meta
generated
Normal file
8
Assets/Plugins/NAudio.meta
generated
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 96ddfba2910122b40ae2f14e29c000f2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Plugins/NAudio/NAudio.dll
Normal file
BIN
Assets/Plugins/NAudio/NAudio.dll
Normal file
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3122de101e7041b41aab61be88d538fb
|
||||
guid: 16ab0fc7a19378e4ba4779314304ac31
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
22556
Assets/Plugins/NAudio/NAudio.xml
Normal file
22556
Assets/Plugins/NAudio/NAudio.xml
Normal file
File diff suppressed because it is too large
Load diff
7
Assets/Plugins/NAudio/NAudio.xml.meta
generated
Normal file
7
Assets/Plugins/NAudio/NAudio.xml.meta
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 192b3ed9512299043ac35bc59105e17e
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
31
Assets/Plugins/NAudio/license.txt
Normal file
31
Assets/Plugins/NAudio/license.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
Microsoft Public License (Ms-PL)
|
||||
|
||||
This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
|
||||
|
||||
1. Definitions
|
||||
|
||||
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
|
||||
|
||||
A "contribution" is the original software, or any additions or changes to the software.
|
||||
|
||||
A "contributor" is any person that distributes its contribution under this license.
|
||||
|
||||
"Licensed patents" are a contributor's patent claims that read directly on its contribution.
|
||||
|
||||
2. Grant of Rights
|
||||
|
||||
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
|
||||
|
||||
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
|
||||
|
||||
3. Conditions and Limitations
|
||||
|
||||
(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
|
||||
|
||||
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
|
||||
|
||||
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
|
||||
|
||||
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
|
||||
|
||||
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
|
7
Assets/Plugins/NAudio/license.txt.meta
generated
Normal file
7
Assets/Plugins/NAudio/license.txt.meta
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 85c47de6dc00d9347944c83b7b1aa061
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
92
Assets/Plugins/NAudio/readme.txt
Normal file
92
Assets/Plugins/NAudio/readme.txt
Normal file
|
@ -0,0 +1,92 @@
|
|||
NAudio is an open source .NET audio library written by Mark Heath (mark.heath@gmail.com)
|
||||
For more information, visit http://naudio.codeplex.com
|
||||
NAudio is now being hosted on GitHub http://github.com/naudio/NAudio
|
||||
|
||||
THANKS
|
||||
======
|
||||
The following list includes some of the people who have contributed in various ways to NAudio, such as code contributions,
|
||||
bug fixes, documentation, helping out on the forums and even donations. I haven't finished compiling this list yet, so
|
||||
if your name should be on it but isn't please let me know and I will include it. Also, some people I only know by their forum
|
||||
id, so if you want me to put your full name here, please also get in touch.
|
||||
|
||||
in alphabetical order:
|
||||
Alan Jordan
|
||||
Alexandre Mutel
|
||||
Alexander Binkert
|
||||
AmandaTarafaMas
|
||||
balistof
|
||||
biermeester
|
||||
borman11
|
||||
bradb
|
||||
Brandon Hansen (kg6ypi)
|
||||
csechet
|
||||
ChunkWare Music Software
|
||||
CKing
|
||||
DaMacc
|
||||
Dirk Eckhardt
|
||||
Du10
|
||||
eejake52
|
||||
Florian Rosmann (filoe)
|
||||
Freefall
|
||||
Giawa
|
||||
Harald Petrovitsch
|
||||
Hfuy
|
||||
Iain McCowan
|
||||
Idael Cardaso
|
||||
ioctlLR
|
||||
Ivan Kochurkin (KvanTTT)
|
||||
Jamie Michael Ewins
|
||||
jannera
|
||||
jbaker8935
|
||||
jcameron23
|
||||
JoeGaggler
|
||||
jonahoffmann
|
||||
jontdelorme
|
||||
Jospin Software
|
||||
Justin Frankel
|
||||
K24A3
|
||||
Kamen Lichev
|
||||
Kassoul
|
||||
kevinxxx
|
||||
kzych
|
||||
LionCash
|
||||
Lustild
|
||||
Lucian Wischik (ljw1004)
|
||||
ManuN
|
||||
MeelMarcel
|
||||
Michael Chadwick
|
||||
Michael Feld
|
||||
Michael J
|
||||
Michael Lehenbauer
|
||||
milligan22963
|
||||
myrkle
|
||||
nelsonkidd
|
||||
Nigel Redmon
|
||||
Nikolaos Georgiou
|
||||
Owen Skriloff
|
||||
owoudenb
|
||||
painmailer
|
||||
PPavan
|
||||
Pygmy
|
||||
Ray Molenkamp
|
||||
Roadz
|
||||
Robert Bristow-Johnson
|
||||
Scott Fleischman
|
||||
Simon Clark
|
||||
Sirish Bajpai
|
||||
sporn
|
||||
Steve Underwood
|
||||
Ted Murphy
|
||||
Tiny Simple Tools
|
||||
Tobias Fleming
|
||||
TomBogle
|
||||
Tony Cabello
|
||||
Tony Sistemas
|
||||
TuneBlade
|
||||
topher3683
|
||||
volmart
|
||||
Vladimir Rokovanov
|
||||
Ville Koskinen
|
||||
Wyatt Rice
|
||||
Yuval Naveh
|
||||
Zsb
|
7
Assets/Plugins/NAudio/readme.txt.meta
generated
Normal file
7
Assets/Plugins/NAudio/readme.txt.meta
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dce5cec6770b7814ab66c6b15147547b
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -6,8 +6,10 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using NLayer;
|
||||
using System.IO;
|
||||
using NAudio;
|
||||
using NAudio.Wave;
|
||||
using System.Collections;
|
||||
|
||||
namespace OpenTS2.Content.DBPF
|
||||
{
|
||||
|
@ -20,9 +22,9 @@ namespace OpenTS2.Content.DBPF
|
|||
if (_clip == null)
|
||||
{
|
||||
_clip = AudioClip.Create(GlobalTGI.ToString(),
|
||||
(int)(_mpegFile.Length / sizeof(float) / _mpegFile.Channels),
|
||||
_mpegFile.Channels,
|
||||
_mpegFile.SampleRate,
|
||||
(int)(_mp3Reader.Length / sizeof(float)),
|
||||
_sampleProvider.WaveFormat.Channels,
|
||||
_sampleProvider.WaveFormat.SampleRate,
|
||||
true,
|
||||
OnMp3Read,
|
||||
OnClipPositionSet);
|
||||
|
@ -32,13 +34,14 @@ namespace OpenTS2.Content.DBPF
|
|||
}
|
||||
public byte[] AudioData;
|
||||
private AudioClip _clip;
|
||||
private MpegFile _mpegFile;
|
||||
private MemoryStream _stream;
|
||||
private Mp3FileReader _mp3Reader;
|
||||
private ISampleProvider _sampleProvider;
|
||||
|
||||
public MP3AudioAsset(byte[] data) : base(data)
|
||||
{
|
||||
_stream = new MemoryStream(data);
|
||||
_mpegFile = new MpegFile(_stream);
|
||||
var stream = new MemoryStream(data);
|
||||
_mp3Reader = new Mp3FileReader(stream);
|
||||
_sampleProvider = _mp3Reader.ToSampleProvider();
|
||||
}
|
||||
|
||||
public override void FreeUnmanagedResources()
|
||||
|
@ -48,16 +51,15 @@ namespace OpenTS2.Content.DBPF
|
|||
_clip.Free();
|
||||
}
|
||||
|
||||
// PCMReaderCallback will called each time AudioClip reads data.
|
||||
private void OnMp3Read(float[] data)
|
||||
{
|
||||
int actualReadCount = _mpegFile.ReadSamples(data, 0, data.Length);
|
||||
_sampleProvider.Read(data, 0, data.Length);
|
||||
}
|
||||
|
||||
// PCMSetPositionCallback will called when first loading this audioclip
|
||||
private void OnClipPositionSet(int position)
|
||||
{
|
||||
_mpegFile = new MpegFile(_stream);
|
||||
// Hallo :3
|
||||
//_mp3Reader = new Mp3FileReader(_stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ Currently a basic main menu with a neighborhood chooser is implemented. Neighbor
|
|||
* [MoonSharp](https://github.com/moonsharp-devs/moonsharp/)
|
||||
* [FreeSO](https://github.com/RHY3756547/FreeSO)
|
||||
* [DBPFSharp](https://github.com/0xC0000054/DBPFSharp/blob/main/src/DBPFSharp)
|
||||
* [NLayer](https://github.com/naudio/NLayer)
|
||||
* [NAudio](https://github.com/naudio/NAudio)
|
||||
* [NSpeex](https://github.com/aijingsun6/NSpeex)
|
||||
|
||||
## Similar Projects
|
||||
|
|
Loading…
Reference in a new issue