Exemplo n.º 1
0
bool fade_audio_render(void *data, uint64_t *ts_out,
                       struct obs_source_audio_mix *audio, uint32_t mixers,
                       size_t channels, size_t sample_rate)
{
    struct fade_info *fade = data;
    return obs_transition_audio_render(fade->source, ts_out,
                                       audio, mixers, channels, sample_rate, mix_a, mix_b);
}
Exemplo n.º 2
0
static bool stinger_audio_render(void *data, uint64_t *ts_out,
		struct obs_source_audio_mix *audio, uint32_t mixers,
		size_t channels, size_t sample_rate)
{
	struct stinger_info *s = data;
	uint64_t ts = 0;

	if (!obs_source_audio_pending(s->media_source)) {
		ts = obs_source_get_audio_timestamp(s->media_source);
		if (!ts)
			return false;
	}

	bool success = obs_transition_audio_render(s->source, ts_out,
		audio, mixers, channels, sample_rate, s->mix_a, s->mix_b);
	if (!ts)
		return success;

	if (!*ts_out || ts < *ts_out)
		*ts_out = ts;

	struct obs_source_audio_mix child_audio;
	obs_source_get_audio_mix(s->media_source, &child_audio);

	for (size_t mix = 0; mix < MAX_AUDIO_MIXES; mix++) {
		if ((mixers & (1 << mix)) == 0)
			continue;

		for (size_t ch = 0; ch < channels; ch++) {
			register float *out = audio->output[mix].data[ch];
			register float *in = child_audio.output[mix].data[ch];
			register float *end = in + AUDIO_OUTPUT_FRAMES;

			while (in < end)
				*(out++) += *(in++);
		}
	}

	return true;
}