This file contains hidden or 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
| func startRecord() { | |
| // 出力ファイルパスを初期化、録音中に設定 | |
| self.filePath = nil | |
| self.isRec = true | |
| // Audio Sessionを再生&録音モードに変更 | |
| try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord) | |
| try! AVAudioSession.sharedInstance().setActive(true) |
This file contains hidden or 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
| audioEngine.inputNode!.installTap(onBus: 0, bufferSize: AVAudioFrameCount(format.sampleRate * 0.4), format: format, block: { (buffer: AVAudioPCMBuffer!, time: AVAudioTime!) -> Void in | |
| let converter = AVAudioConverter.init(from: format, to: downFormat) | |
| let newbuffer = AVAudioPCMBuffer(pcmFormat: downFormat, | |
| frameCapacity: AVAudioFrameCount(downFormat.sampleRate * 0.4)) | |
| let inputBlock : AVAudioConverterInputBlock = { (inNumPackets, outStatus) -> AVAudioBuffer? in | |
| outStatus.pointee = AVAudioConverterInputStatus.haveData | |
| let audioBuffer : AVAudioBuffer = buffer | |
| return audioBuffer | |
| } |
This file contains hidden or 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
| func reverbControl(onoff: Bool) { | |
| let status = playerNode.isPlaying | |
| offsetFrame = Int(self.slider.value) | |
| if status { | |
| playerNode.pause() |
This file contains hidden or 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
| let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext | |
| for obj in self.item { | |
| context.delete(obj) | |
| } | |
| do { | |
| try context.save() | |
| } catch { | |
| print(String(format: "Error %@: %d",#file, #line)) | |
| } |
This file contains hidden or 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
| let fetchRequest: NSFetchRequest<Staff> = Staff.fetchRequest() | |
| if self.manager != nil { | |
| fetchRequest.predicate = NSPredicate(format: "manager = %@", self.manager!) | |
| } | |
| do { | |
| item = try (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext.fetch(fetchRequest) | |
| } catch { | |
| print(String(format: "Error %@: %d",#file, #line)) | |
| } |
This file contains hidden or 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
| let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext | |
| let manager = Manager(context: context) | |
| let textField = alert.textFields![0] as UITextField | |
| if textField.text != "" { | |
| manager.name = textField.text | |
| } else { | |
| manager.name = String(self.item.count+1) | |
| } | |
| manager.date = NSDate() |
This file contains hidden or 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
| func loadCoreData() { | |
| let fetchRequest: NSFetchRequest<Manager> = Manager.fetchRequest() | |
| do { | |
| self.item = try (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext.fetch(fetchRequest) | |
| } catch { | |
| print(String(format: "Error %@: %d",#file, #line)) | |
| } | |
| } |
This file contains hidden or 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
| func loadCoreData() { | |
| let fetchRequest: NSFetchRequest<Manager> = Manager.fetchRequest() | |
| do { | |
| self.item = try (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext.fetch(fetchRequest) | |
| } catch { | |
| print(String(format: "Error %@: %d",#file, #line)) | |
| } | |
| } |
NewerOlder