Platforms to show: All Mac Windows Linux Cross-Platform

/AVFoundation/AVAudioRecorder


Required plugins for this example: MBS AVFoundation Plugin, MBS Util Plugin, MBS MacCG Plugin, MBS MacCF Plugin, MBS Main Plugin, MBS MacBase Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /AVFoundation/AVAudioRecorder

This example is the version from Mon, 30th Jun 2013.

Project "AVAudioRecorder.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control BevelButton1 Inherits BevelButton
ControlInstance BevelButton1 Inherits BevelButton
EventHandler Sub Action() run End EventHandler
End Control
EventHandler Sub Open() AVFoundation = new MyAVFoundationMBS End EventHandler
Sub Run() dim f as FolderItem = SpecialFolder.Desktop.Child("test.caf") dim recordSetting as new Dictionary dim n as integer = OSTypeFromStringMBS(AVFoundation.kAudioFormatLinearPCM) recordSetting.Value(AVFoundationMBS.AVFormatIDKey) = n recordSetting.Value(AVFoundationMBS.AVSampleRateKey) = 44100.0 recordSetting.Value(AVFoundationMBS.AVNumberOfChannelsKey) = 2 recordSetting.Value(AVFoundationMBS.AVLinearPCMBitDepthKey) = 16 recordSetting.Value(AVFoundationMBS.AVLinearPCMIsBigEndianKey) = false recordSetting.Value(AVFoundationMBS.AVLinearPCMIsFloatKey) = false dim error as NSErrorMBS recorder = new AVAudioRecorderMBS(f, nil, error) if error<>Nil then MsgBox error.LocalizedDescription Return end if if recorder.recordForDuration(10) then // ok AVFoundation.CurrentFile = f else MsgBox "Failed to start recording." end if End Sub
Property AVFoundation As MyAVFoundationMBS
Property recorder As AVAudioRecorderMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyAVFoundationMBS Inherits AVFoundationMBS
EventHandler Sub audioRecorderDidFinishRecording(recorder as AVAudioRecorderMBS, successful as boolean) if successful then CurrentFile.Launch end if End EventHandler
EventHandler Sub audioRecorderEncodeErrorDidOccur(recorder as AVAudioRecorderMBS, error as NSErrorMBS) MsgBox "Failed to encode recording: "+error.LocalizedDescription End EventHandler
Property CurrentFile As FolderItem
End Class
End Project

The items on this page are in the following plugins: MBS AVFoundation Plugin.


The biggest plugin in space...