| 63 |
63 |
static bool s_input; /* input plugin connected */
|
| 64 |
64 |
static bool s_output; /* primary output plugin connected */
|
| 65 |
65 |
static bool s_secondary; /* secondary output plugin connected */
|
| 66 |
|
static bool s_gain; /* replay gain info set */
|
| 67 |
66 |
static bool s_paused; /* paused */
|
| 68 |
67 |
static bool s_flushed; /* flushed, writes ignored until resume */
|
| 69 |
68 |
static bool s_resetting; /* resetting output system */
|
| ... | ... | |
| 271 |
270 |
return;
|
| 272 |
271 |
|
| 273 |
272 |
float factor = powf (10, aud_get_double (0, "replay_gain_preamp") / 20);
|
| 274 |
|
|
| 275 |
|
if (s_gain)
|
|
273 |
float peak;
|
|
274 |
auto mode = (ReplayGainMode) aud_get_int (0, "replay_gain_mode");
|
|
275 |
if (
|
|
276 |
((mode == ReplayGainMode::Album) ||
|
|
277 |
(mode == ReplayGainMode::Automatic &&
|
|
278 |
(! aud_get_bool (0, "shuffle") || aud_get_bool (0, "album_shuffle")))) &&
|
|
279 |
(gain_info.album_gain_is_set))
|
| 276 |
280 |
{
|
| 277 |
|
float peak;
|
| 278 |
|
|
| 279 |
|
auto mode = (ReplayGainMode) aud_get_int (0, "replay_gain_mode");
|
| 280 |
|
if ((mode == ReplayGainMode::Album) ||
|
| 281 |
|
(mode == ReplayGainMode::Automatic &&
|
| 282 |
|
(! aud_get_bool (0, "shuffle") || aud_get_bool (0, "album_shuffle"))))
|
| 283 |
|
{
|
| 284 |
|
factor *= powf (10, gain_info.album_gain / 20);
|
| 285 |
|
peak = gain_info.album_peak;
|
| 286 |
|
}
|
| 287 |
|
else
|
|
281 |
factor *= powf (10, gain_info.album_gain / 20);
|
|
282 |
peak = gain_info.album_peak;
|
|
283 |
if (aud_get_bool (0, "enable_clipping_prevention") && peak * factor > 1)
|
|
284 |
factor = 1 / peak;
|
|
285 |
}
|
|
286 |
else
|
|
287 |
{
|
|
288 |
if (gain_info.track_gain_is_set)
|
| 288 |
289 |
{
|
| 289 |
290 |
factor *= powf (10, gain_info.track_gain / 20);
|
| 290 |
291 |
peak = gain_info.track_peak;
|
|
292 |
if (aud_get_bool (0, "enable_clipping_prevention") && peak * factor > 1)
|
|
293 |
factor = 1 / peak;
|
| 291 |
294 |
}
|
| 292 |
|
|
| 293 |
|
if (aud_get_bool (0, "enable_clipping_prevention") && peak * factor > 1)
|
| 294 |
|
factor = 1 / peak;
|
|
295 |
else
|
|
296 |
factor *= powf (10, aud_get_double (0, "default_gain") / 20);
|
| 295 |
297 |
}
|
| 296 |
|
else
|
| 297 |
|
factor *= powf (10, aud_get_double (0, "default_gain") / 20);
|
| 298 |
298 |
|
| 299 |
299 |
if (factor < 0.99 || factor > 1.01)
|
| 300 |
300 |
audio_amplify (data.begin (), 1, data.len (), & factor);
|
| ... | ... | |
| 427 |
427 |
}
|
| 428 |
428 |
|
| 429 |
429 |
s_input = true;
|
| 430 |
|
s_gain = s_paused = s_flushed = false;
|
|
430 |
s_paused = s_flushed = false;
|
| 431 |
431 |
seek_time = start_time;
|
| 432 |
432 |
|
| 433 |
433 |
in_filename = filename;
|
| ... | ... | |
| 464 |
464 |
if (s_input)
|
| 465 |
465 |
{
|
| 466 |
466 |
gain_info = info;
|
| 467 |
|
s_gain = true;
|
| 468 |
467 |
|
| 469 |
468 |
AUDINFO ("Replay Gain info:\n");
|
| 470 |
469 |
AUDINFO (" album gain: %f dB\n", info.album_gain);
|