Platforms to show: All Mac Windows Linux Cross-Platform

/MacOSX/CoreAudio/CoreAudio Events


Required plugins for this example: MBS MacOSX Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacOSX/CoreAudio/CoreAudio Events

This example is the version from Thu, 25th Dec 2019.

Project "CoreAudio Events.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
EventHandler Sub Open() dim kAudioObjectSystemObject as UInt32 = 1 dim kAudioHardwarePropertyDefaultSystemOutputDevice as UInt32 = TextToInteger("sOut") dim kAudioObjectPropertyScopeGlobal as UInt32 = TextToInteger("glob") dim kAudioObjectPropertyElementMaster as UInt32 = 0 dim kAudioHardwarePropertyDevices as UInt32 = TextToInteger("dev#") dim kAudioHardwarePropertyDefaultOutputDevice as UInt32 = TextToInteger("dOut") c = new MyCoreAudioListenerMBS(kAudioObjectSystemObject, kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster) if c.LastError = 0 then Listbox1.AddRow "Listening: OK" else Listbox1.AddRow "Listening: "+str(c.LastError) end if // check current device via AUPlayerMBS class a = new AUPlayerMBS dim dic as Dictionary = a.OutputDevices dim name as string = dic.Value(a.DefaultDeviceID) Listbox1.AddRow "Current device: "+name End EventHandler
Sub Changed() window1.Listbox1.AddRow CurrentMethodName dim dic as Dictionary = a.OutputDevices dim name as string = dic.Value(a.DefaultDeviceID) Listbox1.AddRow "Current device: "+name End Sub
Function TextToInteger(t as string) As UInt32 // convert text constant to number dim t1 as string = midb(t, 1, 1) dim t2 as string = midb(t, 2, 1) dim t3 as string = midb(t, 3, 1) dim t4 as string = midb(t, 4, 1) dim v1 as UInt32 = ascb(t1) dim v2 as UInt32 = ascb(t2) dim v3 as UInt32 = ascb(t3) dim v4 as UInt32 = ascb(t4) Return ((v1 * 256 + v2) * 256 + v3) * 256 + v4 End Function
Property a As AUPlayerMBS
Property c As MyCoreAudioListenerMBS
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 MyCoreAudioListenerMBS Inherits CoreAudioListenerMBS
EventHandler Sub Changed() window1.Changed End EventHandler
End Class
End Project

See also:

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


The biggest plugin in space...