@@ -754,9 +754,11 @@ impl AudioParamProcessor {
754
754
755
755
if value. is_nan ( ) {
756
756
value = self . default_value ;
757
+ } else {
758
+ // do not use `clamp` because it has extra branches for NaN or when max < min
759
+ value = value. max ( self . min_value ) . min ( self . max_value ) ;
757
760
}
758
-
759
- output. channel_data_mut ( 0 ) [ 0 ] = value. clamp ( self . min_value , self . max_value ) ;
761
+ output. channel_data_mut ( 0 ) [ 0 ] = value;
760
762
} else {
761
763
// a-rate processing and input non-zero
762
764
output. set_single_valued ( false ) ;
@@ -766,9 +768,10 @@ impl AudioParamProcessor {
766
768
767
769
if o. is_nan ( ) {
768
770
* o = self . default_value ;
771
+ } else {
772
+ // do not use `clamp` because it has extra branches for NaN or when max < min
773
+ * o = o. max ( self . min_value ) . min ( self . max_value ) ;
769
774
}
770
-
771
- * o = o. clamp ( self . min_value , self . max_value )
772
775
} ) ;
773
776
}
774
777
} else {
@@ -785,9 +788,10 @@ impl AudioParamProcessor {
785
788
786
789
if o. is_nan ( ) {
787
790
* o = self . default_value ;
791
+ } else {
792
+ // do not use `clamp` because it has extra branches for NaN or when max < min
793
+ * o = o. max ( self . min_value ) . min ( self . max_value ) ;
788
794
}
789
-
790
- * o = o. clamp ( self . min_value , self . max_value )
791
795
} ) ;
792
796
}
793
797
}
@@ -1120,15 +1124,14 @@ impl AudioParamProcessor {
1120
1124
if end_index_clipped > start_index {
1121
1125
let mut time = ( start_index as f64 ) . mul_add ( infos. dt , infos. block_time ) ;
1122
1126
1127
+ let mut value = 0. ;
1123
1128
for _ in start_index..end_index_clipped {
1124
- let value =
1129
+ value =
1125
1130
compute_linear_ramp_sample ( start_time, duration, start_value, diff, time) ;
1126
-
1127
1131
self . buffer . push ( value) ;
1128
-
1129
1132
time += infos. dt ;
1130
- self . intrinsic_value = value;
1131
1133
}
1134
+ self . intrinsic_value = value;
1132
1135
}
1133
1136
}
1134
1137
@@ -1220,8 +1223,9 @@ impl AudioParamProcessor {
1220
1223
if end_index_clipped > start_index {
1221
1224
let mut time = ( start_index as f64 ) . mul_add ( infos. dt , infos. block_time ) ;
1222
1225
1226
+ let mut value = 0. ;
1223
1227
for _ in start_index..end_index_clipped {
1224
- let value = compute_exponential_ramp_sample (
1228
+ value = compute_exponential_ramp_sample (
1225
1229
start_time,
1226
1230
duration,
1227
1231
start_value,
@@ -1230,10 +1234,10 @@ impl AudioParamProcessor {
1230
1234
) ;
1231
1235
1232
1236
self . buffer . push ( value) ;
1233
- self . intrinsic_value = value;
1234
1237
1235
1238
time += infos. dt ;
1236
1239
}
1240
+ self . intrinsic_value = value;
1237
1241
}
1238
1242
}
1239
1243
@@ -1345,18 +1349,19 @@ impl AudioParamProcessor {
1345
1349
if end_index_clipped > start_index {
1346
1350
let mut time = ( start_index as f64 ) . mul_add ( infos. dt , infos. block_time ) ;
1347
1351
1352
+ let mut value = 0. ;
1348
1353
for _ in start_index..end_index_clipped {
1349
1354
// check if we have reached start_time
1350
- let value = if time - start_time < 0. {
1355
+ value = if time - start_time < 0. {
1351
1356
self . intrinsic_value
1352
1357
} else {
1353
1358
compute_set_target_sample ( start_time, time_constant, end_value, diff, time)
1354
1359
} ;
1355
1360
1356
1361
self . buffer . push ( value) ;
1357
- self . intrinsic_value = value;
1358
1362
time += infos. dt ;
1359
1363
}
1364
+ self . intrinsic_value = value;
1360
1365
}
1361
1366
}
1362
1367
@@ -1445,19 +1450,20 @@ impl AudioParamProcessor {
1445
1450
if end_index_clipped > start_index {
1446
1451
let mut time = ( start_index as f64 ) . mul_add ( infos. dt , infos. block_time ) ;
1447
1452
1453
+ let mut value = 0. ;
1448
1454
for _ in start_index..end_index_clipped {
1449
1455
// check if we have reached start_time
1450
- let value = if time - start_time < 0. {
1456
+ value = if time < start_time {
1451
1457
self . intrinsic_value
1452
1458
} else {
1453
1459
compute_set_value_curve_sample ( start_time, duration, values, time)
1454
1460
} ;
1455
1461
1456
1462
self . buffer . push ( value) ;
1457
- self . intrinsic_value = value;
1458
1463
1459
1464
time += infos. dt ;
1460
1465
}
1466
+ self . intrinsic_value = value;
1461
1467
}
1462
1468
}
1463
1469
0 commit comments