Skip to content
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
wants to merge 19 commits into
base: minor
Choose a base branch
from

Conversation

SimoneBressan
Copy link

@SimoneBressan SimoneBressan commented Jul 28, 2022

I have opened this PR to trace the development of the implementation in swift and to give the possibility to use the equalizer in both platforms.

The goal now is to complete this implementation 100%!

You can use this package by pointing to the git repository.

  just_audio:
    git:
      url: https://github.com/Kuama-IT/just_audio.git
      ref: swift_implementation
      path: just_audio

No changes other than the original package are needed to make the project work.
Follow the documentation.

It is not stable and it is not complete. Any contribution is welcome. This branch originated from wavy-assistant branch.
Previous PR: #658

RelatedIssue: #334

Basic Features:

  • play
  • pause
  • stop
  • seek seekToNext seekToPrevious
  • setVolume
  • setSkipSilenceEnabled
  • setSpeed
  • setLoopMode
  • setShuffleModeEnabled
  • shuffle
  • setAutomaticallyWaitsToMinimizeStalling
  • setCanUseNetworkResourcesForLiveStreamingWhilePaused
  • setClip
  • setPitch
  • setPreferredPeakBitRate

Media Supports:

  • Assets
  • Ipod-library
  • Web url
  • Local file

Equalizer:

  • Ios
  • Android

Extra:

  • Support switch output device

Future features:

  • Add default mixer presets (bassbost, voice and more)
  • Manage many audio source
  • Apply presets to specific audio source
  • Save audio stream to file
  • Stream audio stream to server

@ryanheise ryanheise mentioned this pull request Jul 28, 2022
22 tasks
GabM3 and others added 6 commits August 22, 2022 16:43
add pitch control, throw when a method is unimplemented

example add buttons

add errors

shuffle order todo

shuffle

fix exports

fix typo and xcode warnings
Give credit to [klaep](https://www.klaep.com/) on these features development
add custom errors

delete static function to throw errors

moved new files in darwin and add symbolic link

relative path

drop underscore in resume player func
**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.
Copy link
Owner

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.

minor refactor to JustAudioPlayer.swift to share it across ios and macos implementation
@@ -765,29 +765,39 @@ private void loudnessEnhancerSetTargetGain(double targetGain) {
((LoudnessEnhancer)audioEffectsMap.get("AndroidLoudnessEnhancer")).setTargetGain(targetGainMillibels);
}

// dB = 0.1 bels | 0.8 = Equalize the level between ios and android
private short dbToMillibels(double value) {
return (short)(Math.round(value * 100.0 * 0.8));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: double space between return and (short).


// dB = 0.1 bels | 0.8 = Equalize the level between ios and android
private double millibelsToDb(int value) {
return (double)(Math.round(value / 100.0 / 0.8));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: double space between return and (double).


import Foundation
class NotSupportedError: PluginError {
var value: Any

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be let

import Foundation

class PluginError: Error {
var code: Int

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both properties can be let

fix: add missing index mappings for seek method
fix: wrong start/end parsing (presumed seconds received microseconds)
@mcosti
Copy link

mcosti commented Feb 6, 2024

Hi! Any updates on this PR? Would be great to have an equalizer for iOS as well. Thank you

@ryanheise ryanheise mentioned this pull request Feb 21, 2024
@skol101
Copy link

skol101 commented Mar 24, 2024

I can sponsor adding a few iOS features, namely setPitch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants