openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
760 stars 375 forks source link

Add AudioBufferDataFormat #1861

Open ACrazyTown opened 1 week ago

ACrazyTown commented 1 week ago

Currently it's not possible to determine what format AudioBuffer.data is stored in. This makes it difficult to figure out if a WAV file is stored in a 32bit int or 32bit float format for example. This pull request adds a dataFormat enum that specifies the format of the audio data.

When parsing WAV files, it reads the AudioFormat data in the header. When parsing OGG/Vorbis, the value is hardcoded to 1 (PCM) as lime decodes OGG files into 16bit PCM data.