Skip to content

Commit

Permalink
chore on new filters examples
Browse files Browse the repository at this point in the history
  • Loading branch information
alnitak committed Nov 24, 2024
1 parent d4dba8e commit 122f45b
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 39 deletions.
44 changes: 25 additions & 19 deletions example/lib/filters/compressor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,25 +117,31 @@ class _CompressorExampleState extends State<CompressorExample> {
padding: const EdgeInsets.all(16),
child: Column(
children: [
Checkbox(
value: isFilterActive,
onChanged: (value) {
if (value!) {
compressor.activate();
compressor.wet.value = wet;
compressor.threshold.value = threshold;
compressor.makeupGain.value = makeupGain;
compressor.kneeWidth.value = kneeWidth;
compressor.ratio.value = ratio;
compressor.attackTime.value = attackTime;
compressor.releaseTime.value = releaseTime;
} else {
compressor.deactivate();
}
setState(() {
isFilterActive = value;
});
},
Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('Activate Compressor'),
Checkbox(
value: isFilterActive,
onChanged: (value) {
if (value!) {
compressor.activate();
compressor.wet.value = wet;
compressor.threshold.value = threshold;
compressor.makeupGain.value = makeupGain;
compressor.kneeWidth.value = kneeWidth;
compressor.ratio.value = ratio;
compressor.attackTime.value = attackTime;
compressor.releaseTime.value = releaseTime;
} else {
compressor.deactivate();
}
setState(() {
isFilterActive = value;
});
},
),
],
),

ElevatedButton(
Expand Down
47 changes: 27 additions & 20 deletions example/lib/filters/limiter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,33 @@ class _LimiterExampleState extends State<LimiterExample> {
padding: const EdgeInsets.all(16),
child: Column(
children: [
Checkbox(
value: isFilterActive,
onChanged: (value) {
if (value!) {
limiter.activate();
limiter.wet.value = wet;
limiter.threshold.value = threshold;
limiter.makeupGain.value = makeupGain;
limiter.kneeWidth.value = kneeWidth;
limiter.releaseTime.value = releaseTime;
} else {
limiter.deactivate();
}
setState(() {
isFilterActive = value;
});
},
const Text(
'WARNING: lower the volume down!',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('Activate Limiter'),
Checkbox(
value: isFilterActive,
onChanged: (value) {
if (value!) {
limiter.activate();
limiter.wet.value = wet;
limiter.threshold.value = threshold;
limiter.makeupGain.value = makeupGain;
limiter.kneeWidth.value = kneeWidth;
limiter.releaseTime.value = releaseTime;
} else {
limiter.deactivate();
}
setState(() {
isFilterActive = value;
});
},
),
],
),

ElevatedButton(
Expand All @@ -138,9 +148,6 @@ class _LimiterExampleState extends State<LimiterExample> {
SoLoud.instance.play(sound!, looping: true);
SoLoud.instance.play(sound!, looping: true);
SoLoud.instance.play(sound!, looping: true);
SoLoud.instance.play(sound!, looping: true);
SoLoud.instance.play(sound!, looping: true);
SoLoud.instance.play(sound!, looping: true);
},
child: const Text('play sound'),
),
Expand Down

0 comments on commit 122f45b

Please sign in to comment.