/usr/include/obs/obs-audio-controls.h is in libobs-dev 0.15.4+dfsg1-1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | /*
Copyright (C) 2014 by Leonhard Oelke <leonhard@in-verted.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "obs.h"
/**
* @file
* @brief header for audio controls
*
* @brief Audio controls for use in GUIs
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Fader types
*/
enum obs_fader_type {
/**
* @brief A simple cubic fader for controlling audio levels
*
* This is a very common type of software fader since it yields good
* results while being quite performant.
* The input value is mapped to mul values with the simple formula x^3.
*/
OBS_FADER_CUBIC,
/**
* @brief A fader compliant to IEC 60-268-18
*
* This type of fader has several segments with different slopes that
* map deflection linearly to dB values. The segments are defined as
* in the following table:
*
@code
Deflection | Volume
------------------------------------------
[ 100 %, 75 % ] | [ 0 dB, -9 dB ]
[ 75 %, 50 % ] | [ -9 dB, -20 dB ]
[ 50 %, 30 % ] | [ -20 dB, -30 dB ]
[ 30 %, 15 % ] | [ -30 dB, -40 dB ]
[ 15 %, 7.5 % ] | [ -40 dB, -50 dB ]
[ 7.5 %, 2.5 % ] | [ -50 dB, -60 dB ]
[ 2.5 %, 0 % ] | [ -60 dB, -inf dB ]
@endcode
*/
OBS_FADER_IEC,
/**
* @brief Logarithmic fader
*/
OBS_FADER_LOG
};
/**
* @brief Create a fader
* @param type the type of the fader
* @return pointer to the fader object
*
* A fader object is used to map input values from a gui element to dB and
* subsequently multiplier values used by libobs to mix audio.
* The current "position" of the fader is internally stored as dB value.
*/
EXPORT obs_fader_t *obs_fader_create(enum obs_fader_type type);
/**
* @brief Destroy a fader
* @param fader pointer to the fader object
*
* Destroy the fader and free all related data
*/
EXPORT void obs_fader_destroy(obs_fader_t *fader);
/**
* @brief Set the fader dB value
* @param fader pointer to the fader object
* @param db new dB value
* @return true if value was set without clamping
*/
EXPORT bool obs_fader_set_db(obs_fader_t *fader, const float db);
/**
* @brief Get the current fader dB value
* @param fader pointer to the fader object
* @return current fader dB value
*/
EXPORT float obs_fader_get_db(obs_fader_t *fader);
/**
* @brief Set the fader value from deflection
* @param fader pointer to the fader object
* @param def new deflection
* @return true if value was set without clamping
*
* This sets the new fader value from the supplied deflection, in case the
* resulting value was clamped due to limits this function will return false.
* The deflection is typically in the range [0.0, 1.0] but may be higher in
* order to provide some amplification. In order for this to work the high dB
* limit has to be set.
*/
EXPORT bool obs_fader_set_deflection(obs_fader_t *fader, const float def);
/**
* @brief Get the current fader deflection
* @param fader pointer to the fader object
* @return current fader deflection
*/
EXPORT float obs_fader_get_deflection(obs_fader_t *fader);
/**
* @brief Set the fader value from multiplier
* @param fader pointer to the fader object
* @return true if the value was set without clamping
*/
EXPORT bool obs_fader_set_mul(obs_fader_t *fader, const float mul);
/**
* @brief Get the current fader multiplier value
* @param fader pointer to the fader object
* @return current fader multiplier
*/
EXPORT float obs_fader_get_mul(obs_fader_t *fader);
/**
* @brief Attach the fader to a source
* @param fader pointer to the fader object
* @param source pointer to the source object
* @return true on success
*
* When the fader is attached to a source it will automatically sync it's state
* to the volume of the source.
*/
EXPORT bool obs_fader_attach_source(obs_fader_t *fader, obs_source_t *source);
/**
* @brief Detach the fader from the currently attached source
* @param fader pointer to the fader object
*/
EXPORT void obs_fader_detach_source(obs_fader_t *fader);
typedef void (*obs_fader_changed_t)(void *param, float db);
EXPORT void obs_fader_add_callback(obs_fader_t *fader,
obs_fader_changed_t callback, void *param);
EXPORT void obs_fader_remove_callback(obs_fader_t *fader,
obs_fader_changed_t callback, void *param);
/**
* @brief Create a volume meter
* @param type the mapping type to use for the volume meter
* @return pointer to the volume meter object
*
* A volume meter object is used to prepare the sound levels reported by audio
* sources for display in a GUI.
* It will automatically take source volume into account and map the levels
* to a range [0.0f, 1.0f].
*/
EXPORT obs_volmeter_t *obs_volmeter_create(enum obs_fader_type type);
/**
* @brief Destroy a volume meter
* @param volmeter pointer to the volmeter object
*
* Destroy the volume meter and free all related data
*/
EXPORT void obs_volmeter_destroy(obs_volmeter_t *volmeter);
/**
* @brief Attach the volume meter to a source
* @param volmeter pointer to the volume meter object
* @param source pointer to the source object
* @return true on success
*
* When the volume meter is attached to a source it will start to listen to
* volume updates on the source and after preparing the data emit its own
* signal.
*/
EXPORT bool obs_volmeter_attach_source(obs_volmeter_t *volmeter,
obs_source_t *source);
/**
* @brief Detach the volume meter from the currently attached source
* @param volmeter pointer to the volume meter object
*/
EXPORT void obs_volmeter_detach_source(obs_volmeter_t *volmeter);
/**
* @brief Get signal handler for the volume meter object
* @param volmeter pointer to the volume meter object
* @return signal handler
*/
EXPORT signal_handler_t *obs_volmeter_get_signal_handler(
obs_volmeter_t *volmeter);
/**
* @brief Set the update interval for the volume meter
* @param volmeter pointer to the volume meter object
* @param ms update interval in ms
*
* This sets the update interval in milliseconds that should be processed before
* the resulting values are emitted by the levels_updated signal. The resulting
* number of audio samples is rounded to an integer.
*
* Please note that due to way obs does receive audio data from the sources
* this is no hard guarantee for the timing of the signal itself. When the
* volume meter receives a chunk of data that is multiple the size of the sample
* interval, all data will be sampled and the values updated accordingly, but
* only the signal for the last segment is actually emitted.
* On the other hand data might be received in a way that will cause the signal
* to be emitted in shorter intervals than specified here under some
* circumstances.
*/
EXPORT void obs_volmeter_set_update_interval(obs_volmeter_t *volmeter,
const unsigned int ms);
/**
* @brief Get the update interval currently used for the volume meter
* @param volmeter pointer to the volume meter object
* @return update interval in ms
*/
EXPORT unsigned int obs_volmeter_get_update_interval(obs_volmeter_t *volmeter);
/**
* @brief Set the peak hold time for the volume meter
* @param volmeter pointer to the volume meter object
* @param ms peak hold time in ms
*/
EXPORT void obs_volmeter_set_peak_hold(obs_volmeter_t *volmeter,
const unsigned int ms);
/**
* @brief Get the peak hold time for the volume meter
* @param volmeter pointer to the volume meter object
* @return the peak hold time in ms
*/
EXPORT unsigned int obs_volmeter_get_peak_hold(obs_volmeter_t *volmeter);
typedef void (*obs_volmeter_updated_t)(void *param, float level,
float magnitude, float peak, float muted);
EXPORT void obs_volmeter_add_callback(obs_volmeter_t *volmeter,
obs_volmeter_updated_t callback, void *param);
EXPORT void obs_volmeter_remove_callback(obs_volmeter_t *volmeter,
obs_volmeter_updated_t callback, void *param);
#ifdef __cplusplus
}
#endif
|