Closed G4Vi closed 2 years ago
Thanks! Formatting improvements are welcome, but... can you split them into a separate commit if possible? I know it's potentially a lot to ask for, but if it was a separate commit we could use a blame.ignoreRevsFile
feature to filter those out from git blame, and thus retain the repo history better.
As for the PR, I'll look into it after I'm done with my current chunk of work on dumpsxiso. How complex do you think it'd be to add support for extracting audio tracks as FLAC?
Extracting audio as flac cross-platform is going to be a little trickier. Unfortunately miniaudio/dr_flac only provides flac decoding, not encoding. It's not too difficult to encode with libflac, but setting up libflac cross-platform can be hard (I think that's why lameguy64 abandoned flac support).
As silly as having 2 flac libraries sounds, miniaudio/dr_flac is faster than libflac for decoding, so even if libflac is added, dr_flac probably shouldn't be removed.
I'll have to fix this PR for Windows before merging, but before I do so - do you think miniaudio could be moved to a submodule, like tinyxml2 is?
miniaudio is now a submodule. It does make the clone significantly bigger, but consistency is probably more important for the source.
This PR only applies to non-DA track CDDA right now as the packing for DA tracks is completely separate. Is that okay?
I'm not sure what's the best way forward with that as for an accurate DA file size, the audio must be decoded to PCM so either we'd need keep decoded samples in ram until the CDDA of the DA track is actually written OR put in a filler value for the DA track size and seek back and set it when finally writing the samples.
Is that okay?
It forces a prompt refactor to unify those code paths, so I think so. They should be unified regardless in my opinion.
I'm not sure what's the best way forward with that as for an accurate DA file size
Does miniaudio not allow to count the amount of PCM samples in the FLAC file? This information alone should be enough to determine the end size reliably.
Does miniaudio not allow to count the amount of PCM samples in the FLAC file? This information alone should be enough to determine the end size reliably.
If it's okay to assume the FLAC's headers are correct then miniaudio can determine the length of PCM frames without decoding for FLAC, even when resampling. If the input audio is MP3 however it needs to do a full decode to determine the pcm length.
So unifying the CDDA packing here is desired?
If it's okay to assume the FLAC's headers are correct then miniaudio can determine the length of PCM frames without decoding for FLAC, even when resampling.
I'd say if the header is wrong then the user has bigger issues than a malformed output binary.
So unifying the CDDA packing here is desired?
That's what I'd preferably see, whether it's done as a part of this PR or not. There's already been plenty of code unified in this fork, I don't see why this could not be done too especially since the logic is nearly identical in both cases.
Just left one nitpick. Can you rebase it on latest, so I can then push Windows fixes, if any are needed? Then it should be good to merge I think.
I'm struggling trying to rebase the changes. A lot of the work was done on src/main.cpp not src/mkpsxiso/main.cpp. Any recommendations on how I should move forward with it?
In that case a merge from master to your branch may be easier - and it'll resolve conflicts just as well as rebasing would.
Is this all set now? I didn't think there would be windows specific changes for miniaudio, just for libflac.
There is some Windows work that needs to be done here, I'll push my changes to this PR and once we verify Linux still works as expected, I'll squash & merge.
@G4Vi I'm trying to push my changes but I don't have permissions to do so - I believe you need to enable "Allow edits from maintainers" on the PR for that.
@G4Vi I'm trying to push my changes but I don't have permissions to do so - I believe you need to enable "Allow edits from maintainers" on the PR for that. That's weird
Same changes as were in https://github.com/Lameguy64/mkpsxiso/pull/17, but adapted to use
std::filesystem::path
.I noticed there was a mix of spaces and tabs for code indentation in mkpsxiso/main.cpp, so to improve readability in some editors (github) I ran VS code's auto format (which did tabs). That can be undone or redone as spaces if needed.