Merge pull request #100559 from DeeJayLSP/save-wav-vector

Reduce memory overhead of `save_to_wav`
This commit is contained in:
Thaddeus Crews 2025-06-02 18:51:48 -05:00
commit 424b0c0fcc
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC

View file

@ -576,8 +576,7 @@ Error AudioStreamWAV::save_to_wav(const String &p_path) {
file->store_32(sub_chunk_2_size); //Subchunk2Size
// Add data
Vector<uint8_t> stream_data = get_data();
const uint8_t *read_data = stream_data.ptr();
const uint8_t *read_data = data.ptr();
switch (format) {
case AudioStreamWAV::FORMAT_8_BITS:
for (unsigned int i = 0; i < data_bytes; i++) {