static void sound_command_handler(Multisense_Data *msdata) { RemixCount length; Edje_Multisense_Sound_Action command; RemixBase *base = NULL; RemixBase *sound; if (read(command_pipe[0], &command, sizeof(command)) <= 0) return; switch (command.action) { case EDJE_PLAY_SAMPLE: base = edje_remix_sample_create(msdata, command.ed, &command.type.sample); length = remix_length(msdata->msenv->remixenv, base); break; case EDJE_PLAY_TONE: base = edje_remix_tone_create(msdata, command.ed, &command.type.tone); length = (command.type.tone.duration * remix_get_samplerate(msdata->msenv->remixenv)); break; default: ERR("Invalid Sound Play Command\n"); break; } if (base) { sound = remix_sound_new(msdata->msenv->remixenv, base, msdata->snd_layer, REMIX_SAMPLES(msdata->offset), REMIX_SAMPLES(length)); if (msdata->remaining < length) msdata->remaining = length; msdata->snd_src_list = eina_list_append(msdata->snd_src_list, sound); msdata->snd_src_list = eina_list_append(msdata->snd_src_list, base); } }
static RemixCount remix_gain_length (RemixEnv * env, RemixBase * base) { RemixBase * gain_envelope = (RemixBase *) (remix_get_parameter (env, base, GAIN_ENVELOPE_KEY)).s_pointer; if (gain_envelope == RemixNone) { return REMIX_COUNT_INFINITE; } return remix_length (env, gain_envelope); }
static RemixCount remix_track_length (RemixEnv * env, RemixBase * base) { RemixTrack * track = (RemixTrack *)base; RemixCount length, maxlength = 0; CDList * l; RemixLayer * layer; for (l = track->layers; l; l = l->next) { layer = (RemixLayer *)l->data.s_pointer; length = remix_length (env, (RemixBase *)layer); remix_dprintf ("[remix_track_length] found layer %p length %ld\n", layer, length); maxlength = MAX (maxlength, length); } return maxlength; }