Skip to content

Commit

Permalink
Update BASS and use new flag to fix MOGGs with <= 8 channels (YARC-Of…
Browse files Browse the repository at this point in the history
…ficial#473)

* Add BASS libraries to repo (with new update to fix moggs)

* Update Windows 32 BASS to special update and update all BASSOPUS libraries to 2.4.2.3

* Use new flag for the speaker assignment fix

* Remove python library install script and update README
  • Loading branch information
RileyTheFox authored Jun 19, 2023
1 parent bc3ff34 commit 528ffba
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 126 deletions.
8 changes: 0 additions & 8 deletions Assets/Plugins/BassNative/.gitignore

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Assets/Plugins/BassNative/Mac/libbass.dylib
Binary file not shown.
Binary file added Assets/Plugins/BassNative/Mac/libbass_fx.dylib
Binary file not shown.
Binary file added Assets/Plugins/BassNative/Mac/libbassmix.dylib
Binary file not shown.
Binary file added Assets/Plugins/BassNative/Mac/libbassopus.dylib
Binary file not shown.
Binary file added Assets/Plugins/BassNative/Windows/x86/bass.dll
Binary file not shown.
Binary file not shown.
Binary file added Assets/Plugins/BassNative/Windows/x86/bassmix.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 10 additions & 1 deletion Assets/Script/Audio/Bass/BassAudioManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,16 @@ public void LoadMogg(ExtractedConSongEntry exConSong, float speed, params SongSt
moggArray = moggArray[BitConverter.ToInt32(moggArray, 4)..];

// Initialize stream
int moggStreamHandle = Bass.CreateStream(moggArray, 0, moggArray.Length, BassFlags.Prescan | BassFlags.Decode | BassFlags.AsyncFile);

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
// Last flag is new BASS_STREAM_NOREORDER flag, which is not in the BassFlags enum,
// as it was made as part of an update to fix <= 8 channel oggs.
const BassFlags flags = BassFlags.Prescan | BassFlags.Decode | BassFlags.AsyncFile | (BassFlags)805306368;
#else
// Currently don't have the new BASS update which has the mogg fix.
const BassFlags flags = BassFlags.Prescan | BassFlags.Decode | BassFlags.AsyncFile;
#endif
int moggStreamHandle = Bass.CreateStream(moggArray, 0, moggArray.Length, flags);
if (moggStreamHandle == 0) {
Debug.LogError($"Failed to load mogg file or position: {Bass.LastError}");
return;
Expand Down
15 changes: 11 additions & 4 deletions Assets/Script/Audio/Bass/BassStemChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,14 @@ public int Load(float speed) {
// Channel was not set up correctly for some reason
return -1;
}
_sourceHandle = Bass.CreateStream(_path, 0, 0, BassFlags.Prescan | BassFlags.Decode | BassFlags.AsyncFile);

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
const BassFlags flags = BassFlags.Prescan | BassFlags.Decode | BassFlags.AsyncFile | (BassFlags)805306368;
#else
// Currently don't have the new BASS update which has the mogg fix.
const BassFlags flags = BassFlags.Prescan | BassFlags.Decode | BassFlags.AsyncFile;
#endif
_sourceHandle = Bass.CreateStream(_path, 0, 0, flags);
if (_sourceHandle == 0) {
return (int) Bass.LastError;
}
Expand All @@ -105,10 +112,10 @@ public int Load(float speed) {
int main = BassMix.CreateSplitStream(_sourceHandle, BassFlags.Decode | BassFlags.SplitPosition, null);
int reverbSplit = BassMix.CreateSplitStream(_sourceHandle, BassFlags.Decode | BassFlags.SplitPosition, null);

const BassFlags flags = BassFlags.SampleOverrideLowestVolume | BassFlags.Decode | BassFlags.FxFreeSource;
const BassFlags tempoFlags = BassFlags.SampleOverrideLowestVolume | BassFlags.Decode | BassFlags.FxFreeSource;

StreamHandle = BassFx.TempoCreate(main, flags);
ReverbStreamHandle = BassFx.TempoCreate(reverbSplit, flags);
StreamHandle = BassFx.TempoCreate(main, tempoFlags);
ReverbStreamHandle = BassFx.TempoCreate(reverbSplit, tempoFlags);

// Apply a compressor to balance stem volume
Bass.ChannelSetFX(StreamHandle, EffectType.Compressor, 1);
Expand Down
91 changes: 0 additions & 91 deletions InstallLibraries/install.py

This file was deleted.

43 changes: 21 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,22 @@ We **DO NOT** encourage, advocate, or promote **PIRATING** of songs, or of anyth

# 📃 Table of Contents

- [Downloading and Playing](#-downloading-and-playing)
- [👉 Disclaimer](#-disclaimer)
- [📃 Table of Contents](#-table-of-contents)
- [📥 Downloading and Playing](#-downloading-and-playing)
- [Windows](#windows)
- [Mac](#mac)
- [Linux](#linux)
- [In-Game Setup](#in-game-setup)
- [Building](#-building)
- [🔨 Building](#-building)
- [⚠️ If you wish to contribute, use the `dev` branch. Your PR will NOT be merged if it's on `master`. ⚠️](#️-if-you-wish-to-contribute-use-the-dev-branch-your-pr-will-not-be-merged-if-its-on-master-️)
- [Setup Instructions](#setup-instructions)
- [Unity YAML Merge Tool](#unity-yaml-merge-tool)
- [Contributing](#️-contributing)
- [License](#️-license)
- [External Licenses](#-external-licenses)
- [External Assets and Libraries](#-external-assets-and-libraries)
- [Donate](#-donate)
- [✍️ Contributing](#️-contributing)
- [🛡️ License](#️-license)
- [🧰 External Licenses](#-external-licenses)
- [📦 External Assets and Libraries](#-external-assets-and-libraries)
- [💸 Donate](#-donate)

# 📥 Downloading and Playing

Expand Down Expand Up @@ -115,23 +118,19 @@ Have fun!
> If you don't follow these instructions, **YOU WILL NOT BE ABLE TO RUN THE GAME**.
1. Make sure you have the latest version of [Blender](https://www.blender.org/) installed. This is for loading models, even if you don't plan on editing them.
2. Make sure you have [Python (3.10)](https://www.python.org/downloads/) or greater installed. Be sure it is added to system path. This is required to download dependencies.
3. Clone the repository. If you don't know how to do this:
2. Clone the repository. If you don't know how to do this:
1. Download [Git](https://git-scm.com/downloads). Be sure it is added to system path.
2. Open the command prompt in the directory you want to store the repository.
3. Type in `git clone https://github.com/YARC-Official/YARG.git`.
4. Install Unity Hub and Unity `2021.3.21f1` (LTS).
1. Download and install [Unity Hub](https://unity.com/download).
2. Sign-in/create an account with a personal license (free).
3. In Unity Hub, click on "Install Editor" and select `2021.3.21f1` (LTS). It may be favourable to unselect Visual Studio if you are not using it.
4. Click "Install"
5. Open the command prompt at the root of the repo, and type in:
1. `pip install requests`
2. `python InstallLibraries/install.py`. This may take a bit. Wait for the command prompt to say "Done!" before closing. This installs all of the needed dependencies for you.
6. Open the project in Unity (select "Open" and select YARG's repo's folder).
7. Load in **without** entering safe mode. Click "Ignore".
8. (You may need to) click on `NuGet` on the menu bar, then click on `Restore Packages`.
9. You're ready to go!
3. Install Unity Hub and Unity `2021.3.21f1` (LTS).
4. Download and install [Unity Hub](https://unity.com/download).
5. Sign-in/create an account with a personal license (free).
6. In Unity Hub, click on "Install Editor" and select `2021.3.21f1` (LTS). It may be favourable to unselect Visual Studio if you are not using it.
7. Click "Install"
4. Open the project in Unity (select "Open" and select YARG's repo's folder).
5. Load in **without** entering safe mode. Click "Ignore".
6. (You may need to) click on `NuGet` on the menu bar, then click on `Restore Packages`.
7. You're ready to go!

## Unity YAML Merge Tool

Expand Down Expand Up @@ -179,7 +178,7 @@ Some libraries/assets are **packaged** with the source code have licenses that m

Please note that other libraries are **not** packaged within the source code, and are to be install by NuGet.

BASS is the audio library for YARG. [It has it's own license for release](https://www.un4seen.com/).
BASS is the audio library for YARG. [It has it's own license for release](https://www.un4seen.com/). BASS is free for non-commercial use, ensure you have the correct license if you intend to distribute YARG (and therefore BASS) commercially.

# 📦 External Assets and Libraries

Expand Down

0 comments on commit 528ffba

Please sign in to comment.