diff --git a/CHANGELOG.md b/CHANGELOG.md index 286d7fc..de0a921 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,43 +1,10 @@ -#### 2.0.0-pre.X +#### 2.0.0-pre.3 (20 Mar 2024) - added `getActiveVoiceCount()` to get concurrent sounds that are playing at the moment. - added `countAudioSource()` to get concurrent sounds that are playing a specific audio source. - added `getVoiceCount()` to get the number of voices the application has told SoLoud to play. - added `getMaxActiveVoiceCount()` to get the current maximum active voice count. - added `setMaxActiveVoiceCount()` to set the current maximum active voice count. - added `setProtectVoice()` and `getProtectVoice()` to get/set the protect voice flag. - -#### 2.0.0-pre.2 (14 Mar 2024) - -NOTE: This version is much more breaking than the ones before it. -It might be worth it to first upgrade your code to `2.0.0-pre.1`, -use the quick fixes to rename the methods, and only then upgrade -to `2.0.0-pre.2` and beyond. - -- `SoLoud` methods now throw instead of returning a `PlayerErrors` object. - This is a massive breaking change, but it makes the package API - more idiomatic and easier to use. - - Before: - - ```dart - final ret = await SoLoud.play(sound); - if (ret.error != PlayerErrors.noError) { - print('Oh no! ${ret.error}'); - } else { - print('Playing sound with new handle: ${ret.newHandle}'); - } - ``` - - After: - - ```dart - try { - final handle = await SoLoud.play(sound); - print('Playing sound with new handle: $handle'); - } on SoLoudException catch (e) { - print('Oh no! $e'); - } - ``` - All time-related parameters and return values are now `Duration` type. Before, they were `double`. - Fixed velocity computation bug in `example/`. @@ -68,13 +35,45 @@ to `2.0.0-pre.2` and beyond. ); soloud.play(source); ``` - - Deprecated `shutdown()`. Replaced with the synchronous `deinit()`. Quick fix available. - Renamed `initialize()` to `init()`, in order to come closer to the original C++ API, and also to have a symmetry (`init`/`deinit`). Quick fix available. +#### 2.0.0-pre.2 (14 Mar 2024) + +NOTE: This version is much more breaking than the ones before it. +It might be worth it to first upgrade your code to `2.0.0-pre.1`, +use the quick fixes to rename the methods, and only then upgrade +to `2.0.0-pre.2` and beyond. + +- `SoLoud` methods now throw instead of returning a `PlayerErrors` object. + This is a massive breaking change, but it makes the package API + more idiomatic and easier to use. + + Before: + + ```dart + final ret = await SoLoud.play(sound); + if (ret.error != PlayerErrors.noError) { + print('Oh no! ${ret.error}'); + } else { + print('Playing sound with new handle: ${ret.newHandle}'); + } + ``` + + After: + + ```dart + try { + final handle = await SoLoud.play(sound); + print('Playing sound with new handle: $handle'); + } on SoLoudException catch (e) { + print('Oh no! $e'); + } + ``` + #### 2.0.0-pre.1 (12 Mar 2024) - added `looping` and `loopingStartAt` properties to `SoLoud.play()` and `SoLoud.play3d()`. - added `SoLoud.getLooping()` to retrieve the looping state of a sound. diff --git a/example/pubspec.lock b/example/pubspec.lock index 139a98f..42c84b7 100755 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -92,7 +92,7 @@ packages: path: ".." relative: true source: path - version: "2.0.0-pre.2" + version: "2.0.0-pre.3" flutter_test: dependency: "direct dev" description: flutter diff --git a/lib/src/bindings_player_ffi.dart b/lib/src/bindings_player_ffi.dart index 1850fdc..a33f860 100644 --- a/lib/src/bindings_player_ffi.dart +++ b/lib/src/bindings_player_ffi.dart @@ -120,8 +120,7 @@ class FlutterSoLoudFfi { return _isInited() == 1; } - late final _isInitedPtr = - _lookup>( + late final _isInitedPtr = _lookup>( 'isInited', ); late final _isInited = _isInitedPtr.asFunction(); @@ -837,9 +836,9 @@ class FlutterSoLoudFfi { /// NOTE: The number of concurrent voices is limited, as having unlimited /// voices would cause performance issues, as well as lead to unnecessary /// clipping. The default number of concurrent voices is 16, but this can be - /// adjusted at runtime. The hard maximum number is 4095, but if more are + /// adjusted at runtime. The hard maximum number is 4095, but if more are /// required, SoLoud can be modified to support more. But seriously, if you - /// need more than 4095 sounds at once, you're probably going to make + /// need more than 4095 sounds at once, you're probably going to make /// some serious changes in any case. void setMaxActiveVoiceCount(int maxVoiceCount) { return _setMaxActiveVoiceCount(maxVoiceCount); @@ -851,7 +850,6 @@ class FlutterSoLoudFfi { late final _setMaxActiveVoiceCount = _setMaxActiveVoiceCountPtr.asFunction(); - ///////////////////////////////////////// /// faders ///////////////////////////////////////// @@ -1062,9 +1060,9 @@ class FlutterSoLoudFfi { /// Returns: /// [PlayerErrors.noError] if no errors /// [PlayerErrors.filterNotFound] if the [filterType] does not exits - /// [PlayerErrors.filterAlreadyAdded] when trying to add an already + /// [PlayerErrors.filterAlreadyAdded] when trying to add an already /// added filter - /// [PlayerErrors.maxNumberOfFiltersReached] when the maximum number of + /// [PlayerErrors.maxNumberOfFiltersReached] when the maximum number of /// filters has been reached (default is 8) /// PlayerErrors addGlobalFilter(int filterType) { diff --git a/lib/src/exceptions/exceptions_from_cpp.dart b/lib/src/exceptions/exceptions_from_cpp.dart index a3abe41..1e45577 100644 --- a/lib/src/exceptions/exceptions_from_cpp.dart +++ b/lib/src/exceptions/exceptions_from_cpp.dart @@ -141,13 +141,14 @@ class SoLoudMaxFilterNumberReachedException extends SoLoudCppException { 'is allowed (on the C++ side).'; } -/// An exception that is thrown when SoLoud (C++) cannot add a filter +/// An exception that is thrown when SoLoud (C++) cannot add a filter /// that has already been added. class SoLoudFilterAlreadyAddedException extends SoLoudCppException { /// Creates a new [SoLoudFilterAlreadyAddedException]. const SoLoudFilterAlreadyAddedException([super.message]); @override - String get description => 'Askind to add a filter that is already been added. ' + String get description => + 'Askind to add a filter that is already been added. ' 'Only one of each type is allowed (on the C++ side).'; } diff --git a/lib/src/soloud.dart b/lib/src/soloud.dart index 9457506..63b48dd 100644 --- a/lib/src/soloud.dart +++ b/lib/src/soloud.dart @@ -1792,11 +1792,12 @@ interface class SoLoud { } /// Add a filter to all sounds. + /// /// [filterType] filter to add. /// - /// Throws [SoLoudMaxFilterNumberReachedException] when the max number of + /// Throws [SoLoudMaxFilterNumberReachedException] when the max number of /// concurrent filter is reached (default max filter is 8). - /// Throws [SoLoudFilterAlreadyAddedException] when trying to add a filter + /// Throws [SoLoudFilterAlreadyAddedException] when trying to add a filter /// that has already been added. void addGlobalFilter(FilterType filterType) { final e = SoLoudController().soLoudFFI.addGlobalFilter(filterType.index); diff --git a/pubspec.yaml b/pubspec.yaml index c650b98..df31952 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_soloud description: >- Flutter audio plugin using SoLoud library with miniaudio backend and FFI. It provides player, basic capture from microphone, 3D audio and more. -version: 2.0.0-pre.2 +version: 2.0.0-pre.3 issue_tracker: https://github.com/alnitak/flutter_soloud/issues homepage: https://github.com/alnitak/flutter_soloud maintainer: Marco Bavagnoli (@lildeimos)