Commit Graph

37 Commits (master)

Author SHA1 Message Date
Norihiro Kamae 33e6ad3cc9 libobs: Remove unnecessary UTF characters 2022-08-13 00:49:17 -07:00
Norihiro Kamae af3890a4a9 libobs: Cleanup unused-parameters
- Add OBS_UNUSED to unused function parameters
- Remove unnecessary UNUSED_PARAMETER
Also update libobs-opengl/
2022-07-19 11:01:00 -04:00
gxalpha 283f7edfd7 libobs: Make obs_volmeter_get_nr_channels default to 0
Defaulting to 1 means that it can't be differentiated between whether a
source really has 1 channel. Now, should a source not have any audio
(yet), this function makes it very clear that this is the case by
returning 0.
2022-04-17 11:54:50 +10:00
Matt Gajownik 67dbb316a5 libobs: Respect push to talk/mute status in volmeter
The audio capture callback's mute parameter internally respects the
push to talk/mute state, whereas obs_source_muted() and the "mute"
signal don't. This resulted in meters looking entirely unmuted even
though both monitoring and output were not receiving audio.
2022-01-26 16:37:36 +11:00
Clayton Groeneveld 5878856ce4 UI: Display grayscale volume meter if muted
Currently, the volume meters don't show volume levels when
muted. This shows the levels and makes it grayscale when
the source is muted.
2021-12-23 06:35:29 -08:00
Clayton Groeneveld af6c719139 UI, libobs, obs-plugins: Fix compiler warnings
Found warnings when compiling OBS.
2021-11-04 06:25:52 -07:00
jp9000 18f97fb494 Revert "libobs: Remove unused volmeter code"
This reverts commit 07d30cbff9.
2021-10-24 01:58:46 -07:00
Clayton Groeneveld 07d30cbff9 libobs: Remove unused volmeter code
This code is unused as the volmeter interval is set on the
UI side.
2021-10-24 01:57:28 -07:00
Peter Geis 08b1b66439 libobs: fix building modules once installed
sse-intrin.h is a required header now, but the implicit path
breaks building addons once the headers are installed.

