Thursday, October 29, 2020

When MATLAB says "too many output arguments" after newly declaring one

I recently adjusted a MATLAB function in an existing codebase to add a new optional output argument. I was confused to see that trying to invoke it with the new argument failed with "too many output arguments." (I did save the file! And tried restarting MATLAB.) The problem was that the function was also declared in a class file, which I hadn't modified. Updating that declaration to match the implementation file fixed the problem. I imagine this also applies to "too many input arguments."

Tuesday, October 27, 2020

FMod - Minor audio bug fixes

Tonight I got some Abiathar audio improvements packaged into a beta release for the person who requested them. Along the way I found a couple minor other bugs. Previously the music mapping patches would be generated if audio files were linked regardless of whether Song Mappings had been used, leading to a zero-length song list being patched. Audio export apparently (probably as of v2.11.2) wrote zero-byte IMF files for empty chunks in the IMF range. This is fixed now so that empty chunks are always properly skipped.

Monday, October 26, 2020

FMod - Automatic audio chunk boundary adjustment

Today I spent a little time continuing improvement of Abiathar's audio import process. It now checks whether the chunk ID regions used by each type of sound are compatible with the archive layout that the project is configured to use for export. If not, it offers to adjust the project configuration to be consistent with the added chunks. The adjustment code is fiddly since I'm trying to avoid shifting the "original" IMF start chunk when possible so that Music Mappings doesn't break unnecessarily.

Sunday, October 25, 2020

FMod - Relaxing audio assumptions

FleexCore2's GalaxyAudio class used to require the layout of the audio archive to be provided in a chunk settings object. As of v2.11.2, only the ImfEnd field is used, since chunks will only be encoded or decoded when needed but the total number of chunks must be specified to save the archive. Abiathar still populated the chunk settings directly from its project's audio settings block, which assumes that an IMF region will exist and will be at the end of the audio archive. As part of the audio IO improvements started yesterday I relaxed some assumptions in this area. There might not be any IMF songs, so the maximum chunk ID given to FleexCore2 is now computed as the maximum of the last chunk ID of each of the three audio chunk ranges.

FMod - Starting audio IO improvements

A PCKF member is working on a mod with several extra sounds and often needs to adjust Abiathar's audio archive layout settings. This is somewhat difficult to do - it requires editing the project file manually. I don't have time for a major overhaul of Abiathar's audio support or for the addition of a fancy UI, but I have a couple ideas for useful improvements. Tonight I added a + directive to the ASNDS format that can be used in place of a chunk ID to automatically assign the next ID, which can remove the need to manually renumber everything after inserting a chunk. There's also now a BLANK directive to skip a chunk and advance to the next ID.

Friday, October 23, 2020

JGit's addCeilingDirectory adds an exclusive bound

A Gradle plugin I worked on uses the JGit library to check the state of the project's Git repository, if it's in one. A discrepancy in behavior between Java versions led me to investigate the FileRepositoryBuilder setup. addCeilingDirectory is supposed to set the outermost directory that will be searched by findGitDir, but due to the order in which findGitDir updates its "directory under examination" variable and checks whether the ceiling has been hit, the specified ceiling will actually not be checked. To work around this, I specified the parent directory of my intended ceiling.