From b03a9da75002384d3b7b22f4753cd2c32c2773d9 Mon Sep 17 00:00:00 2001 From: shogo4405 Date: Fri, 15 Nov 2024 01:44:25 +0900 Subject: [PATCH] swiftlint --fix --format --- .../Mixer/AudioMixerByMultiTrackTests.swift | 142 +++++++++--------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/HaishinKit/Tests/Mixer/AudioMixerByMultiTrackTests.swift b/HaishinKit/Tests/Mixer/AudioMixerByMultiTrackTests.swift index 667ba1a4a..53245a50f 100644 --- a/HaishinKit/Tests/Mixer/AudioMixerByMultiTrackTests.swift +++ b/HaishinKit/Tests/Mixer/AudioMixerByMultiTrackTests.swift @@ -6,83 +6,83 @@ import Testing /* -@Suite struct AudioMixerByMultiTrackTests { - final class Result: AudioMixerDelegate { - var outputs: [AVAudioPCMBuffer] = [] - var error: AudioMixerError? + @Suite struct AudioMixerByMultiTrackTests { + final class Result: AudioMixerDelegate { + var outputs: [AVAudioPCMBuffer] = [] + var error: AudioMixerError? - func audioMixer(_ audioMixer: some AudioMixer, track: UInt8, didInput buffer: AVAudioPCMBuffer, when: AVAudioTime) { - } + func audioMixer(_ audioMixer: some AudioMixer, track: UInt8, didInput buffer: AVAudioPCMBuffer, when: AVAudioTime) { + } - func audioMixer(_ audioMixer: some AudioMixer, didOutput audioFormat: AVAudioFormat) { - } + func audioMixer(_ audioMixer: some AudioMixer, didOutput audioFormat: AVAudioFormat) { + } - func audioMixer(_ audioMixer: some AudioMixer, didOutput audioBuffer: AVAudioPCMBuffer, when: AVAudioTime) { - outputs.append(audioBuffer) - } + func audioMixer(_ audioMixer: some AudioMixer, didOutput audioBuffer: AVAudioPCMBuffer, when: AVAudioTime) { + outputs.append(audioBuffer) + } - func audioMixer(_ audioMixer: some AudioMixer, errorOccurred error: AudioMixerError) { - self.error = error - } - } + func audioMixer(_ audioMixer: some AudioMixer, errorOccurred error: AudioMixerError) { + self.error = error + } + } - @Test func keep44100() { - let result = Result() - let mixer = AudioMixerByMultiTrack() - mixer.delegate = result - mixer.settings = .init( - sampleRate: 44100, channels: 1 - ) - mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 1)!) - mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 1)!) - #expect(mixer.outputFormat?.sampleRate == 44100) - mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(44100, numSamples: 1024, channels: 1)!) - #expect(mixer.outputFormat?.sampleRate == 44100) - #expect(result.outputs.count == 2) - } + @Test func keep44100() { + let result = Result() + let mixer = AudioMixerByMultiTrack() + mixer.delegate = result + mixer.settings = .init( + sampleRate: 44100, channels: 1 + ) + mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 1)!) + mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 1)!) + #expect(mixer.outputFormat?.sampleRate == 44100) + mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(44100, numSamples: 1024, channels: 1)!) + #expect(mixer.outputFormat?.sampleRate == 44100) + #expect(result.outputs.count == 2) + } - @Test func test44100to48000() { - let mixer = AudioMixerByMultiTrack() - mixer.settings = .init( - sampleRate: 44100, channels: 1 - ) - mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 1)!) - #expect(mixer.outputFormat?.sampleRate == 44100) - mixer.settings = .init( - sampleRate: 48000, channels: 1 - ) - mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(44100, numSamples: 1024, channels: 1)!) - #expect(mixer.outputFormat?.sampleRate == 48000) - } + @Test func test44100to48000() { + let mixer = AudioMixerByMultiTrack() + mixer.settings = .init( + sampleRate: 44100, channels: 1 + ) + mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 1)!) + #expect(mixer.outputFormat?.sampleRate == 44100) + mixer.settings = .init( + sampleRate: 48000, channels: 1 + ) + mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(44100, numSamples: 1024, channels: 1)!) + #expect(mixer.outputFormat?.sampleRate == 48000) + } - @Test func test48000_2ch() { - let result = Result() - let mixer = AudioMixerByMultiTrack() - mixer.delegate = result - mixer.settings = .init( - sampleRate: 48000, channels: 2 - ) - mixer.append(1, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 2)!) - mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 2)!) - #expect(mixer.outputFormat?.channelCount == 2) - #expect(mixer.outputFormat?.sampleRate == 48000) - mixer.append(1, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 2)!) - mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 2)!) - #expect(result.outputs.count == 2) - #expect(result.error == nil) - } + @Test func test48000_2ch() { + let result = Result() + let mixer = AudioMixerByMultiTrack() + mixer.delegate = result + mixer.settings = .init( + sampleRate: 48000, channels: 2 + ) + mixer.append(1, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 2)!) + mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 2)!) + #expect(mixer.outputFormat?.channelCount == 2) + #expect(mixer.outputFormat?.sampleRate == 48000) + mixer.append(1, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 2)!) + mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 2)!) + #expect(result.outputs.count == 2) + #expect(result.error == nil) + } - @Test func inputFormats() { - let mixer = AudioMixerByMultiTrack() - mixer.settings = .init( - sampleRate: 44100, channels: 1 - ) - mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 1)!) - mixer.append(1, buffer: CMAudioSampleBufferFactory.makeSinWave(44100, numSamples: 1024, channels: 1)!) - let inputFormats = mixer.inputFormats - #expect(inputFormats[0]?.sampleRate == 48000) - #expect(inputFormats[1]?.sampleRate == 44100) - } -} + @Test func inputFormats() { + let mixer = AudioMixerByMultiTrack() + mixer.settings = .init( + sampleRate: 44100, channels: 1 + ) + mixer.append(0, buffer: CMAudioSampleBufferFactory.makeSinWave(48000, numSamples: 1024, channels: 1)!) + mixer.append(1, buffer: CMAudioSampleBufferFactory.makeSinWave(44100, numSamples: 1024, channels: 1)!) + let inputFormats = mixer.inputFormats + #expect(inputFormats[0]?.sampleRate == 48000) + #expect(inputFormats[1]?.sampleRate == 44100) + } + } -*/ + */