Fix this by making the path explicit.
2019-11-27 14:00:15 -05:00
Peter Geis 64d0b7fcb4 libobs: Enable compilation on aarch64
Add arch checks to enable aarch-compat layer on aarch64, retain normal
gcc intrinsics on x86 and ppc64.
2019-11-25 13:04:21 -05:00
jp9000 f53df7da64 clang-format: Apply formatting
Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed.  Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
2019-06-23 23:49:10 -07:00
Clayton Groeneveld 03c9d930da UI: Change volume to dB in adv audio properties 2019-05-08 16:41:17 -07:00
jp9000 8211b9e220 libobs: Use unaligned store rather than aligned store
Prevents a potential crash when being used with audio data that is
unaligned.
2018-05-01 09:26:10 -07:00
jp9000 4785d9906c libobs: Convert sse inline funcs to macros 2018-05-01 09:01:04 -07:00
jp9000 238df3da3a libobs: Add "static" to inline func
Fixes linux-specific compiler error:
libobs/libobs.so.0: undefined reference to `hmax_ps'
2018-04-30 04:16:15 -07:00
Tjienta Vara b0f94afaf2 libobs, UI: Add true peak measurements
Add a new algorithm to calculate the true-peak. It implements the
Whittaker- Shannon interpolation from four samples to create 4
intermediate samples (5 x oversampling) inbetween the middle two
samples.

With 4 samples and 4 intermediate samples the algorithm can be
implemented as a 4x4 vector-matrix cross product, which is ideal for
SSE.

I've also replaced the sample-peak algorithm using SSE as well to
improve performance.

Closes obsproject/obs-studio#1189
2018-04-30 03:53:26 -07:00
jp9000 dc7e05c0b9 libobs: Fix double -> float conversion warning 2018-01-16 12:03:03 -08:00
Tjienta Vara 50ce228455 UI: Rework volume-meters, adding more information
The following features have been added to the audio-meters:
 * Stereo PPM-level meter, with 40 dB/1.7s decay rate.
 * Stereo VU-level meter, with 300 ms integration time.
 * Stereo Peak-hold meter, with 20 second sustain.
 * Input peak level color-squares in front of every meter.
 * Minor-ticks for each dB.
 * Major-ticks for every 5 dB.
 * Meter is divided in sections at -20 dB and -9 dB.

The ballistic parameters chosen here where taken from:
 * https://en.wikipedia.org/wiki/Peak_programme_meter (SMPTE RP.0155)
 * https://en.wikipedia.org/wiki/VU_meter

In the rework I have removed any ballistic calculations from
libobs/obs-audio-controls.c making the calculations here a lot more
simple doing only MAX and RMS calculations for only the samples in
the current update. The actual ballistics are now done by just
the UI/volume-control.cpp because ballistics need to be updated
based on the repaint-rate of the user-interface.

The dB to pixel conversion has been moved from
libobs/obs-audio-controls.c to UI/volume-control.cpp as well to reduce
coupling between these two objects, especially when implementing the
major- and minor-ticks and the sections.

All colors and ballistic parameters are adjustable via QT style sheets.
There are slight differences in colors for each of the themes.
2018-01-05 11:01:25 +01:00
cg2121 14d330c455 libobs: Add obs_volmeter_get_cur_db function 2017-07-01 19:06:58 -07:00
jp9000 03b2ca65cf libobs: Only lock audio meter/fader when accessing data
Fixes an issue where the audio meter/fader would call an obs function
and lock another mutex, potentially causing a mutual inverted lock in
another thread.
2016-06-11 11:36:46 -07:00
jp9000 669da7ba36 libobs: Do not use signals with audio capture/controls
(Note: This commit also modifies UI)

Instead of using signals, use designated callback lists for audio
capture and audio control helpers.  Signals aren't suitable here due to
the fact that signals aren't meant for things that happen every frame or
things that happen every time audio/video is received.  Also prevents
audio from being allocated every time these functions are called due to
the calldata structure.
2016-01-26 11:49:47 -08:00
jp9000 546b189f05 libobs: Use audio-math.h for decibel conversion 2015-06-26 03:40:28 -07:00
Palana 0f2310a8bc libobs: Extend levels_updated signal with muted flag 2015-05-07 02:08:08 +02:00
jp9000 9832a760b8 (API Change) Always use planar float audio output
Core API functions changed:
-----------------------------
EXPORT bool obs_reset_audio(struct audio_output_info *aoi);
EXPORT bool obs_get_audio_info(struct audio_output_info *aoi);

To:
-----------------------------
EXPORT bool obs_reset_audio(const struct obs_audio_info *oai);
EXPORT bool obs_get_audio_info(struct obs_audio_info *oai);

Core structure added:
-----------------------------
struct obs_audio_info {
	uint32_t            samples_per_sec;
	enum speaker_layout speakers;
	uint64_t            buffer_ms;
};

Non-interleaved (planar) floating point output is standard with audio
filtering, so to prevent audio filters from having to worry about
different audio format implementations and for the sake consistency
between user interfaces, make it so that audio is always set to
non-interleaved floating point output.
2015-03-12 22:22:02 -07:00
jp9000 c72284f387 libobs: Fix a few warnings
Two integers are needlessly converted to floating points for what should
be an integer operation.  One of those floats is then used for another
integer operation later, where the original integer value should have
been used.  So essentially there was an int -> float -> int conversion
going on, which could lead to potential loss of data due to floating
point precision.

There were also some general 64bit -> 32bit conversion warnings.
2014-12-28 01:03:10 -08:00
fryshorts c0e6324278 libobs: Signal own levels in volmeter
Signal updated volume levels when they become available in the volume
meter. The frequency of the updates can be adjusted by setting a
different update interval.
2014-12-14 18:39:54 +01:00
fryshorts 94445ddba2 libobs: Remove audio levels handler from volmeter
Remove the the signal handler for the volume_level signal of audio
sources from the volume meter in anticipation of using the levels
calculated in the volume meter itself.
2014-12-14 18:39:54 +01:00
fryshorts 6e0c1533fc libobs: Add level calculations to volmeter
Use the new audio_data signal from sources to calculate the volume
levels in the volume meter.
2014-12-14 18:39:54 +01:00
fryshorts 63399bbfd8 libobs: Add peak hold property to volmeter
Add a property to the volume meter that specifies the time for which
peak value should be held until it is reset.
2014-12-14 18:39:54 +01:00
fryshorts e0ce484b81 libobs: Add update interval property to volmeter
Add a property to the volume meter that specifies the length of the
interval in which the audio data should be sampled before the
audio_levels signal is emitted.
2014-12-14 18:39:28 +01:00
fryshorts 1b034569f0 libobs: Add Logarithmic fader type
This adds the conversion function used by the old obs based on a
logarithmic scale.
2014-12-04 21:58:35 +01:00
fryshorts 119d77e176 libobs: Add IEC 60-268-18 compliant fader type
This adds a new fader type that implements a position/dB mapping
as specified in IEC 60-268-18.
2014-12-04 21:58:34 +01:00
fryshorts 46686ec556 libobs: Add volume meter object
This adds a volume meter object to libobs that can be used by the GUI
or plugins to convert the raw audio level data from sources to values
that can easily be used to display the audio data.
The volume meter object will use the same mapping functions as the
fader object to map dB levels to a scale.
2014-12-04 21:58:34 +01:00
jp9000 346bcd7e48 libobs: Fix microsoft compiler issue
In older versions of visual studio 2013 microsoft's WORTHLESS C compiler
has a bug where it will, almost at random, not be able to handle having
variables declared in the middle of a function and give the warning:
"illegal use of this type as an expression".  It was fixed in recent
VS2013 updates, but I'm not about to force everyone to update to it.
2014-11-27 11:05:36 -08:00
jp9000 8922f2503f libobs: Fix double -> float conversion warning 2014-11-27 00:07:49 -08:00
jp9000 e3e79dcdc5 libobs: Fix windows warnings with C library macro
The macro INFINITY apparently will trigger a warning with microsoft's
compiler despite being a C standard library macro.
2014-11-27 00:07:48 -08:00
fryshorts 8dcbd77bf2 libobs: Add audio control functions
This adds a new library of audio control functions mainly for the use in
GUIS. For now it includes an implementation of a software fader that can
be attached to sources in order to easily control the volume.
The fader can translate between fader-position, volume in dB and
multiplier with a configurable mapping function.
Currently only a cubic mapping (mul = fader_pos ^ 3) is included, but
different mappings can easily be added.

Due to libobs saving/restoring the source volume from the multiplier,
the volume levels for existing source will stay the same, and live
changing of the mapping will work without changing the source volume.
2014-11-26 20:07:26 +01:00