File tree Expand file tree Collapse file tree 2 files changed +11
-13
lines changed
libraries/recording/src/recording Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -442,21 +442,19 @@ void Agent::executeScript() {
442
442
443
443
QByteArray audio (frame->data );
444
444
445
+ int16_t * samples = reinterpret_cast <int16_t *>(audio.data ());
446
+ int numSamples = AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL;
447
+
445
448
auto volume = player->getVolume ();
446
- if (volume != 1 .0f || _isNoiseGateEnabled) {
447
- int16_t * samples = reinterpret_cast <int16_t *>(audio.data ());
448
- int numSamples = AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL;
449
-
450
- if (volume != 1 .0f ) {
451
- int32_t fract = (int32_t )(volume * 65536 .0f ); // Q16
452
- for (int i = 0 ; i < numSamples; i++) {
453
- samples[i] = (fract * (int32_t )samples[i]) >> 16 ;
454
- }
449
+ if (volume >= 0 .0f && volume < 1 .0f ) {
450
+ int32_t fract = (int32_t )(volume * (float )(1 << 16 )); // Q16
451
+ for (int i = 0 ; i < numSamples; i++) {
452
+ samples[i] = (fract * (int32_t )samples[i]) >> 16 ;
455
453
}
454
+ }
456
455
457
- if (_isNoiseGateEnabled) {
458
- _audioGate.render (samples, samples, numSamples);
459
- }
456
+ if (_isNoiseGateEnabled) {
457
+ _audioGate.render (samples, samples, numSamples);
460
458
}
461
459
462
460
computeLoudness (&audio, scriptedAvatar);
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ class Deck : public QObject, public ::Dependency {
57
57
float position () const ;
58
58
void seek (float position);
59
59
60
- float getVolume () { return _volume; }
60
+ float getVolume () const { return _volume; }
61
61
void setVolume (float volume);
62
62
63
63
signals:
You can’t perform that action at this time.
0 commit comments