int hmn_new_channel_extras(struct channel_data *xc) { xc->extra = calloc(1, sizeof(struct hmn_channel_extras)); if (xc->extra == NULL) return -1; HMN_CHANNEL_EXTRAS((*xc))->magic = HMN_EXTRAS_MAGIC; return 0; }
int extras_get_volume(struct context_data *ctx, struct channel_data *xc) { struct module_data *m = &ctx->m; int vol; if (xc->ins >= m->mod.ins) vol = xc->volume; else if (HAS_MED_INSTRUMENT_EXTRAS(m->mod.xxi[xc->ins])) vol = MED_CHANNEL_EXTRAS(*xc)->volume * xc->volume / 64; else if (HAS_HMN_INSTRUMENT_EXTRAS(m->mod.xxi[xc->ins])) vol = HMN_CHANNEL_EXTRAS(*xc)->volume * xc->volume / 64; else vol = xc->volume; return vol; }