Skip to content

Commit c10eb37

Browse files
committed
fix: crash when trying to play a sound after deactivating its active filter #189
1 parent 269c803 commit c10eb37

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 3.0.2 (25 Feb 2025)
2+
- fixed crash when trying to play a sound after deactivating its active filter #189
3+
14
### 3.0.1 (20 Feb 2025)
25
- fix: error while calling listPlaybackDevices() #186.
36
- android example folder recreated.

example/tests/tests.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,8 @@ Future<StringBuffer> testSoundFilters() async {
766766
..writeln();
767767
}
768768

769+
await SoLoud.instance.play(sound);
770+
769771
/// Check if filter has been deactivated.
770772
assert(
771773
!filter.isActive,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: >-
33
A low-level audio plugin for Flutter,
44
mainly meant for games and immersive apps.
55
Based on the SoLoud (C++) audio engine.
6-
version: 3.0.1
6+
version: 3.0.2
77
homepage: https://github.com/alnitak/flutter_soloud
88
maintainer: Marco Bavagnoli (@lildeimos)
99
platforms:

src/filters/filters.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,15 @@ bool Filters::removeFilter(FilterType filterType)
242242
if (index < 0)
243243
return false;
244244

245-
mSoloud->setGlobalFilter(index, 0);
245+
if (mSound == nullptr)
246+
{
247+
mSoloud->setGlobalFilter(index, 0);
248+
}
249+
else
250+
{
251+
mSound->sound.get()->setFilter(index, 0);
252+
}
253+
246254
filters[index].get()->filter.reset();
247255

248256
/// shift filters down by 1 from [index]

web/libflutter_soloud_plugin.wasm

42 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)