lostromb / concentus.oggfile

Implementing support for reading/writing .opus audio files using Concentus
Other
33 stars 17 forks source link

ShortsToBytes methods can be changed into smaller code #12

Open StefH opened 5 years ago

StefH commented 5 years ago

Just use:

short[] packets = opus.DecodeNextPacket();
byte[] buffer = new byte[packets.Length * 2];
Buffer.BlockCopy(packets, 0, buffer, 0, buffer.Length);
lostromb commented 5 years ago

Yeah, technically true. My only worry is if the endianness of the machine would affect the results, since the resulting byte array must be little-endian after the copy (that is to say, the 8-bit array must be the same as a list of 16-bit little endian values)