From de5a9d72dcdaacdd5048195cd5bab007f4b2baef Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 15 Aug 2018 18:32:37 -0700 Subject: Compress all translated strings with Huffman coding. This saves code space in builds which use link-time optimization. The optimization drops the untranslated strings and replaces them with a compressed_string_t struct. It can then be decompressed to a c string. Builds without LTO work as well but include both untranslated strings and compressed strings. This work could be expanded to include QSTRs and loaded strings if a compress method is added to C. Its tracked in #531. --- shared-module/audioio/WaveFile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'shared-module/audioio') diff --git a/shared-module/audioio/WaveFile.c b/shared-module/audioio/WaveFile.c index ce5877629..7efad05e0 100644 --- a/shared-module/audioio/WaveFile.c +++ b/shared-module/audioio/WaveFile.c @@ -84,7 +84,7 @@ void common_hal_audioio_wavefile_construct(audioio_wavefile_obj_t* self, } // Get the sample_rate self->sample_rate = format.sample_rate; - self->len = 512; + self->len = 256; self->channel_count = format.num_channels; self->bits_per_sample = format.bits_per_sample; @@ -114,13 +114,13 @@ void common_hal_audioio_wavefile_construct(audioio_wavefile_obj_t* self, self->buffer = m_malloc(self->len, false); if (self->buffer == NULL) { common_hal_audioio_wavefile_deinit(self); - mp_raise_msg(&mp_type_MemoryError, ""); + mp_raise_msg(&mp_type_MemoryError, translate("Couldn't allocate first buffer")); } self->second_buffer = m_malloc(self->len, false); if (self->second_buffer == NULL) { common_hal_audioio_wavefile_deinit(self); - mp_raise_msg(&mp_type_MemoryError, ""); + mp_raise_msg(&mp_type_MemoryError, translate("Couldn't allocate second buffer")); } } -- cgit v1.2.3