-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62f37fc
commit f9fb311
Showing
11 changed files
with
137 additions
and
35 deletions.
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
Binary file modified
BIN
+6.31 KB
(100%)
....xcodeproj/project.xcworkspace/xcuserdata/kven.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
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
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
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
44 changes: 44 additions & 0 deletions
44
Source/Core/AudioGraph/EffectsUnits/ReplayGain/LoudnessScan/ReplayGainScanner.swift
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,44 @@ | ||
// | ||
// ReplayGainScanner.swift | ||
// Aural | ||
// | ||
// Copyright © 2021 Kartik Venugopal. All rights reserved. | ||
// | ||
// This software is licensed under the MIT software license. | ||
// See the file "LICENSE" in the project root directory for license terms. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol EBUR128LoudnessScannerProtocol { | ||
|
||
var file: URL {get} | ||
|
||
func scan(_ completionHandler: @escaping (EBUR128AnalysisResult?) -> Void) | ||
} | ||
|
||
class ReplayGainScanner { | ||
|
||
let file: URL | ||
let scanner: EBUR128LoudnessScannerProtocol | ||
|
||
init(file: URL) throws { | ||
|
||
self.file = file | ||
scanner = file.isNativelySupported ? try AVFReplayGainScanner(file: file) : try FFmpegReplayGainScanner(file: file) | ||
} | ||
|
||
func scan(_ completionHandler: @escaping (ReplayGain?) -> Void) { | ||
|
||
lazy var filePath = file.path | ||
|
||
scanner.scan {ebur128Result in | ||
|
||
if let theResult = ebur128Result { | ||
completionHandler(ReplayGain(ebur128AnalysisResult: theResult)) | ||
} else { | ||
completionHandler(nil) | ||
} | ||
} | ||
} | ||
} |
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
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
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
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
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