Skip to content

Commit a851f10

Browse files
committed
Error message for sample note matching made consistent
1 parent 98b360a commit a851f10

File tree

3 files changed

+18
-38
lines changed

3 files changed

+18
-38
lines changed

locale/circuitpython.pot

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,36 +1956,20 @@ msgstr ""
19561956
msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30"
19571957
msgstr ""
19581958

1959-
#: shared-module/audioeffects/Echo.c
1960-
msgid "The sample's bits_per_sample does not match the effect's"
1959+
#: shared-module/audiodelays/Echo.c shared-module/audiomixer/MixerVoice.c
1960+
msgid "The sample's bits_per_sample does not match"
19611961
msgstr ""
19621962

1963-
#: shared-module/audiomixer/MixerVoice.c
1964-
msgid "The sample's bits_per_sample does not match the mixer's"
1963+
#: shared-module/audiodelays/Echo.c shared-module/audiomixer/MixerVoice.c
1964+
msgid "The sample's channel count does not match"
19651965
msgstr ""
19661966

1967-
#: shared-module/audioeffects/Echo.c
1968-
msgid "The sample's channel count does not match the effect's"
1967+
#: shared-module/audiodelays/Echo.c shared-module/audiomixer/MixerVoice.c
1968+
msgid "The sample's sample rate does not match"
19691969
msgstr ""
19701970

1971-
#: shared-module/audiomixer/MixerVoice.c
1972-
msgid "The sample's channel count does not match the mixer's"
1973-
msgstr ""
1974-
1975-
#: shared-module/audioeffects/Echo.c
1976-
msgid "The sample's sample rate does not match the effect's"
1977-
msgstr ""
1978-
1979-
#: shared-module/audiomixer/MixerVoice.c
1980-
msgid "The sample's sample rate does not match the mixer's"
1981-
msgstr ""
1982-
1983-
#: shared-module/audioeffects/Echo.c
1984-
msgid "The sample's signedness does not match the effect's"
1985-
msgstr ""
1986-
1987-
#: shared-module/audiomixer/MixerVoice.c
1988-
msgid "The sample's signedness does not match the mixer's"
1971+
#: shared-module/audiodelays/Echo.c shared-module/audiomixer/MixerVoice.c
1972+
msgid "The sample's signedness does not match"
19891973
msgstr ""
19901974

19911975
#: supervisor/shared/safe_mode.c
@@ -2516,7 +2500,7 @@ msgstr ""
25162500
msgid "bits must be 32 or less"
25172501
msgstr ""
25182502

2519-
#: shared-bindings/audioeffects/Echo.c shared-bindings/audiomixer/Mixer.c
2503+
#: shared-bindings/audiodelays/Echo.c shared-bindings/audiomixer/Mixer.c
25202504
msgid "bits_per_sample must be 8 or 16"
25212505
msgstr ""
25222506

@@ -2863,10 +2847,6 @@ msgstr ""
28632847
msgid "data type not understood"
28642848
msgstr ""
28652849

2866-
#: shared-bindings/audioeffects/Echo.c
2867-
msgid "decay must be between 0 and 1"
2868-
msgstr ""
2869-
28702850
#: py/parsenum.c
28712851
msgid "decimal numbers not supported"
28722852
msgstr ""

shared-module/audiodelays/Echo.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,21 +154,21 @@ bool common_hal_audiodelays_echo_get_playing(audiodelays_echo_obj_t *self) {
154154

155155
void common_hal_audiodelays_echo_play(audiodelays_echo_obj_t *self, mp_obj_t sample, bool loop) {
156156
if (audiosample_sample_rate(sample) != self->sample_rate) {
157-
mp_raise_ValueError(MP_ERROR_TEXT("The sample's sample rate does not match the effect's"));
157+
mp_raise_ValueError(MP_ERROR_TEXT("The sample's sample rate does not match"));
158158
}
159159
if (audiosample_channel_count(sample) != self->channel_count) {
160-
mp_raise_ValueError(MP_ERROR_TEXT("The sample's channel count does not match the effect's"));
160+
mp_raise_ValueError(MP_ERROR_TEXT("The sample's channel count does not match"));
161161
}
162162
if (audiosample_bits_per_sample(sample) != self->bits_per_sample) {
163-
mp_raise_ValueError(MP_ERROR_TEXT("The sample's bits_per_sample does not match the effect's"));
163+
mp_raise_ValueError(MP_ERROR_TEXT("The sample's bits_per_sample does not match"));
164164
}
165165
bool single_buffer;
166166
bool samples_signed;
167167
uint32_t max_buffer_length;
168168
uint8_t spacing;
169169
audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed, &max_buffer_length, &spacing);
170170
if (samples_signed != self->samples_signed) {
171-
mp_raise_ValueError(MP_ERROR_TEXT("The sample's signedness does not match the effect's"));
171+
mp_raise_ValueError(MP_ERROR_TEXT("The sample's signedness does not match"));
172172
}
173173
self->sample = sample;
174174
self->loop = loop;
@@ -190,7 +190,7 @@ void common_hal_audiodelays_echo_stop(audiodelays_echo_obj_t *self) {
190190
#define RANGE_LOW (-28000)
191191
#define RANGE_HIGH (28000)
192192
#define RANGE_SHIFT (16)
193-
#define RANGE_SCALE (0xfffffff / (32768 * 2 - RANGE_HIGH))
193+
#define RANGE_SCALE (0xfffffff / (32768 * 4 - RANGE_HIGH))
194194

195195
// dynamic range compression via a downward compressor with hard knee
196196
//

shared-module/audiomixer/MixerVoice.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ void common_hal_audiomixer_mixervoice_set_level(audiomixer_mixervoice_obj_t *sel
3232

3333
void common_hal_audiomixer_mixervoice_play(audiomixer_mixervoice_obj_t *self, mp_obj_t sample, bool loop) {
3434
if (audiosample_sample_rate(sample) != self->parent->sample_rate) {
35-
mp_raise_ValueError(MP_ERROR_TEXT("The sample's sample rate does not match the mixer's"));
35+
mp_raise_ValueError(MP_ERROR_TEXT("The sample's sample rate does not match"));
3636
}
3737
if (audiosample_channel_count(sample) != self->parent->channel_count) {
38-
mp_raise_ValueError(MP_ERROR_TEXT("The sample's channel count does not match the mixer's"));
38+
mp_raise_ValueError(MP_ERROR_TEXT("The sample's channel count does not match"));
3939
}
4040
if (audiosample_bits_per_sample(sample) != self->parent->bits_per_sample) {
41-
mp_raise_ValueError(MP_ERROR_TEXT("The sample's bits_per_sample does not match the mixer's"));
41+
mp_raise_ValueError(MP_ERROR_TEXT("The sample's bits_per_sample does not match"));
4242
}
4343
bool single_buffer;
4444
bool samples_signed;
@@ -47,7 +47,7 @@ void common_hal_audiomixer_mixervoice_play(audiomixer_mixervoice_obj_t *self, mp
4747
audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed,
4848
&max_buffer_length, &spacing);
4949
if (samples_signed != self->parent->samples_signed) {
50-
mp_raise_ValueError(MP_ERROR_TEXT("The sample's signedness does not match the mixer's"));
50+
mp_raise_ValueError(MP_ERROR_TEXT("The sample's signedness does not match"));
5151
}
5252
self->sample = sample;
5353
self->loop = loop;

0 commit comments

Comments
 (0)