-
-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift implementation (IOS Equalizer) #784
Open
SimoneBressan
wants to merge
19
commits into
ryanheise:minor
Choose a base branch
from
Kuama-IT:swift_implementation
base: minor
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9c07d23
Apply patch from old repository
BreX900 ad92855
fix ios files
BreX900 791f56a
swiftformat
0e6ef2c
refactor remove old code
BreX900 4f91087
build can add me as a dependency using git
BreX900 09ef9f6
add stop and fix swift code
38238d3
Update FUNDING.yml
kuamanet 42d002b
add classes, moved in dedicated folder extensions, fix typos
63e6c5d
Keep darwin sources inside macos dir, since the symlink does not seem…
kuamanet 419134f
format
eea5023
Simple script to copy files from darwin folder to macos/ios folder
kuamanet 499bc1f
restore ios source
kuamanet d122d32
feat: start integrating new pod
16faf9e
feat(Darwin): add reverb, delay and distortion structures
kuamanet 5b8d451
feat(Darwin): allow to toggle write output to file feature
kuamanet f6a5bc8
feat(Darwin): expose information about audio effects
kuamanet 65aeb08
fix: missing mappings
BreX900 2ea1917
chore: use early returns
kuamanet 8d4deca
feat(ios): drop pod dep and directly include deps code
kuamanet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,6 @@ pubspec.lock | |
*.iml | ||
|
||
# VS Code | ||
.vscode | ||
.vscode | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Files and directories created by pub. | ||
.dart_tool/ | ||
.packages | ||
|
||
# Conventional directory for build output. | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Development tools | ||
|
||
### Swift development | ||
|
||
**Problem** | ||
|
||
Native `macos` and `ios` projects share most of the code. Sadly, CocoaPods does not allow to | ||
reference files outside of the root project directory, or to symlink `.swift` files. | ||
|
||
This would force us to duplicate the code between `macos` and `ios` implementations with cut & | ||
paste. | ||
|
||
**Solution** | ||
|
||
A simple script that watches a source folder (say `darwin`) and copies the files to the correct | ||
folder. Of course this means that most of future ios/macos developments will need to happen inside | ||
the source folder. | ||
|
||
**How to** | ||
Launch the script inside `tools/cli/lib`. Say you are in the root of the repository it would be | ||
|
||
```bash | ||
dart run ./tools/cli/lib/sync_darwin_folder.dart | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
include: package:lints/recommended.yaml | ||
|
||
analyzer: | ||
strong-mode: | ||
implicit-casts: false | ||
implicit-dynamic: false | ||
|
||
linter: | ||
rules: | ||
prefer_single_quotes: false | ||
unawaited_futures: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import 'dart:core'; | ||
import 'dart:io'; | ||
|
||
import "package:path/path.dart" show dirname; | ||
import 'package:watcher/watcher.dart'; | ||
|
||
void main(List<String> arguments) { | ||
watch( | ||
sourceFolder: "just_audio/darwin", | ||
destinationFolders: [ | ||
"just_audio/macos", | ||
"just_audio/ios", | ||
], | ||
); | ||
} | ||
|
||
/// Watches files changes (add, modify and remove) inside the [sourceFolder], and aligns accordingly | ||
/// the [destinationFolders] files. Both [sourceFolder] and [destinationFolders] are supposed to be relative paths to the directory you want to operate with. | ||
/// | ||
/// Throws a [FileSystemException] if [sourceFolder] does not exist. | ||
void watch({ | ||
required String sourceFolder, | ||
required List<String> destinationFolders, | ||
}) { | ||
final currentDir = dirname(Platform.script.path).dropLastSlash(); | ||
final baseDir = "$currentDir/../../.."; | ||
final destinationDirs = destinationFolders.map((it) { | ||
return "$baseDir/${it.dropLastSlash()}"; | ||
}); | ||
final watcher = DirectoryWatcher("$baseDir/$sourceFolder"); | ||
|
||
watcher.events.listen((event) { | ||
final partialPath = event.path.replaceAll("$baseDir/$sourceFolder", ""); | ||
|
||
print("Updating $partialPath"); | ||
|
||
switch (event.type) { | ||
case ChangeType.ADD: | ||
case ChangeType.MODIFY: | ||
final file = File(event.path); | ||
for (final destination in destinationDirs) { | ||
file.copySync("$destination$partialPath"); | ||
} | ||
break; | ||
case ChangeType.REMOVE: | ||
for (var element in destinationDirs) { | ||
final file = File("$element$partialPath"); | ||
file.deleteSync(recursive: file is Directory); | ||
} | ||
} | ||
}); | ||
|
||
print("🫣 Watching files 🫣"); | ||
} | ||
|
||
extension StringPathClean on String { | ||
String dropLastSlash() { | ||
if (endsWith("/")) { | ||
return substring(0, length - 1); | ||
} | ||
|
||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: cli | ||
description: Just Audio development utilities | ||
version: 0.1.0 | ||
|
||
environment: | ||
sdk: '>=2.17.0 <3.0.0' | ||
|
||
dependencies: | ||
path: ^1.8.2 | ||
watcher: ^1.0.1 | ||
|
||
dev_dependencies: | ||
lints: ^2.0.0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? The symlink solution does at least work for objective C. For swift, I have seen other solutions to code sharing, though, a type of include/import-based solution.