Skip to content

Commit

Permalink
merge: 'origin/dev' into 'feat/#13'
Browse files Browse the repository at this point in the history
  • Loading branch information
moral-life committed Nov 12, 2024
2 parents dd91756 + 072fb9a commit 7752410
Show file tree
Hide file tree
Showing 19 changed files with 985 additions and 0 deletions.
499 changes: 499 additions & 0 deletions ASAudioKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions ASAudioKit/ASAudioKit.docc/ASAudioKit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ``ASAudioKit``

<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->

## Overview

<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@-->

## Topics

### <!--@START_MENU_TOKEN@-->Group<!--@END_MENU_TOKEN@-->

- <!--@START_MENU_TOKEN@-->``Symbol``<!--@END_MENU_TOKEN@-->
18 changes: 18 additions & 0 deletions ASAudioKit/ASAudioKit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// ASAudioKit.h
// ASAudioKit
//
// Created by 박진성 on 11/11/24.
//

#import <Foundation/Foundation.h>

//! Project version number for ASAudioKit.
FOUNDATION_EXPORT double ASAudioKitVersionNumber;

//! Project version string for ASAudioKit.
FOUNDATION_EXPORT const unsigned char ASAudioKitVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <ASAudioKit/PublicHeader.h>


5 changes: 5 additions & 0 deletions ASAudioKit/ASAudioPlayer/ASAudioPlayer.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

class ASAudioPlayer {

}
42 changes: 42 additions & 0 deletions ASAudioKit/ASAudioRecorder/ASAudioRecorder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import AVFoundation

class ASAudioRecorder {
private var audioRecorder: AVAudioRecorder? = nil

func startRecording(url: URL) {
let settings = [
AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
AVSampleRateKey: 12000,
AVNumberOfChannelsKey: 1,
AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue
]

do {
audioRecorder = try AVAudioRecorder(url: url, settings: settings)
audioRecorder?.record()
} catch {
//TODO: AVAudioRecorder 객체 생성 실패 시에 대한 처리
}
}

func isRecording() -> Bool {
if let audioRecorder {
return audioRecorder.isRecording
}
return false
}

func stopRecording() -> Data? {
// 녹음 종료 시에 어디 저장되었는지 리턴해줄 필요가 있을 듯, 저장된 녹음파일을 network에 던져줄 필요가 있음.
audioRecorder?.stop()

guard let recordURL = audioRecorder?.url else {return nil}

do {
let recordData = try Data(contentsOf: recordURL)
return recordData
} catch {
return nil
}
}
}
18 changes: 18 additions & 0 deletions ASAudioKit/ASAudioRecorder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ASAudioRecorder

ASAudioRecorder 객체 생성
```swift
let recorder = ASAudioRecorder()
```

녹음 시작
```swift
let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
.appendingPathComponent("녹음성공테스트")
recorder.startRecording(url: url)
```

녹음 종료
```swift
recorder.stopRecording()
```
34 changes: 34 additions & 0 deletions ASAudioKitTests/ASAudioRecorderTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import Testing
import Foundation

struct ASAudioRecorderTests{
var recorder: ASAudioRecorder?

init() async throws {
recorder = ASAudioRecorder()
}

@Test func startRecording_성공() async throws {
let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
.appendingPathComponent("녹음성공테스트")
guard let recorder else {
#expect(false)
return
}
recorder.startRecording(url: url)
#expect(recorder.isRecording())
}

@Test func stopRecording_성공() async throws {
let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
.appendingPathComponent("녹음저장성공테스트")
guard let recorder else {
#expect(false)
return
}
recorder.startRecording(url: url)
recorder.stopRecording()
#expect(FileManager.default.fileExists(atPath: url.path))
}

}
65 changes: 65 additions & 0 deletions alsongDalsong.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,37 @@
objectVersion = 77;
objects = {

/* Begin PBXBuildFile section */
4E8907B42CE2415700D5B547 /* ASAudioKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E8907A52CE240B300D5B547 /* ASAudioKit.framework */; };
4E8907B52CE2415700D5B547 /* ASAudioKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4E8907A52CE240B300D5B547 /* ASAudioKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
4E8907A42CE240B300D5B547 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4E89079C2CE240B300D5B547 /* ASAudioKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 4E89071E2CE23D1B00D5B547;
remoteInfo = ASAudioKit;
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
4E8907B62CE2415800D5B547 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
4E8907B52CE2415700D5B547 /* ASAudioKit.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
4E89079C2CE240B300D5B547 /* ASAudioKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = ASAudioKit.xcodeproj; sourceTree = "<group>"; };
8D69A5922CDC5A83006B9075 /* alsongDalsong.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = alsongDalsong.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -36,16 +66,34 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4E8907B42CE2415700D5B547 /* ASAudioKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
4E89079D2CE240B300D5B547 /* Products */ = {
isa = PBXGroup;
children = (
4E8907A52CE240B300D5B547 /* ASAudioKit.framework */,
);
name = Products;
sourceTree = "<group>";
};
4E8907B32CE2415700D5B547 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
8D69A5892CDC5A83006B9075 = {
isa = PBXGroup;
children = (
4E89079C2CE240B300D5B547 /* ASAudioKit.xcodeproj */,
8D69A5942CDC5A83006B9075 /* alsongDalsong */,
4E8907B32CE2415700D5B547 /* Frameworks */,
8D69A5932CDC5A83006B9075 /* Products */,
);
sourceTree = "<group>";
Expand All @@ -68,6 +116,7 @@
8D69A58E2CDC5A83006B9075 /* Sources */,
8D69A58F2CDC5A83006B9075 /* Frameworks */,
8D69A5902CDC5A83006B9075 /* Resources */,
4E8907B62CE2415800D5B547 /* Embed Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -110,13 +159,29 @@
preferredProjectObjectVersion = 77;
productRefGroup = 8D69A5932CDC5A83006B9075 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 4E89079D2CE240B300D5B547 /* Products */;
ProjectRef = 4E89079C2CE240B300D5B547 /* ASAudioKit.xcodeproj */;
},
);
projectRoot = "";
targets = (
8D69A5912CDC5A83006B9075 /* alsongDalsong */,
);
};
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
4E8907A52CE240B300D5B547 /* ASAudioKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = ASAudioKit.framework;
remoteRef = 4E8907A42CE240B300D5B547 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
8D69A5902CDC5A83006B9075 /* Resources */ = {
isa = PBXResourcesBuildPhase;
Expand Down
38 changes: 38 additions & 0 deletions alsongDalsong/Assets.xcassets/asGreen.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.063",
"green" : "0.835",
"red" : "0.165"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.063",
"green" : "0.835",
"red" : "0.165"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
38 changes: 38 additions & 0 deletions alsongDalsong/Assets.xcassets/asLightGray.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.945",
"green" : "0.941",
"red" : "0.925"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.945",
"green" : "0.941",
"red" : "0.925"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
38 changes: 38 additions & 0 deletions alsongDalsong/Assets.xcassets/asLightRed.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.478",
"green" : "0.478",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.478",
"green" : "0.478",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit 7752410

Please sign in to comment.