Code Monkey home page Code Monkey logo

xnfsmusicplayer's Introduction

Xan's NFS Music Player

This is a custom music player replacement and a BASS library interface for NFS.

FEATURES

  • Custom playlist generation - put any number of songs you like!
  • Basic support for M3U playlists!
  • Interactive music playback - you're not missing out on these! You can even modify them to your liking! (requires a bit of skill)
  • Online streaming - listen to online radio in the game!
  • Automatic metadata reading
  • SHOUTcast metadata support - a track changed on the radio? No problem, the Chyron will pop up when it happens!
  • Music looping
  • Per track settings - need to change the song's shown title or change the loop point? You can set that in a separate settings file!
  • A LOT of formats supported:
    • BASS' natively supported streaming formats: MP3/MP2/MP1/OGG/WAV/AIFF
    • BASS' natively supported tracker formats (same as XMPlay): mo3/xm/mod/s3m/it/mtm/umx
    • BASSFLAC: FLAC
    • BASSMIDI (only a single soundfont at a time for now :/)
  • Game mastered audio - the game itself controls the music volume, just like its own music player

INSTALLATION

  1. Install Visual Studio 2015-2022 x86 Redist (from here: https://aka.ms/vs/17/release/vc_redist.x86.exe ) (SKIP IF ALREADY INSTALLED)
  2. Extract this package to your game's root directory
  3. Start the game and follow the instructions
  4. Do either of following things:
    1. Make an M3U playlist with your favorite music player and save to scripts\XNFSMusicPlayer\Playlist.m3u
    2. Open scripts\XNFSMusicPlayer.ini and set PlaylistFile to the path of your M3U file!

NOTE: M3U must be NON-UNICODE! If your path contains Unicode letters, until Unicode paths are implemented, please use non-Unicode paths (don't use special characters).

CONFIGURATION

The configuration consists of multiple files:

  1. The main config: XNFSMusicPlayer.ini
  2. Per track settings (default at scripts\XNFSMusicPlayer\PlaylistConfig.ini)
  3. The main playlist (default at scripts\XNFSMusicPlayer\Playlist.m3u)
  4. Node paths (default at scripts\XNFSMusicPlayer\NodePaths.txt) - auto generated upon first time setup
  5. EventID overrides (default at scripts\XNFSMusicPlayer\Overrides.txt) - auto generated upon first time setup

1. MAIN CONFIG

In this file, you can set up various settings related to playback. Most of it is explained in the file itself.

If you have any trouble (hitching, delaying) during playback, this is the file to look at.

You can also enable the console log output by changing the VerbosityLevel in case of any errors. DO NOT use this if you're on WinXP, it will cause crashes.

This will also cause a crash if you don't have a console attached to the game's window. Use ConsoleAttachment.asi included in the package.

Each of the other config file locations can be changed within this file as well. (in [Playlists])

Example: You can change the playlist file by changing PlaylistFile like this:

[Playlists]

PlaylistFile = D:\MyMusicFolder\MyPlaylist.m3u

If you wish to restart the first time setup, set InstallerCompleted to 0 (and optionally rename/remove the InteractiveMusic folder).

2. PER TRACK SETTINGS

This is the file that saves any settings that can be set on a single track. Settings include:

  • Looping settings
  • Track title, artist and album (overrides existing metadata in file)
  • Playback mode
  • Tracker amplification level

To create an entry, simply go to the EA Trax settings in the game, and change the playback mode (All, Ingame, Menu). (press left/right)

The track's ID will be appended to the file.

An example configuration exists within the file itself already.

3. MAIN PLAYLIST FILE

In here you can place paths to your music files. You can use either a music player that can create M3U files. It's simple - one line per file!

You can also comment a line with # infront of it. Inline comments are not yet supported.

4. NODE PATH FILE

This file contains a table of paths per each NodeID. (NodeID in hex = FilePath) It is automatically generated during first time setup if you chose to use interactive music.

The contents of this file depends on the .mpf file (PathFinder definition file).

If you happen to use a different definition file in your game after first time setup, this file will become invalid.

If you wish to extract all of the files from the game, not just interactive specific music, set ScanForAllFiles to 1 in the main config file.

The installer can also generate this and the rest of the files with the PS2's MUS/MPF combo. In this case, be sure to enable ScanForAllFiles.

5. EVENTID OVERRIDE FILE

The format of this file is identical to the previous one, except this time the ID matches an EventID.

An EventID is what it says it is - a number to identify an event in the game. These numbers are used throughout the game to trigger different music.

The music player is capable of generating its own EventIDs for each track, however there are exceptions; As the title screen (and maybe others if you disabled interactive music) has no ties to EA Trax, the EventID must be overrided manually.

In this file you can define which EventID is tied to which file precisely, so if you're missing any, you can add them here.

TODO list:

  • add NFSC chyron handling and calling
  • add NFSC music playback types like MW - IG, FE, AL, OF (instead of just on/off)
  • Unicode
  • installer direct process calling instead of batch scripting - this will allow for percentage overview in the dialog boxes
  • sflist support
  • proper versioning generation & Git integration (this is still very much a mess)
  • integrate BASS FX to restore the LPF effect on SpeedBreaker

CREDITS

ThirteenAG - for the Ultimate ASI Loader and the injector and IniReader

Un4seen Developments Ltd. (Ian Luck) - BASS library, BASSMIDI and BASSFLAC addons

xnfsmusicplayer's People

Contributors

xan1242 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

alexpado

xnfsmusicplayer's Issues

[All] Removal of interactive music playback

I'm considering removing the interactive music playback feature and I'll need to gather some thoughts and opinions on this matter...

The reasons why I'm considering it:

  • The advancements in modding in-game files had grown since this plugin was made (MPFmaster)
  • In its current form, it makes no sense. As soon as you modify the map file (mpf) parts of the original interactive music, this player automatically becomes invalid. This is because it relies on just playing back the samples instead of actually playing the music
  • It's a big, complicated piece of code that just complicates matters, so limiting the scope to the EA Trax Jukebox will make things MUCH easier
  • Removes the need for the "installer" which just extracts the samples

While it was cool to see the in-game dialogs control external utilities and make BASS play samples, I don't think it's worth keeping.

There is a possibility where I keep it, and that is only and only if someone manages to:

  • Make an entirely custom Pathfinder player
  • Or maybe, make this into a dumb sample player (but this would mean re-extracting the samples every time you modify something, kinda like what it is now)

As a feature, keeping it as-is I could also do (and just disabling it) but during the process of simplification, I might break it.

[ Carbon ] This mod causes immediate crash apon career load

After downloading and installing this mod for NFS Carbon, the career mode no longer works. The game crashes immediately after pressing "Resume Career"->"Free Roam". "Unhandled exception at 0x004A3A67 in NFSC.exe: 0xC00000FD: Stack overflow (parameters: 0x00000001, 0x000A2FFC).", it then proceeds to throw "Exception thrown at 0x004D2263 in NFSC.exe: 0xC0000005: Access violation writing location 0x000A0FFC."

[Installer] - Better fail checks

Installer does NOT work under Wine/Proton because the work directory is wrong.

Secondly, the installer says it succeeded even though it clearly failed because of this.

[MW] New Playback mode - Free Roam

Let me give a advice, why should I know about the new playback mode that I wish. Sometimes in Carbon, if composed racing music (expect checkpoint) is what I hear during the crew race, and if licensed music from the EA Trax that I could listen this during free roam or checkpoint race. Like similar game to it's mechanic, Street Racing Syndicate, Need for Speed World, Need for Speed Rivals, etc. And in Most Wanted? Well, rumor has it, be sure to figured out what's up with music mechanic from coding.

Example:
PlaybackMode=FR (Free Roam), FG (Free Roam and Racing), FM (Free Roam and Menu)

Bonus Example:
PlaybackMode=IM (Racing and Menu)

Most Wanted crashes if m3u has more than 9 songs

Not sure if I'm using the wrong format for my music or something, but when I more than 9 songs to my Playlist.m3u file the game crashes with this error in the console:
ERROR: Out of memory in pool Main Pool allocating (null) (size = 253706240). Largest possible = 103809024 Total = 137476

This is with ExpandMemoryPools enabled in extra options

No random playing for NFS Carbon?

Every time at start all the songs start playing in order from the playlist. Unlike MW there is no in-game option here. Is it fixable somehow?

PlayListConfig Don't work

Hello. I Installed XNFSMusicPlayer, when i changed soundtracks in NFS MW Netshow Challenges mod playlist config is broken. Please fix it playlist config to work! Thanks.

MW: Game Won't Start

As soon as I add my own m3u playlist file, the game won't start.
I've tried adding it alongside the original empty m3u file.
Changed the 'XNFSMusicPlayer.ini' Playlist file path to match the name if i renamed the playlist something else.
Anything I could think of I tried.

The playlist had 1 song in mp3 format just to test that it works but as soon as I change that Playlist.m3u file, the game won't even start.

it crashes when it starts

hey I have a problem when I go to start the game it crashes if I put
the music but hey I need a solution

Online streams cause game freeze every ~5 seconds

To recreate, just add "http://eurobeat.stream.laut.fm/eurobeat" to scripts/Playlist.m3u. No matter the buffer/async settings, the track plays for about 5 seconds, then stops and the game freezes for a second or so, then continues playing again. Each time the EA Trax notifier comes up as if a new song is playing.

Log output reflects this (loglevel 3):

INFO: Playing Pathfinder EventID: 12CDF9
INFO: Notifying Chyron: Elisa - Lost Into The Night
INFO: Searching path by EventID 12CDF9
INFO: Found and set file http://eurobeat.stream.laut.fm/eurobeat to 12CDF9
INFO: Type: Online stream
INFO: Playing Pathfinder EventID: 12CDF9
INFO: Notifying Chyron: Elisa - Lost Into The Night
INFO: Searching path by EventID 12CDF9
INFO: Found and set file http://eurobeat.stream.laut.fm/eurobeat to 12CDF9
INFO: Type: Online stream
INFO: Playing Pathfinder EventID: 12CDF9
INFO: Notifying Chyron: Elisa - Lost Into The Night
INFO: Searching path by EventID 12CDF9
INFO: Found and set file http://eurobeat.stream.laut.fm/eurobeat to 12CDF9
INFO: Type: Online stream
INFO: Playing Pathfinder EventID: 12CDF9
INFO: Notifying Chyron: Elisa - Lost Into The Night
INFO: Searching path by EventID 12CDF9
INFO: Found and set file http://eurobeat.stream.laut.fm/eurobeat to 12CDF9
INFO: Type: Online stream
INFO: Playing Pathfinder EventID: 12CDF9
INFO: Notifying Chyron: Elisa - Lost Into The Night
INFO: Searching path by EventID 12CDF9
INFO: Found and set file http://eurobeat.stream.laut.fm/eurobeat to 12CDF9
INFO: Type: Online stream
INFO: Playing Pathfinder EventID: 12CDF9
INFO: Notifying Chyron: Elisa - Lost Into The Night
INFO: Searching path by EventID 12CDF9
INFO: Found and set file http://eurobeat.stream.laut.fm/eurobeat to 12CDF9
INFO: Type: Online stream
INFO: Playing Pathfinder EventID: 12CDF9
INFO: Notifying Chyron: Elisa - Lost Into The Night

Most Wanted: Ambience sounds play at half of speed than should be

I noticed that during using XNFSPlayer in Most wanted 2005 ambience sounds play at half of speed than should be, but after removing all related XNFSPlayer files including both Interactive music and custom music folders ambience sounds play at normal speed. Can you explain what's the reason of this issue?

[Carbon] Crashes upon finishing Drift events

When finishing Drift races while the mod is installed, the game CTDs. I installed the mod fresh and left the settings outside of the name of the playlist at their defaults, so it likely isn't anything caused by altering the settings. Apologies for the lack of info.

the mod wont work?

hiya, so i tried to install the script and it says 'you can now exit the game', but when i relaunched the game the new music i installed is not.. there? it still plays the old song that came from the game, am i doing something wrong?

MW: my game doesn't start at all

MW: my game doesn't start at all, the prompt just says "INFO: Processing playlist" and it stays like that forever, I only added 30 songs btw
image

[Linux, Proton] Can't set volume attribute, can't play channel (BASS error 5)

Running under Proton Experimental, unable to get music playing due to above error. Log attached.
(Additionally, for what it's worth, i've not been hitting the issue with path length issues, but I did have to spoof Windows paths to get the plugin to load any tracks at all, and when no tracks are loaded, the player tries to print uninitialized memory and kills the game when showing the track name.)

XNFSMusicPlayer.log.tar.gz

(Please excuse my trash taste in music.)

Can't play the music, broken.

So yeah after install the mod i can't hear any music until found the mod are broken.

Even i try to make the Playlist again still no progress

Screenshot (308)
Screenshot (307)

[Carbon] Car class category setting

I've noticed that in XNFSMusicPlayer_Carbon.h, under SongAttrib, there's a variable called CarClassCategory.

imagen

And under DoFilePathsStruct you have this, the variable takes the value 2.

imagen

In the game, all songs of the music player are on all categories.

I know that Class Categories are represented by numbers; 1 for Exotics, 2 for Muscles and 3 for Tuners. Wouldn't be possible to assign the class category under a song in PlaylistConfig.ini? For example:

[E95E7B]
TrackEnabled= 0
Title=My music title
Album=My music album
Artist=My music artist
CarClassCategory=1

Or is there some kind of issue that won't let the music player do this?

Won't work at all: more tracks = more problems

21 tracks and everything was fine. But after adding more - just nothing happens, game won't start. I removed most of tracks - game begin to crash right after launch. I removed all of new tracks - it's working again. Every file is just a number, tags includes only name+author+album, no unicode symbols at all etc.

I tried to check what's happening by using ConsoleAttachment.asi and VerbosityLevel option. But alas - when ConsoleAttachment.asi placed into script folder, it overrides launch of the game itself: just console window and nothing more. Even when only twenty tracks were used and without that "console attachment' game works just fine.

So - both mod and "console attachment" looks like pretty much broken for me.

How to change only the first song when you start the game?

Hello, I only want to change the first song when you start the game after pressing enter in NFS Carbon, because the first song is lame as f*ck and don't give any feelings like Underground. I have a few mods on Carbon like the new animation for the menu like tunnel from Underground 1.

Because of that I want to change the first Song to another Song (from the Game self; the Song when you are tuning cars there).

Have someone a Idea and can help me please?

Music will not play at all. Constant loop through playlist.

Verbose level 3 log output:

INFO: Searching path by EventID FE9C8A
INFO: Found and set file XNFSMusicPlayer\Brussel Sprout.mp3 to FE9C8A
INFO: Type: Stream
ERROR: Can't set volume attribute (handle: music): BASS Error: 5
INFO: Playing Pathfinder EventID: FE9C8A
ERROR: Can't play channel (handle: music): BASS Error: 5

I can see the bass.dll is throwing an error trying to set the volume attribute but i just don't really know what to do about it.
I've tried the following
all three formats on initial startup ogg wav and ast? Can't remember the other format. I'm using version 1.7 I believe
removed the tags from my mp3's
created m3u file from mp3tags
converted all my mp3's under 120kbps

I want use the mod so bad I've tried everything i can think of and I've just hit a wall.

The songs repeat themselves when they haven't even finished

The songs are repeated when they are not finished yet, causing the same song to overlap many times and sound horrible, the only solution is to enter a menu outside the game (branch, shop or home) but this cannot be done in a chase and in a race it restarts the race.

I have a issue with the ingame music option

For example i select certain songs to play at the menu and the other during races, but doesn't work very well. Sometimes it will play the menu song during races and the race song will play in the menu. Did i missed something in the config or is it a bug?

Carbon - Interactive music does not play

Hi, I had installed this mod before and managed to get it working properly, however the game glitched due to another mod corrupting the game and had to reinstall. After reinstalling the music player, the installer bypassed the extraction of the streams and assumed that all files were already extracted, finally after the setup was done, the game's menu, police chase and race music would not play anymore. I have tried deleting all files associated with the game including the mod itself to no avail. Any potential solution to this case? Thank you for your help in advance!

String Limit?

I am able to get the player working with a few songs, but from a bit of messing about I found that files with long path strings seem to overwhelm things at startup and the game refuses to launch.

If a string limit is real, how large can these be?

I have a playlist of 50 songs, all located on a separate HDD than the game, all files are mp3 and the playlist was saved via foobar2000 as some have stated would be best.

The songs that do work, have path strings about 64 char long, some of the longest file paths shown are about 116 char long

How to get EA TRAX back?

Installing this mod and adding my playlist removed all game songs. Now, only custom music is present. How to have both custom and original music?

URL encoded path make tracks unplayable

Hi,

Just noticed this issue, if the path contains spaces, VLC will encode them to %20 which will cause the music to be unplayable.
Manually editing the file replacing %20 back to spaces works.

For reference, when %20 are present, this is what I get in the logs:

INFO: Searching path by EventID 991472
INFO: Found and set file scripts\XNFSMusicPlayer\musics/need-for-speed-underground-2/SpiderBait%20-%20Black%20Betty.ogg to 991472
INFO: Type: OGG stream
ERROR: Error creating stream handle for file: scripts\XNFSMusicPlayer\musics/need-for-speed-underground-2/SpiderBait%20-%20Black%20Betty.ogg | BASS Error: 2
ERROR: Can't set volume attribute (handle: music): BASS Error: 5

Altough this is an easy fix with any editor using search & replace, this is still a pretty annoying thing to do.
Is there any way to fix this ?

EDIT:
This seems to affect every characters being URL encoded. Just had the issue with ( and ) with are encoded %28 and %29 respectively.

Disabling EA Trax causes the game freezing every ~15-30 seconds (or even not so often)

When I disabling EA Trax the game freezes for the a few seconds and goes normally again. And that strange thing happens every ~15-30 seconds (or even not so often) until pursuit starts or EA Trax is enabled.

I don't know how to fix that, so I need your help.

My settings (just in case)
Interactive music format: ogg (9.00 quality)
Custom music format: ogg (high quality)

Out of memory in pool Main Pool (null)

dsfsdgfsadgsdgfs
The game crashes and then shows this error after I put my playlist file, 79 songs all mp3 and renamed with simple names. Newest version crashes too but this one shows me the error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.