audioio: By default, be compatible with 4.x
Testing performed: That the shipped .mpy files on a PyPortal (CP 4.x) still work (play audio) with this branch, instead of erroring because `WaveFile` can't be found in `audioio`. Flash usage grew by 28 bytes. (I expected 24, there must be some other effect on size/alignment that I didn't predict)
This commit is contained in:
parent
85d7398476
commit
47d6dd843e
@ -74,6 +74,12 @@ CIRCUITPY_AUDIOIO = $(CIRCUITPY_FULL_BUILD)
|
||||
endif
|
||||
CFLAGS += -DCIRCUITPY_AUDIOIO=$(CIRCUITPY_AUDIOIO)
|
||||
|
||||
ifndef CIRCUITPY_AUDIOIO_COMPAT
|
||||
CIRCUITPY_AUDIOIO_COMPAT = $(CIRCUITPY_AUDIOIO)
|
||||
endif
|
||||
CFLAGS += -DCIRCUITPY_AUDIOIO_COMPAT=$(CIRCUITPY_AUDIOIO_COMPAT)
|
||||
|
||||
|
||||
ifndef CIRCUITPY_AUDIOPWMIO
|
||||
CIRCUITPY_AUDIOPWMIO = 0
|
||||
endif
|
||||
|
@ -33,6 +33,12 @@
|
||||
#include "shared-bindings/audioio/__init__.h"
|
||||
#include "shared-bindings/audioio/AudioOut.h"
|
||||
|
||||
#ifdef CIRCUITPY_AUDIOIO_COMPAT
|
||||
#include "shared-bindings/audiocore/Mixer.h"
|
||||
#include "shared-bindings/audiocore/RawSample.h"
|
||||
#include "shared-bindings/audiocore/WaveFile.h"
|
||||
#endif
|
||||
|
||||
//| :mod:`audioio` --- Support for audio input and output
|
||||
//| ======================================================
|
||||
//|
|
||||
@ -57,10 +63,19 @@
|
||||
//| Since CircuitPython 5, `Mixer`, `RawSample` and `WaveFile` are moved
|
||||
//| to :mod:`audiocore`.
|
||||
//|
|
||||
//| For compatibility with CircuitPython 4.x, some builds allow the items in
|
||||
//| `audiocore` to be imported from `audioio`. This will be removed for all
|
||||
//| boards in a future build of CicuitPython.
|
||||
//|
|
||||
|
||||
STATIC const mp_rom_map_elem_t audioio_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audioio) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AudioOut), MP_ROM_PTR(&audioio_audioout_type) },
|
||||
#ifdef CIRCUITPY_AUDIOIO_COMPAT
|
||||
{ MP_ROM_QSTR(MP_QSTR_Mixer), MP_ROM_PTR(&audioio_mixer_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RawSample), MP_ROM_PTR(&audioio_rawsample_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_WaveFile), MP_ROM_PTR(&audioio_wavefile_type) },
|
||||
#endif
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(audioio_module_globals, audioio_module_globals_table);
|
||||
|
Loading…
Reference in New Issue
Block a user