|
| 1 | +// This file is part of the CircuitPython project: https://circuitpython.org |
| 2 | +// |
| 3 | +// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple |
| 4 | +// |
| 5 | +// SPDX-License-Identifier: MIT |
| 6 | + |
| 7 | +#include "py/enum.h" |
| 8 | + |
| 9 | +#include "shared-bindings/audiofilters/DistortionMode.h" |
| 10 | + |
| 11 | +MAKE_ENUM_VALUE(audiofilters_distortion_mode_type, distortion_mode, CLIP, DISTORTION_MODE_CLIP); |
| 12 | +MAKE_ENUM_VALUE(audiofilters_distortion_mode_type, distortion_mode, ATAN, DISTORTION_MODE_ATAN); |
| 13 | +MAKE_ENUM_VALUE(audiofilters_distortion_mode_type, distortion_mode, LOFI, DISTORTION_MODE_LOFI); |
| 14 | +MAKE_ENUM_VALUE(audiofilters_distortion_mode_type, distortion_mode, OVERDRIVE, DISTORTION_MODE_OVERDRIVE); |
| 15 | +MAKE_ENUM_VALUE(audiofilters_distortion_mode_type, distortion_mode, WAVESHAPE, DISTORTION_MODE_WAVESHAPE); |
| 16 | + |
| 17 | +//| class DistortionMode: |
| 18 | +//| """The method of distortion used by the `audiofilters.Distortion` effect.""" |
| 19 | +//| |
| 20 | +//| CLIP: DistortionMode |
| 21 | +//| """Digital distortion effect which cuts off peaks at the top and bottom of the waveform.""" |
| 22 | +//| |
| 23 | +//| ATAN: DistortionMode |
| 24 | +//| """""" |
| 25 | +//| |
| 26 | +//| LOFI: DistortionMode |
| 27 | +//| """Low-resolution digital distortion effect (bit depth reduction). You can use it to emulate the sound of early digital audio devices.""" |
| 28 | +//| |
| 29 | +//| OVERDRIVE: DistortionMode |
| 30 | +//| """Emulates the warm distortion produced by a field effect transistor, which is commonly used in solid-state musical instrument amplifiers. The `audiofilters.Distortion.drive` property has no effect in this mode.""" |
| 31 | +//| |
| 32 | +//| WAVESHAPE: DistortionMode |
| 33 | +//| """Waveshaper distortions are used mainly by electronic musicians to achieve an extra-abrasive sound.""" |
| 34 | +//| |
| 35 | +MAKE_ENUM_MAP(audiofilters_distortion_mode) { |
| 36 | + MAKE_ENUM_MAP_ENTRY(distortion_mode, CLIP), |
| 37 | + MAKE_ENUM_MAP_ENTRY(distortion_mode, ATAN), |
| 38 | + MAKE_ENUM_MAP_ENTRY(distortion_mode, LOFI), |
| 39 | + MAKE_ENUM_MAP_ENTRY(distortion_mode, OVERDRIVE), |
| 40 | + MAKE_ENUM_MAP_ENTRY(distortion_mode, WAVESHAPE), |
| 41 | +}; |
| 42 | +static MP_DEFINE_CONST_DICT(audiofilters_distortion_mode_locals_dict, audiofilters_distortion_mode_locals_table); |
| 43 | + |
| 44 | +MAKE_PRINTER(audiofilters, audiofilters_distortion_mode); |
| 45 | + |
| 46 | +MAKE_ENUM_TYPE(audiofilters, DistortionMode, audiofilters_distortion_mode); |
| 47 | + |
| 48 | +audiofilters_distortion_mode_t validate_distortion_mode(mp_obj_t obj, qstr arg_name) { |
| 49 | + return cp_enum_value(&audiofilters_distortion_mode_type, obj, arg_name); |
| 50 | +} |
0 commit comments