1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-23 21:56:46 +00:00

Added alt vocal offsets feature, disabled alt instrumentals on Pico mix (for now?)

This commit is contained in:
EliteMasterEric 2024-07-22 20:52:03 -04:00
parent 1515719a0f
commit a071e90746
6 changed files with 35 additions and 15 deletions

2
assets

@ -1 +1 @@
Subproject commit 8af9bd2cf7122a5ad4dd2ca3939db75b11a5b239
Subproject commit d6e024e373ee78c53852a8e37de1956041856ad5

View file

@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.2.4]
### Added
- Added `offsets.altVocals` field to apply vocal offsets when alternate instrumentals are used.
## [2.2.3]
### Added
- Added `charter` field to denote authorship of a chart.

View file

@ -257,13 +257,21 @@ class SongOffsets implements ICloneable<SongOffsets>
public var altInstrumentals:Map<String, Float>;
/**
* The offset, in milliseconds, to apply to the song's vocals, relative to the chart.
* The offset, in milliseconds, to apply to the song's vocals, relative to the song's base instrumental.
* These are applied ON TOP OF the instrumental offset.
*/
@:optional
@:default([])
public var vocals:Map<String, Float>;
/**
* The offset, in milliseconds, to apply to the songs vocals, relative to each alternate instrumental.
* This is useful for the circumstance where, for example, an alt instrumental has a few seconds of lead in before the song starts.
*/
@:optional
@:default([])
public var altVocals:Map<String, Map<String, Float>>;
public function new(instrumental:Float = 0.0, ?altInstrumentals:Map<String, Float>, ?vocals:Map<String, Float>)
{
this.instrumental = instrumental;
@ -293,12 +301,20 @@ class SongOffsets implements ICloneable<SongOffsets>
return value;
}
public function getVocalOffset(charId:String):Float
public function getVocalOffset(charId:String, ?instrumental:String):Float
{
if (instrumental == null)
{
if (!this.vocals.exists(charId)) return 0.0;
return this.vocals.get(charId);
}
else
{
if (!this.altVocals.exists(instrumental)) return 0.0;
if (!this.altVocals.get(instrumental).exists(charId)) return 0.0;
return this.altVocals.get(instrumental).get(charId);
}
}
public function setVocalOffset(charId:String, value:Float):Float
{
@ -320,7 +336,7 @@ class SongOffsets implements ICloneable<SongOffsets>
*/
public function toString():String
{
return 'SongOffsets(${this.instrumental}ms, ${this.altInstrumentals}, ${this.vocals})';
return 'SongOffsets(${this.instrumental}ms, ${this.altInstrumentals}, ${this.vocals}, ${this.altVocals})';
}
}

View file

@ -20,7 +20,7 @@ class SongRegistry extends BaseRegistry<Song, SongMetadata>
* Handle breaking changes by incrementing this value
* and adding migration to the `migrateStageData()` function.
*/
public static final SONG_METADATA_VERSION:thx.semver.Version = "2.2.3";
public static final SONG_METADATA_VERSION:thx.semver.Version = "2.2.4";
public static final SONG_METADATA_VERSION_RULE:thx.semver.VersionRule = "2.2.x";

View file

@ -666,7 +666,7 @@ class PlayState extends MusicBeatSubState
// Prepare the current song's instrumental and vocals to be played.
if (!overrideMusic && currentChart != null)
{
currentChart.cacheInst();
currentChart.cacheInst(currentInstrumental);
currentChart.cacheVocals();
}
@ -675,7 +675,7 @@ class PlayState extends MusicBeatSubState
if (currentChart.offsets != null)
{
Conductor.instance.instrumentalOffset = currentChart.offsets.getInstrumentalOffset();
Conductor.instance.instrumentalOffset = currentChart.offsets.getInstrumentalOffset(currentInstrumental);
}
Conductor.instance.mapTimeChanges(currentChart.timeChanges);
@ -863,7 +863,7 @@ class PlayState extends MusicBeatSubState
{
// Stop the vocals if they already exist.
if (vocals != null) vocals.stop();
vocals = currentChart.buildVocals();
vocals = currentChart.buildVocals(currentInstrumental);
if (vocals.members.length == 0)
{
@ -1852,7 +1852,7 @@ class PlayState extends MusicBeatSubState
{
// Stop the vocals if they already exist.
if (vocals != null) vocals.stop();
vocals = currentChart.buildVocals();
vocals = currentChart.buildVocals(currentInstrumental);
if (vocals.members.length == 0)
{

View file

@ -813,7 +813,7 @@ class SongDifficulty
* @param charId The player ID.
* @return The generated vocal group.
*/
public function buildVocals():VoicesGroup
public function buildVocals(?instId:String = ''):VoicesGroup
{
var result:VoicesGroup = new VoicesGroup();
@ -839,8 +839,8 @@ class SongDifficulty
}
}
result.playerVoicesOffset = offsets.getVocalOffset(characters.player);
result.opponentVoicesOffset = offsets.getVocalOffset(characters.opponent);
result.playerVoicesOffset = offsets.getVocalOffset(characters.player, instId);
result.opponentVoicesOffset = offsets.getVocalOffset(characters.opponent, instId);
return result;
}