From 2fcb906edfaa4e76591bea539b3433bbf9241e47 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 26 Sep 2023 17:46:07 -0400 Subject: [PATCH 1/7] Fixed volume sliders, Load Instrumental button, and fixed hitsounds. --- assets | 2 +- source/funkin/data/song/SongData.hx | 10 +- source/funkin/data/song/SongRegistry.hx | 4 +- .../debug/charting/ChartEditorAudioHandler.hx | 309 ++++++++++++------ .../charting/ChartEditorDialogHandler.hx | 210 +++++++++--- .../ChartEditorImportExportHandler.hx | 56 ++-- .../ui/debug/charting/ChartEditorState.hx | 117 ++++--- 7 files changed, 498 insertions(+), 210 deletions(-) diff --git a/assets b/assets index 7e698e3dd..af2767368 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 7e698e3dd51443f0bb8aa4105596f8e87eca4a9b +Subproject commit af2767368a273eaaf8010ba0de79f4f1a7482e16 diff --git a/source/funkin/data/song/SongData.hx b/source/funkin/data/song/SongData.hx index d557bd39c..9340e46c9 100644 --- a/source/funkin/data/song/SongData.hx +++ b/source/funkin/data/song/SongData.hx @@ -4,6 +4,7 @@ import flixel.util.typeLimit.OneOfTwo; import funkin.data.song.SongRegistry; import thx.semver.Version; +@:nullSafety class SongMetadata { /** @@ -42,7 +43,7 @@ class SongMetadata public var timeChanges:Array; /** - * Defaults to `default` or `''`. Populated later. + * Defaults to `Constants.DEFAULT_VARIATION`. Populated later. */ @:jignored public var variation:String; @@ -228,10 +229,10 @@ class SongMusicData public var timeChanges:Array; /** - * Defaults to `default` or `''`. Populated later. + * Defaults to `Constants.DEFAULT_VARIATION`. Populated later. */ @:jignored - public var variation:String = Constants.DEFAULT_VARIATION; + public var variation:String; public function new(songName:String, artist:String, variation:String = 'default') { @@ -375,6 +376,9 @@ class SongChartData @:default(funkin.data.song.SongRegistry.DEFAULT_GENERATEDBY) public var generatedBy:String; + /** + * Defaults to `Constants.DEFAULT_VARIATION`. Populated later. + */ @:jignored public var variation:String; diff --git a/source/funkin/data/song/SongRegistry.hx b/source/funkin/data/song/SongRegistry.hx index cf2da14f7..889fca707 100644 --- a/source/funkin/data/song/SongRegistry.hx +++ b/source/funkin/data/song/SongRegistry.hx @@ -156,7 +156,7 @@ class SongRegistry extends BaseRegistry return cleanMetadata(parser.value, variation); } - public function parseEntryMetadataWithMigration(id:String, ?variation:String, version:thx.semver.Version):Null + public function parseEntryMetadataWithMigration(id:String, variation:String, version:thx.semver.Version):Null { variation = variation == null ? Constants.DEFAULT_VARIATION : variation; @@ -192,7 +192,7 @@ class SongRegistry extends BaseRegistry } } - function parseEntryMetadata_v2_0_0(id:String, variation:String = ""):Null + function parseEntryMetadata_v2_0_0(id:String, ?variation:String):Null { variation = variation == null ? Constants.DEFAULT_VARIATION : variation; diff --git a/source/funkin/ui/debug/charting/ChartEditorAudioHandler.hx b/source/funkin/ui/debug/charting/ChartEditorAudioHandler.hx index e852dff0a..b5a6f36be 100644 --- a/source/funkin/ui/debug/charting/ChartEditorAudioHandler.hx +++ b/source/funkin/ui/debug/charting/ChartEditorAudioHandler.hx @@ -1,11 +1,14 @@ package funkin.ui.debug.charting; -import openfl.utils.Assets; import flixel.system.FlxAssets.FlxSoundAsset; import flixel.system.FlxSound; -import funkin.play.character.BaseCharacter.CharacterType; import flixel.system.FlxSound; +import funkin.audio.VoicesGroup; +import funkin.play.character.BaseCharacter.CharacterType; +import funkin.util.FileUtil; +import haxe.io.Bytes; import haxe.io.Path; +import openfl.utils.Assets; /** * Functions for loading audio for the chart editor. @@ -17,16 +20,18 @@ import haxe.io.Path; class ChartEditorAudioHandler { /** - * Loads a vocal track from an absolute file path. + * Loads and stores byte data for a vocal track from an absolute file path + * * @param path The absolute path to the audio file. - * @param charKey The character to load the vocal track for. + * @param charId The character this vocal track will be for. + * @param instId The instrumental this vocal track will be for. * @return Success or failure. */ - static function loadVocalsFromPath(state:ChartEditorState, path:Path, charKey:String = 'default'):Bool + static function loadVocalsFromPath(state:ChartEditorState, path:Path, charId:String, instId:String = ''):Bool { #if sys - var fileBytes:haxe.io.Bytes = sys.io.File.getBytes(path.toString()); - return loadVocalsFromBytes(state, fileBytes, charKey); + var fileBytes:Bytes = sys.io.File.getBytes(path.toString()); + return loadVocalsFromBytes(state, fileBytes, charId, instId); #else trace("[WARN] This platform can't load audio from a file path, you'll need to fetch the bytes some other way."); return false; @@ -34,137 +39,235 @@ class ChartEditorAudioHandler } /** - * Load a vocal track for a given song and character and add it to the voices group. + * Loads and stores byte data for a vocal track from an asset * - * @param path ID of the asset. - * @param charKey Character to load the vocal track for. + * @param path The path to the asset. Use `Paths` to build this. + * @param charId The character this vocal track will be for. + * @param instId The instrumental this vocal track will be for. * @return Success or failure. */ - static function loadVocalsFromAsset(state:ChartEditorState, path:String, charType:CharacterType = OTHER):Bool + static function loadVocalsFromAsset(state:ChartEditorState, path:String, charId:String, instId:String = ''):Bool { - var vocalTrack:FlxSound = FlxG.sound.load(path, 1.0, false); + var trackData:Null = Assets.getBytes(path); + if (trackData != null) + { + return loadVocalsFromBytes(state, trackData, charId, instId); + } + return false; + } + + /** + * Loads and stores byte data for a vocal track + * + * @param bytes The audio byte data. + * @param charId The character this vocal track will be for. + * @param instId The instrumental this vocal track will be for. + */ + static function loadVocalsFromBytes(state:ChartEditorState, bytes:Bytes, charId:String, instId:String = ''):Bool + { + var trackId:String = '${charId}${instId == '' ? '' : '-${instId}'}'; + state.audioVocalTrackData.set(trackId, bytes); + return true; + } + + /** + * Loads and stores byte data for an instrumental track from an absolute file path + * + * @param path The absolute path to the audio file. + * @param instId The instrumental this vocal track will be for. + * @return Success or failure. + */ + static function loadInstFromPath(state:ChartEditorState, path:Path, instId:String = ''):Bool + { + #if sys + var fileBytes:Bytes = sys.io.File.getBytes(path.toString()); + return loadInstFromBytes(state, fileBytes, instId); + #else + trace("[WARN] This platform can't load audio from a file path, you'll need to fetch the bytes some other way."); + return false; + #end + } + + /** + * Loads and stores byte data for an instrumental track from an asset + * + * @param path The path to the asset. Use `Paths` to build this. + * @param instId The instrumental this vocal track will be for. + * @return Success or failure. + */ + static function loadInstFromAsset(state:ChartEditorState, path:String, instId:String = ''):Bool + { + var trackData:Null = Assets.getBytes(path); + if (trackData != null) + { + return loadInstFromBytes(state, trackData, instId); + } + return false; + } + + /** + * Loads and stores byte data for a vocal track + * + * @param bytes The audio byte data. + * @param charId The character this vocal track will be for. + * @param instId The instrumental this vocal track will be for. + */ + static function loadInstFromBytes(state:ChartEditorState, bytes:Bytes, instId:String = ''):Bool + { + if (instId == '') instId = 'default'; + state.audioInstTrackData.set(instId, bytes); + return true; + } + + public static function switchToInstrumental(state:ChartEditorState, instId:String = '', playerId:String, opponentId:String):Bool + { + var result:Bool = playInstrumental(state, instId); + if (!result) return false; + + stopExistingVocals(state); + result = playVocals(state, BF, playerId, instId); + if (!result) return false; + result = playVocals(state, DAD, opponentId, instId); + if (!result) return false; + + return true; + } + + /** + * Tell the Chart Editor to select a specific instrumental track, that is already loaded. + */ + static function playInstrumental(state:ChartEditorState, instId:String = ''):Bool + { + if (instId == '') instId = 'default'; + var instTrackData:Null = state.audioInstTrackData.get(instId); + var instTrack:Null = buildFlxSoundFromBytes(instTrackData); + if (instTrack == null) return false; + + stopExistingInstrumental(state); + state.audioInstTrack = instTrack; + state.postLoadInstrumental(); + return true; + } + + static function stopExistingInstrumental(state:ChartEditorState):Void + { + if (state.audioInstTrack != null) + { + state.audioInstTrack.stop(); + state.audioInstTrack.destroy(); + state.audioInstTrack = null; + } + } + + /** + * Tell the Chart Editor to select a specific vocal track, that is already loaded. + */ + static function playVocals(state:ChartEditorState, charType:CharacterType, charId:String, instId:String = ''):Bool + { + var trackId:String = '${charId}${instId == '' ? '' : '-${instId}'}'; + var vocalTrackData:Null = state.audioVocalTrackData.get(trackId); + var vocalTrack:Null = buildFlxSoundFromBytes(vocalTrackData); + + if (state.audioVocalTrackGroup == null) state.audioVocalTrackGroup = new VoicesGroup(); + if (vocalTrack != null) { switch (charType) { - case CharacterType.BF: - if (state.audioVocalTrackGroup != null) state.audioVocalTrackGroup.addPlayerVoice(vocalTrack); - state.audioVocalTrackData.set(state.currentSongCharacterPlayer, Assets.getBytes(path)); - case CharacterType.DAD: - if (state.audioVocalTrackGroup != null) state.audioVocalTrackGroup.addOpponentVoice(vocalTrack); - state.audioVocalTrackData.set(state.currentSongCharacterOpponent, Assets.getBytes(path)); + case BF: + state.audioVocalTrackGroup.addPlayerVoice(vocalTrack); + return true; + case DAD: + state.audioVocalTrackGroup.addOpponentVoice(vocalTrack); + return true; + case OTHER: + state.audioVocalTrackGroup.add(vocalTrack); + return true; default: - if (state.audioVocalTrackGroup != null) state.audioVocalTrackGroup.add(vocalTrack); - state.audioVocalTrackData.set('default', Assets.getBytes(path)); + // Do nothing. } - - return true; } return false; } - /** - * Loads a vocal track from audio byte data. - */ - static function loadVocalsFromBytes(state:ChartEditorState, bytes:haxe.io.Bytes, charKey:String = ''):Bool + static function stopExistingVocals(state:ChartEditorState):Void { - var openflSound:openfl.media.Sound = new openfl.media.Sound(); - openflSound.loadCompressedDataFromByteArray(openfl.utils.ByteArray.fromBytes(bytes), bytes.length); - var vocalTrack:FlxSound = FlxG.sound.load(openflSound, 1.0, false); - if (state.audioVocalTrackGroup != null) state.audioVocalTrackGroup.add(vocalTrack); - state.audioVocalTrackData.set(charKey, bytes); - return true; - } - - /** - * Loads an instrumental from an absolute file path, replacing the current instrumental. - * - * @param path The absolute path to the audio file. - * - * @return Success or failure. - */ - static function loadInstrumentalFromPath(state:ChartEditorState, path:Path):Bool - { - #if sys - // Validate file extension. - if (path.ext != null && !ChartEditorState.SUPPORTED_MUSIC_FORMATS.contains(path.ext)) + if (state.audioVocalTrackGroup != null) { - return false; + state.audioVocalTrackGroup.clear(); } - - var fileBytes:haxe.io.Bytes = sys.io.File.getBytes(path.toString()); - return loadInstrumentalFromBytes(state, fileBytes, '${path.file}.${path.ext}'); - #else - trace("[WARN] This platform can't load audio from a file path, you'll need to fetch the bytes some other way."); - return false; - #end - } - - /** - * Loads an instrumental from audio byte data, replacing the current instrumental. - * @param bytes The audio byte data. - * @param fileName The name of the file, if available. Used for notifications. - * @return Success or failure. - */ - static function loadInstrumentalFromBytes(state:ChartEditorState, bytes:haxe.io.Bytes, fileName:String = null):Bool - { - if (bytes == null) - { - return false; - } - - var openflSound:openfl.media.Sound = new openfl.media.Sound(); - openflSound.loadCompressedDataFromByteArray(openfl.utils.ByteArray.fromBytes(bytes), bytes.length); - state.audioInstTrack = FlxG.sound.load(openflSound, 1.0, false); - state.audioInstTrack.autoDestroy = false; - state.audioInstTrack.pause(); - - state.audioInstTrackData = bytes; - - state.postLoadInstrumental(); - - return true; - } - - /** - * Loads an instrumental from an OpenFL asset, replacing the current instrumental. - * @param path The path to the asset. Use `Paths` to build this. - * @return Success or failure. - */ - static function loadInstrumentalFromAsset(state:ChartEditorState, path:String):Bool - { - var instTrack:FlxSound = FlxG.sound.load(path, 1.0, false); - if (instTrack != null) - { - state.audioInstTrack = instTrack; - - state.audioInstTrackData = Assets.getBytes(path); - - state.postLoadInstrumental(); - return true; - } - - return false; } /** * Play a sound effect. * Automatically cleans up after itself and recycles previous FlxSound instances if available, for performance. + * @param path The path to the sound effect. Use `Paths` to build this. */ public static function playSound(path:String):Void { var snd:FlxSound = FlxG.sound.list.recycle(FlxSound) ?? new FlxSound(); - var asset:Null = FlxG.sound.cache(path); if (asset == null) { trace('WARN: Failed to play sound $path, asset not found.'); return; } - snd.loadEmbedded(asset); snd.autoDestroy = true; FlxG.sound.list.add(snd); snd.play(); } + + /** + * Convert byte data into a playable sound. + * + * @param input The byte data. + * @return The playable sound, or `null` if loading failed. + */ + public static function buildFlxSoundFromBytes(input:Null):Null + { + if (input == null) return null; + + var openflSound:openfl.media.Sound = new openfl.media.Sound(); + openflSound.loadCompressedDataFromByteArray(openfl.utils.ByteArray.fromBytes(input), input.length); + var output:FlxSound = FlxG.sound.load(openflSound, 1.0, false); + return output; + } + + static function makeZIPEntriesFromInstrumentals(state:ChartEditorState):Array + { + var zipEntries = []; + + for (key in state.audioInstTrackData.keys()) + { + if (key == 'default') + { + var data:Null = state.audioInstTrackData.get('default'); + if (data == null) continue; + zipEntries.push(FileUtil.makeZIPEntryFromBytes('Inst.ogg', data)); + } + else + { + var data:Null = state.audioInstTrackData.get(key); + if (data == null) continue; + zipEntries.push(FileUtil.makeZIPEntryFromBytes('Inst-${key}.ogg', data)); + } + } + + return zipEntries; + } + + static function makeZIPEntriesFromVocals(state:ChartEditorState):Array + { + var zipEntries = []; + + for (key in state.audioVocalTrackData.keys()) + { + var data:Null = state.audioVocalTrackData.get(key); + if (data == null) continue; + zipEntries.push(FileUtil.makeZIPEntryFromBytes('Vocals-${key}.ogg', data)); + } + + return zipEntries; + } } diff --git a/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx b/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx index 45ee48113..e050beda3 100644 --- a/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx +++ b/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx @@ -83,7 +83,7 @@ class ChartEditorDialogHandler var dialog:Null = openDialog(state, CHART_EDITOR_DIALOG_WELCOME_LAYOUT, true, closable); if (dialog == null) throw 'Could not locate Welcome dialog'; - // Add handlers to the "Create From Song" section. + // Create New Song "Easy/Normal/Hard" var linkCreateBasic:Null = dialog.findComponent('splashCreateFromSongBasic', Link); if (linkCreateBasic == null) throw 'Could not locate splashCreateFromSongBasic link in Welcome dialog'; linkCreateBasic.onClick = function(_event) { @@ -93,7 +93,20 @@ class ChartEditorDialogHandler // // Create Song Wizard // - openCreateSongWizard(state, false); + openCreateSongWizardBasic(state, false); + } + + // Create New Song "Erect/Nightmare" + var linkCreateErect:Null = dialog.findComponent('splashCreateFromSongErect', Link); + if (linkCreateErect == null) throw 'Could not locate splashCreateFromSongErect link in Welcome dialog'; + linkCreateErect.onClick = function(_event) { + // Hide the welcome dialog + dialog.hideDialog(DialogButton.CANCEL); + + // + // Create Song Wizard + // + openCreateSongWizardErect(state, false); } var linkImportChartLegacy:Null = dialog.findComponent('splashImportChartLegacy', Link); @@ -232,34 +245,112 @@ class ChartEditorDialogHandler }; } - public static function openCreateSongWizard(state:ChartEditorState, closable:Bool):Void + public static function openCreateSongWizardBasic(state:ChartEditorState, closable:Bool):Void { - // Step 1. Upload Instrumental - var uploadInstDialog:Dialog = openUploadInstDialog(state, closable); - uploadInstDialog.onDialogClosed = function(_event) { + // Step 1. Song Metadata + var songMetadataDialog:Dialog = openSongMetadataDialog(state); + songMetadataDialog.onDialogClosed = function(_event) { state.isHaxeUIDialogOpen = false; if (_event.button == DialogButton.APPLY) { - // Step 2. Song Metadata - var songMetadataDialog:Dialog = openSongMetadataDialog(state); - songMetadataDialog.onDialogClosed = function(_event) { + // Step 2. Upload Instrumental + var uploadInstDialog:Dialog = openUploadInstDialog(state, closable); + uploadInstDialog.onDialogClosed = function(_event) { state.isHaxeUIDialogOpen = false; if (_event.button == DialogButton.APPLY) { // Step 3. Upload Vocals // NOTE: Uploading vocals is optional, so we don't need to check if the user cancelled the wizard. - openUploadVocalsDialog(state, false); // var uploadVocalsDialog:Dialog + var uploadVocalsDialog:Dialog = openUploadVocalsDialog(state, closable); // var uploadVocalsDialog:Dialog + uploadVocalsDialog.onDialogClosed = function(_event) { + state.isHaxeUIDialogOpen = false; + state.switchToCurrentInstrumental(); + state.postLoadInstrumental(); + } } else { - // User cancelled the wizard! Back to the welcome dialog. + // User cancelled the wizard at Step 2! Back to the welcome dialog. openWelcomeDialog(state); } }; } else { - // User cancelled the wizard! Back to the welcome dialog. + // User cancelled the wizard at Step 1! Back to the welcome dialog. + openWelcomeDialog(state); + } + }; + } + + public static function openCreateSongWizardErect(state:ChartEditorState, closable:Bool):Void + { + // Step 1. Song Metadata + var songMetadataDialog:Dialog = openSongMetadataDialog(state); + songMetadataDialog.onDialogClosed = function(_event) { + state.isHaxeUIDialogOpen = false; + if (_event.button == DialogButton.APPLY) + { + // Step 2. Upload Instrumental + var uploadInstDialog:Dialog = openUploadInstDialog(state, closable); + uploadInstDialog.onDialogClosed = function(_event) { + state.isHaxeUIDialogOpen = false; + if (_event.button == DialogButton.APPLY) + { + // Step 3. Upload Vocals + // NOTE: Uploading vocals is optional, so we don't need to check if the user cancelled the wizard. + var uploadVocalsDialog:Dialog = openUploadVocalsDialog(state, closable); // var uploadVocalsDialog:Dialog + uploadVocalsDialog.onDialogClosed = function(_event) { + state.switchToCurrentInstrumental(); + // Step 4. Song Metadata (Erect) + var songMetadataDialogErect:Dialog = openSongMetadataDialog(state, 'erect'); + songMetadataDialogErect.onDialogClosed = function(_event) { + state.isHaxeUIDialogOpen = false; + if (_event.button == DialogButton.APPLY) + { + // Switch to the Erect variation so uploading the instrumental applies properly. + state.selectedVariation = 'erect'; + + // Step 5. Upload Instrumental (Erect) + var uploadInstDialogErect:Dialog = openUploadInstDialog(state, closable); + uploadInstDialogErect.onDialogClosed = function(_event) { + state.isHaxeUIDialogOpen = false; + if (_event.button == DialogButton.APPLY) + { + // Step 6. Upload Vocals (Erect) + // NOTE: Uploading vocals is optional, so we don't need to check if the user cancelled the wizard. + var uploadVocalsDialogErect:Dialog = openUploadVocalsDialog(state, closable); // var uploadVocalsDialog:Dialog + uploadVocalsDialogErect.onDialogClosed = function(_event) { + state.isHaxeUIDialogOpen = false; + state.switchToCurrentInstrumental(); + state.postLoadInstrumental(); + } + } + else + { + // User cancelled the wizard at Step 5! Back to the welcome dialog. + openWelcomeDialog(state); + } + }; + } + else + { + // User cancelled the wizard at Step 4! Back to the welcome dialog. + openWelcomeDialog(state); + } + } + } + } + else + { + // User cancelled the wizard at Step 2! Back to the welcome dialog. + openWelcomeDialog(state); + } + }; + } + else + { + // User cancelled the wizard at Step 1! Back to the welcome dialog. openWelcomeDialog(state); } }; @@ -297,6 +388,8 @@ class ChartEditorDialogHandler Cursor.cursorMode = Default; } + var instId:String = state.currentInstrumentalId; + var onDropFile:String->Void; instrumentalBox.onClick = function(_event) { @@ -304,14 +397,14 @@ class ChartEditorDialogHandler {label: 'Audio File (.ogg)', extension: 'ogg'}], function(selectedFile:SelectedFileInfo) { if (selectedFile != null && selectedFile.bytes != null) { - if (ChartEditorAudioHandler.loadInstrumentalFromBytes(state, selectedFile.bytes)) + if (ChartEditorAudioHandler.loadInstFromBytes(state, selectedFile.bytes, instId)) { trace('Selected file: ' + selectedFile.fullPath); #if !mac NotificationManager.instance.addNotification( { title: 'Success', - body: 'Loaded instrumental track (${selectedFile.name})', + body: 'Loaded instrumental track (${selectedFile.name}) for variation (${state.selectedVariation})', type: NotificationType.Success, expiryMs: ChartEditorState.NOTIFICATION_DISMISS_TIME }); @@ -328,7 +421,7 @@ class ChartEditorDialogHandler NotificationManager.instance.addNotification( { title: 'Failure', - body: 'Failed to load instrumental track (${selectedFile.name})', + body: 'Failed to load instrumental track (${selectedFile.name}) for variation (${state.selectedVariation})', type: NotificationType.Error, expiryMs: ChartEditorState.NOTIFICATION_DISMISS_TIME }); @@ -341,14 +434,14 @@ class ChartEditorDialogHandler onDropFile = function(pathStr:String) { var path:Path = new Path(pathStr); trace('Dropped file (${path})'); - if (ChartEditorAudioHandler.loadInstrumentalFromPath(state, path)) + if (ChartEditorAudioHandler.loadInstFromPath(state, path, instId)) { // Tell the user the load was successful. #if !mac NotificationManager.instance.addNotification( { title: 'Success', - body: 'Loaded instrumental track (${path.file}.${path.ext})', + body: 'Loaded instrumental track (${path.file}.${path.ext}) for variation (${state.selectedVariation})', type: NotificationType.Success, expiryMs: ChartEditorState.NOTIFICATION_DISMISS_TIME }); @@ -365,7 +458,7 @@ class ChartEditorDialogHandler } else { - 'Failed to load instrumental track (${path.file}.${path.ext})'; + 'Failed to load instrumental track (${path.file}.${path.ext}) for variation (${state.selectedVariation})'; } // Tell the user the load was successful. @@ -452,11 +545,20 @@ class ChartEditorDialogHandler * @return The dialog to open. */ @:haxe.warning("-WVarInit") - public static function openSongMetadataDialog(state:ChartEditorState):Dialog + public static function openSongMetadataDialog(state:ChartEditorState, ?targetVariation:String):Dialog { + if (targetVariation == null) targetVariation = Constants.DEFAULT_VARIATION; + var dialog:Null = openDialog(state, CHART_EDITOR_DIALOG_SONG_METADATA_LAYOUT, true, false); if (dialog == null) throw 'Could not locate Song Metadata dialog'; + var dialogContainer:Null = dialog.findComponent('metadataDialog', Dialog); + if (dialogContainer == null) throw 'Could not locate metadataDialog in Song Metadata dialog'; + if (targetVariation != Constants.DEFAULT_VARIATION) + { + dialogContainer.title = 'New Chart - Provide Song Metadata (${targetVariation.toTitleCase()})'; + } + var buttonCancel:Null