提交 90d9a520 编写于 作者: D Danni

Updated per comments pull #90.

上级 bc542a3e
......@@ -711,6 +711,11 @@ uint32_t audio_output_samplerate(audio_t audio)
return audio ? audio->info.samples_per_sec : 0;
}
/* On some platforms, max() may already be defined */
#ifndef max
#define max(a, b) ((a) > (b) ? (a) : (b))
#endif
/* TODO: Optimization of volume multiplication functions */
static inline int mul_vol_u8bit(void *array, float volume, size_t total_num)
......@@ -798,15 +803,15 @@ static inline int mul_vol_float(void *array, float volume, size_t total_num)
for (size_t i = 0; i < total_num; i++) {
vals[i] *= volume;
maxVol = max(maxVol, (float)fabs(vals[i]));
maxVol = fmaxf(maxVol, (float)fabs(vals[i]));
}
return (int)(maxVol * 10000.f);
}
// [Danni] changed to int for volume feedback. Seems like the most logical
// place to calculate this to avoid unnessisary iterations.
// scaled to max of 10000.
/* [Danni] changed to int for volume feedback. Seems like the most logical
place to calculate this to avoid unnessisary iterations.
scaled to max of 10000. */
static int audio_line_place_data_pos(struct audio_line *line,
const struct audio_data *data, size_t position)
......
......@@ -29,8 +29,6 @@
#include "obs.h"
#include "obs-internal.h"
static inline bool source_valid(struct obs_source *source)
{
return source && source->context.data;
......@@ -82,7 +80,7 @@ static const char *source_signals[] = {
"void show(ptr source)",
"void hide(ptr source)",
"void volume(ptr source, in out float volume)",
"void volumelevel(ptr source, in out float volume)",
"void volumelevel(ptr source, in out int volume)",
NULL
};
......@@ -1617,7 +1615,6 @@ void obs_source_updatevolumelevel(obs_source_t source, int volume)
}
}
static void set_tree_preset_vol(obs_source_t parent, obs_source_t child,
void *param)
{
......
......@@ -18,8 +18,8 @@ void VolControl::OBSVolumeChanged(void *data, calldata_t calldata)
}
// [Danni] This may be a bit too resource intensive for such a simple
// application.
/* [Danni] This may be a bit too resource intensive for such a simple
application. */
void VolControl::OBSVolumeLevel(void *data, calldata_t calldata)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册