Skip to content

Commit d42941d

Browse files
Chris Nourseclaude
andcommitted
ports/stm: use mp_arg_validate_int_min for audioio sample_rate floor
Replace the custom "sample_rate must be > 0" raise with the standard mp_arg_validate_int_min helper, matching the existing _int_max call on the next line. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent cd142d5 commit d42941d

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

ports/stm/common-hal/audioio/AudioOut.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,7 @@ void common_hal_audioio_audioout_play(audioio_audioout_obj_t *self,
458458
self->samples_signed = base->samples_signed;
459459
self->channel_count = audiosample_get_channel_count(base);
460460
uint32_t sample_rate = audiosample_get_sample_rate(base);
461-
if (sample_rate == 0) {
462-
mp_raise_ValueError(MP_ERROR_TEXT("sample_rate must be > 0"));
463-
}
461+
mp_arg_validate_int_min(sample_rate, 1, MP_QSTR_sample_rate);
464462
mp_arg_validate_int_max(sample_rate, AUDIOOUT_MAX_SAMPLE_RATE, MP_QSTR_sample_rate);
465463

466464
self->sample = sample;

0 commit comments

Comments
 (0)