Tracktion / tracktion_engine

Tracktion Engine module
Other
1.2k stars 152 forks source link

AudioFileFormatManager isn't flexible and doesn't follow the audio format config rules. #39

Closed jrlanglois closed 3 years ago

jrlanglois commented 3 years ago

I noticed a bunch of things when wanting to add my own audio formats into an instance of this class:

The annoying part is that this class is integrated into the Engine, albeit with limited impact... I could avoid using it altogether but then why bother with adding an instance of AudioFileFormatManager to the Engine in the first place?

jrlanglois commented 3 years ago

Ok, so this is getting interesting: the codebase appears to use FloatAudioFormat (ie: the frozen file format, getFrozenFileFormat) for rendering tracks in different circumstances... so I guess that bit can be ignored. Although, I'm thinking it would still be invalid to add the float format to the readFormatManager.

As for a different observation: I could avoid getValidFileExtensions if I had access to readFormats (which is odd that it's not available because getWriteFormats is!), and string together calls to getFileExtensions of all of these formats... but then why wouldn't getValidFileExtensions just do that?

jrlanglois commented 3 years ago

Another finding: WaveInputDevice::getRecordFormatNames() should be updated to allow customisation by the user. (and also, it just assumes presence of FLAC, and weirdly ignores OGG, MP3, any other format...)

jrlanglois commented 3 years ago

Ok, so the list goes on and on: lots of dependencies on OGG, FLAC, MP3/LAME, REX (eg: TargetFileFormat, ProjectItem::getSourceFile()).

Looks like plenty of APIs require all of this, even though I won't use any of it explicitly. I'd be content with AIFF as a fallback overall... not sure why it's overlooked in the renderers and tests.

Also, I guess this means I can't render with my own codecs...