Thealexbarney / VGAudio

A library for encoding, decoding, and manipulating audio files from video games.
MIT License
219 stars 37 forks source link

Removing the loop doesn't always work #119

Closed Developer-exe closed 4 years ago

Developer-exe commented 4 years ago

When converting several files, I've noticed that conversions from some file types don't allow me to use the "--no-loop" parameter to remove the loop information from the file. And if the parameter is not specified, the loop stays there even if I don't want it to.

For example, when I convert "test.hca" to "test.wav" without the use of "--no-loop" (VGAudioCli.exe -i test.hca -o test.wav), the loop information still shows up in the metadata, which might not be intentional - as far as I know, wave files don't support loops. If the loop information stays in the WAV file, it is used to create a loop during the next conversion (to HCA, for example), which makes me unable to specify I don't want the newly created file to loop.

The problem is during the conversion to WAV: when I specify "--no-loop" at the end (VGAudioCli.exe -i test.hca -o test.wav --no-loop), it throws me an error: The method or operation is not implemented.

When doing the batch conversion (VGAudioCli.exe -b -i . -o . --out-format wav --no-loop), it gives me more information about the error:

test.hca
Error converting test.hca
System.NotImplementedException: The method or operation is not implemented.
   in VGAudio.Formats.CriHca.CriHcaFormat.GetCloneBuilder()
   in VGAudio.Formats.AudioFormatBase`3.WithLoop(Boolean loop)
   in VGAudio.Formats.AudioFormatBase`3.VGAudio.Formats.IAudioFormat.WithLoop(Boolean loop)
   in VGAudio.Formats.AudioData.SetLoop(Boolean loop)
   in VGAudio.Cli.Convert.EncodeFiles(JobFiles files, Options options)
   in VGAudio.Cli.Convert.ConvertFile(Options options, JobFiles files, Boolean showProgress)
   in VGAudio.Cli.Batch.<>c__DisplayClass0_1.<BatchConvert>b__1(String inPath)
Finished
Time elapsed: 0,0524557

However, when converting using a different format, it works with no problems whatsoever. For example (VGAudioCli.exe -i test.wav -o test_no_loop.wav --no-loop):

Success!
Time elapsed: 0,0615439

When reading metadata from _test_noloop.wav, it won't contain any loop information and won't carry it to the next conversion as expected. So as of right now, the possible workaround is to convert the file to WAV first (the loop information will be preserved even without specifying it), and then convert the newly created WAV file again to WAV, but now with the "--no-loop" parameter. Once this is done, it can be converted and the loop won't be present.

I'd like to ask if there's any chance that a fix will be made. Many thanks.

Thealexbarney commented 4 years ago

This should be fixed by #120