#ifndef MOSSROSE_CHANNEL_H #define MOSSROSE_CHANNEL_H #include #include #include #include struct channel_shared_t { volatile pint active; /* boolean */ volatile pint paused; /* boolean */ volatile pint volume; /* 0-255 */ volatile pint pan_left; /* -255-255 */ volatile pint pan_right; /* -255-255 */ volatile pint loops; }; struct channel_t { struct channel_shared_t shared; bool skip; float gain_ll, gain_lr; float gain_rl, gain_rr; PMutex *sound_mutex; struct mossrose_sound_t sound; size_t pos; }; void channel_init(struct channel_t *chan); void channel_reset(struct channel_t *chan); void channel_pause(struct channel_t *chan); void channel_resume(struct channel_t *chan); void channel_set_volume(struct channel_t *chan, float volume); void channel_set_pan(struct channel_t *chan, float pan_left, float pan_right); int channel_sound_load(struct channel_t *chan, struct mossrose_sound_t *sound, bool force, int loops); void channel_get_next_sample(float *left, float *right, struct channel_t *chan); #endif