use a MixerVoice constructor
This commit is contained in:
parent
1ec4faee55
commit
2c55b40a53
@ -50,10 +50,11 @@
|
||||
//|
|
||||
// TODO: support mono or stereo voices
|
||||
STATIC mp_obj_t audioio_mixervoice_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
audioio_mixervoice_obj_t *self = m_new_obj(audioio_mixervoice_obj_t);
|
||||
audioio_mixervoice_obj_t *self = m_new_obj(audioio_mixervoice_obj_t);
|
||||
self->base.type = &audioio_mixervoice_type;
|
||||
self->sample = NULL;
|
||||
self->level = ((1 << 15)-1);
|
||||
|
||||
common_hal_audioio_mixervoice_construct(self);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
extern const mp_obj_type_t audioio_mixer_type;
|
||||
extern const mp_obj_type_t audioio_mixervoice_type;
|
||||
|
||||
void common_hal_audioio_mixervoice_construct(audioio_mixervoice_obj_t *self);
|
||||
void common_hal_audioio_mixervoice_set_parent(audioio_mixervoice_obj_t* self, audioio_mixer_obj_t *parent);
|
||||
void common_hal_audioio_mixervoice_play(audioio_mixervoice_obj_t* self, mp_obj_t sample, bool loop);
|
||||
void common_hal_audioio_mixervoice_stop(audioio_mixervoice_obj_t* self);
|
||||
|
@ -32,6 +32,11 @@
|
||||
#include "shared-module/audiocore/RawSample.h"
|
||||
#include "shared-module/audiocore/MixerVoice.h"
|
||||
|
||||
void common_hal_audioio_mixervoice_construct(audioio_mixervoice_obj_t *self) {
|
||||
self->sample = NULL;
|
||||
self->level = ((1 << 15) - 1);
|
||||
}
|
||||
|
||||
void common_hal_audioio_mixervoice_set_parent(audioio_mixervoice_obj_t* self, audioio_mixer_obj_t *parent) {
|
||||
self->parent = parent;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user