Platforms to show: All Mac Windows Linux Cross-Platform

/MacOSX/AUPlayer


Required plugins for this example: MBS Picture Plugin, MBS MacOSX Plugin

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

This example is the version from Fri, 5th Jun 2014.

Project "AUPlayer.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() dim f as FolderItem = GetOpenFolderItem(AudioFileTypes.All) if f = nil then Return p = new AUPlayerMBS if p.LoadFile(f) then // ok SliderPosition.Value = 0 dim l as Double = p.TrackLength SliderPosition.Maximum = l SliderLoopIn.Maximum = l SliderLoopOut.Maximum = l p.TimeRate = 1.0 p.PitchRate = 0.0 p.pan = 0 p.Loopin = 0 p.LoopOut = l p.LoopIng = false p.InputEnabled(0) = true p.InputEnabled(1) = true p.InputVolume(0) = 1.0 p.InputVolume(1) = 1.0 p.OutputVolume = 0.5 'MsgBox str(p.InputVolume(0))+" "+str(p.OutputVolume)+" "+stR(p.InputEnabled(0)) if p.DataIsFloat and p.DataSampleWordSize = 4 then dim d as MemoryBlock = p.Data dim count as integer = d.size / 4 // 4 bytes per Float32 value SamplesGraph.Backdrop = RenderSamplesMBS(d, count, 0, SamplesGraph.Width, SamplesGraph.Height, 1, &c88B5C4, &c274C5A, &c203F4E, -32) end if LabelLength.Text = str(l) ready = true else MsgBox "Failed to load with error: "+str(p.LastError) p = nil end if End EventHandler
End Control
Control Playbutton Inherits PushButton
ControlInstance Playbutton Inherits PushButton
EventHandler Sub Action() me.Enabled = false if p<>Nil then p.play end if End EventHandler
End Control
Control Pausebutton Inherits PushButton
ControlInstance Pausebutton Inherits PushButton
EventHandler Sub Action() me.Enabled = false if p<>nil then p.Pause end if End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control LabelLength Inherits Label
ControlInstance LabelLength Inherits Label
End Control
Control LabelPosition Inherits Label
ControlInstance LabelPosition Inherits Label
End Control
Control SliderPosition Inherits Slider
ControlInstance SliderPosition Inherits Slider
EventHandler Sub ValueChanged() if ready then dim v as Double = me.Value LabelPosition.Text = str(v) p.CurrentTime = v dim e as integer = p.Lasterror if e <> 0 then Break end if end if End EventHandler
End Control
Control LabelLoopIn Inherits Label
ControlInstance LabelLoopIn Inherits Label
End Control
Control SliderLoopIn Inherits Slider
ControlInstance SliderLoopIn Inherits Slider
EventHandler Sub ValueChanged() dim value as Double = me.Value LabelLoopIn.text = str(Value) if not ready then Return p.LoopIn = value End EventHandler
End Control
Control Label6 Inherits Label
ControlInstance Label6 Inherits Label
End Control
Control Label7 Inherits Label
ControlInstance Label7 Inherits Label
End Control
Control LabelLoopOut Inherits Label
ControlInstance LabelLoopOut Inherits Label
End Control
Control SliderLoopOut Inherits Slider
ControlInstance SliderLoopOut Inherits Slider
EventHandler Sub ValueChanged() dim value as Double = me.Value LabelLoopout.text = str(Value) if not ready then Return p.Loopout = value End EventHandler
End Control
Control CheckLooping Inherits CheckBox
ControlInstance CheckLooping Inherits CheckBox
EventHandler Sub Action() if not ready then Return p.Looping = me.Value End EventHandler
End Control
Control CheckInputEnabled Inherits CheckBox
ControlInstance CheckInputEnabled(0) Inherits CheckBox
EventHandler Sub Action(index as Integer) if not Ready then Return p.InputEnabled(0) = me.Value dim e as integer = p.Lasterror if e <> 0 then Break end if End EventHandler
End Control
Control LabelInputVolume Inherits Label
ControlInstance LabelInputVolume(0) Inherits Label
ControlInstance LabelInputVolume(1) Inherits Label
End Control
Control SliderInputVolume Inherits Slider
ControlInstance SliderInputVolume(0) Inherits Slider
ControlInstance SliderInputVolume(1) Inherits Slider
EventHandler Sub ValueChanged(index as Integer) dim value as Double = (me.Value / 100.0) LabelInputVolume(index).text = str(Value) if not ready then Return p.InputVolume(index) = value dim e as integer = p.Lasterror if e <> 0 then Break end if End EventHandler
End Control
Control MeterBar Inherits ProgressBar
ControlInstance MeterBar Inherits ProgressBar
End Control
Control Label11 Inherits Label
ControlInstance Label11 Inherits Label
End Control
Control LabelOutputVolume Inherits Label
ControlInstance LabelOutputVolume Inherits Label
End Control
Control SliderOutputVolume Inherits Slider
ControlInstance SliderOutputVolume Inherits Slider
EventHandler Sub ValueChanged() dim value as Double = (me.Value / 100.0) LabelOutputVolume.text = str(Value) if not ready then Return p.OutputVolume = value dim e as integer = p.Lasterror if e <> 0 then Break end if End EventHandler
End Control
Control LabelPitchRate Inherits Label
ControlInstance LabelPitchRate Inherits Label
End Control
Control Label14 Inherits Label
ControlInstance Label14 Inherits Label
End Control
Control SliderPitchRate Inherits Slider
ControlInstance SliderPitchRate Inherits Slider
EventHandler Sub ValueChanged() dim value as Double = floor(me.Value) LabelPitchRate.text = str(Value) if not ready then Return p.PitchRate = value dim e as integer = p.Lasterror if e <> 0 then Break end if End EventHandler
End Control
Control LabelTimerate Inherits Label
ControlInstance LabelTimerate Inherits Label
End Control
Control Label16 Inherits Label
ControlInstance Label16 Inherits Label
End Control
Control SliderTimeRate Inherits Slider
ControlInstance SliderTimeRate Inherits Slider
EventHandler Sub ValueChanged() dim value as Double = me.Value / 100.0 LabelTimerate.Text = str(value) if not ready then Return if value < 0.25 then value = 0.25 end if p.TimeRate = value dim e as integer = p.Lasterror if e <> 0 then Break end if End EventHandler
End Control
Control Label17 Inherits Label
ControlInstance Label17 Inherits Label
End Control
Control Label18 Inherits Label
ControlInstance Label18 Inherits Label
End Control
Control Label19 Inherits Label
ControlInstance Label19 Inherits Label
End Control
Control Label20 Inherits Label
ControlInstance Label20 Inherits Label
End Control
Control EqualizerSlider Inherits Slider
ControlInstance EqualizerSlider(0) Inherits Slider
ControlInstance EqualizerSlider(1) Inherits Slider
ControlInstance EqualizerSlider(2) Inherits Slider
ControlInstance EqualizerSlider(3) Inherits Slider
ControlInstance EqualizerSlider(4) Inherits Slider
ControlInstance EqualizerSlider(5) Inherits Slider
ControlInstance EqualizerSlider(6) Inherits Slider
ControlInstance EqualizerSlider(7) Inherits Slider
ControlInstance EqualizerSlider(8) Inherits Slider
ControlInstance EqualizerSlider(9) Inherits Slider
ControlInstance EqualizerSlider(10) Inherits Slider
ControlInstance EqualizerSlider(11) Inherits Slider
ControlInstance EqualizerSlider(12) Inherits Slider
ControlInstance EqualizerSlider(13) Inherits Slider
ControlInstance EqualizerSlider(14) Inherits Slider
ControlInstance EqualizerSlider(15) Inherits Slider
ControlInstance EqualizerSlider(16) Inherits Slider
ControlInstance EqualizerSlider(17) Inherits Slider
ControlInstance EqualizerSlider(18) Inherits Slider
ControlInstance EqualizerSlider(19) Inherits Slider
ControlInstance EqualizerSlider(20) Inherits Slider
ControlInstance EqualizerSlider(21) Inherits Slider
ControlInstance EqualizerSlider(22) Inherits Slider
ControlInstance EqualizerSlider(23) Inherits Slider
ControlInstance EqualizerSlider(24) Inherits Slider
ControlInstance EqualizerSlider(25) Inherits Slider
ControlInstance EqualizerSlider(26) Inherits Slider
ControlInstance EqualizerSlider(27) Inherits Slider
ControlInstance EqualizerSlider(28) Inherits Slider
ControlInstance EqualizerSlider(29) Inherits Slider
ControlInstance EqualizerSlider(30) Inherits Slider
ControlInstance EqualizerSlider(31) Inherits Slider
ControlInstance EqualizerSlider(32) Inherits Slider
EventHandler Sub ValueChanged(index as Integer) if not ready then Return dim values() as Double for i as integer = 0 to 31 values.Append EqualizerSlider(i).Value / 10.0 next p.updateEQ values End EventHandler
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() if p<>Nil then ready = false dim v as Double = p.MeterLevel if v >= -120 then // ok else v = -120 end if MeterBar.Value = 120 + v v = p.CurrentTime SliderPosition.Value = v LabelPosition.Text = str(v, "0.0") dim Playing as Boolean = p.Playing if Playing then if not Pausebutton.Enabled then Pausebutton.Enabled = true end if else if not Playbutton.Enabled then Playbutton.Enabled = true end if end if ready = true end if End EventHandler
End Control
Control CheckInputEnabled1 Inherits CheckBox
ControlInstance CheckInputEnabled1(1) Inherits CheckBox
EventHandler Sub Action(index as Integer) if not Ready then Return p.InputEnabled(index) = me.Value dim e as integer = p.Lasterror if e <> 0 then Break end if End EventHandler
End Control
Control SliderPan Inherits Slider
ControlInstance SliderPan Inherits Slider
EventHandler Sub ValueChanged() dim value as Double = me.Value / 100.0 LabelPan.Text = str(value) if not ready then Return p.pan = value dim e as integer = p.Lasterror if e <> 0 then Break end if End EventHandler
End Control
Control LabelPan Inherits Label
ControlInstance LabelPan Inherits Label
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Control SamplesGraph Inherits Canvas
ControlInstance SamplesGraph Inherits Canvas
End Control
Property Ready As Boolean
Property p As AUPlayerMBS
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
AudioFileTypes
Filetype audio/mp3
Filetype video/quicktime
Filetype video/mpeg
Filetype audio/aiff
Filetype audio/aac
Filetype audio/basic
Filetype audio/m4a
Filetype audio/mp4
Filetype audio/mpeg3
Filetype audio/x-wav
End AudioFileTypes
End Project

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


The biggest plugin in space...