-
Notifications
You must be signed in to change notification settings - Fork 69
adding "Detect Files" button to Audio settings page #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
adding "Detect Files" button to Audio settings page #112
Conversation
|
|
||
| public void GetInstrumentAudioByFileNames() | ||
| { | ||
| // TODO: there HAS to be a way to just detect the current folder, right??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could get the path of the currently loaded chart file from ChartEditor.Instance.lastLoadedFile (a getter will need to be written to make this public)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the information! added in commit fd986a3:

| default: | ||
| // would like to use a switch expression, but since this enum is non-nullable, | ||
| // gotta use a continue to skip unwanted files | ||
| continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better to have a list of the files that were skipped over, and then communicated to the user of which files were invalid and what the correct filenames should be (can send a message via ChartEditor.Instance.errorManager.QueueErrorMessage)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good suggestion, added in commit 61218e5
@FireFox2000000 are there any other filenames that should be considered non-error-worthy, but not be tied to an instrument? e.g. i know "preview.ogg" is used for separate song preview audio files in Clone Hero
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I'm aware of.
| StartCoroutine(_RefreshAllAudioStreams()); | ||
| } | ||
|
|
||
| public void GetInstrumentAudioByFileNames() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function name should be more specific, would suggest something like "LoadCloneHeroAudioFromDirectory" as the list of audio files are CH-specific.
| /// <summary> | ||
| /// null value indicates a valid filename that doesn't tie to a specific instrument (e.g. the song preview) | ||
| /// </summary> | ||
| static readonly Dictionary<string, Song.AudioInstrument?> validFilenames = new Dictionary<string, Song.AudioInstrument?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs more specific naming, as this list of audio files is specific to Rock Band/Clone Hero. Regular guitar hero custom songs are not specific to these audio names.
| m_HorizontalOverflow: 0 | ||
| m_VerticalOverflow: 0 | ||
| m_LineSpacing: 1 | ||
| m_Text: Detect Files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to "Auto-Detect Clone Hero Files", needs to be specific about the target game.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FireFox2000000 it seems that the image for the button isn't wide enough to fit that all on one line:

would you be ok with the text being "Auto-Detect CH Files"? if i shrink the font to 12, it fits on one line:

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be moved so that it's above the first "Load" and "X" buttons, as this really shouldn't be in line with the General/Audio/Advanced tabs in any case.
| m_Script: {fileID: 11500000, guid: 635727e25c735994fb6f858716ba8247, type: 3} | ||
| m_Name: | ||
| m_EditorClassIdentifier: | ||
| message: Detects audio files from selected folder based on their filenames |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message needs updating as it does not completely reflect the current behaviour after changes.
| if (instrument.HasValue) | ||
| { | ||
| LoadInstrumentAudioFromPath(instrument.Value, filePath); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self, add comment here explaining that the lack of else is a purposeful ignore (see validRBCloneHeroFilenames summary)
|
Code side looks good, will need to pull down the branch and evaluate the layout next. |
|
Bug found- Auto-detect CH Audio fails to load audio when user is prompted to select a folder via file explorer.
Fix requested |
|
Bug found- Multiple assert failures are logged when attempting to use the "Auto-Detect CH Files" button.
Fix requested. |
| var currentDir = ChartEditor.Instance.lastLoadedFile; | ||
| if (string.IsNullOrWhiteSpace(currentDir)) | ||
| { | ||
| FileExplorer.OpenFolderPanel(out currentDir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to handle the case of the user cancelling the open folder panel prompt. This should early return upon FileExplorer.OpenFolderPanel returning false.
Prompts the user for a directory (would prefer if this could be auto-detected)Auto-detects the directory of the currently opened chart and automatically assigns files within that directory to the instrument associated iwth their name