diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2018-08-15 18:32:37 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2018-08-16 17:40:57 -0700 |
| commit | de5a9d72dcdaacdd5048195cd5bab007f4b2baef (patch) | |
| tree | b492d69b40dfe9db5dcc703e38d27e49e06707ae /shared-module/audioio | |
| parent | 92ed5d7bf223212e8db04af3f6712770ec2c86ea (diff) | |
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.
Diffstat (limited to 'shared-module/audioio')
| -rw-r--r-- | shared-module/audioio/WaveFile.c | 6 |
1 files changed, 3 insertions, 3 deletions
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")); } } |
