Platforms to show: All Mac Windows Linux Cross-Platform

Back to PortAudioMBS class.

PortAudioMBS.ASIOGetAvailableBufferSizes(DeviceIndex as Integer, byref minBufferSizeFrames as Integer, byref maxBufferSizeFrames as Integer, byref preferredBufferSizeFrames as Integer, byref granularity as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 20.0 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Retrieve legal native buffer sizes for the specificed device, in sample frames.

device: The global index of the device about which the query is being made.

minBufferSizeFrames: The minimum buffer size value.
maxBufferSizeFrames: The maximum buffer size value.
preferredBufferSizeFrames: The preferred buffer size value.
granularity: The "granularity". This value determines the step size used to compute the legal values between minBufferSizeFrames and maxBufferSizeFrames.

If granularity is -1 then available buffer size values are powers of two.

see ASIOGetBufferSize in the ASIO SDK.

PortAudioMBS.ASIOGetInputChannelName(DeviceIndex as Integer, ChannelIndex as Integer) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 20.0 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Queries name of input channel.
Example
Dim po As New PortAudioMBS

// find ASIO device
Dim defaultASIOInputDevice As Integer

Dim hc As Integer = po.HostApiCount
For hi As Integer = 0 To hc
Dim host As PortAudioHostApiInfoMBS = po.HostApiInfo(hi)
If host<>Nil And host.Type = po.kHostApiASIO Then
defaultASIOInputDevice = host.defaultInputDevice
End If
Next

// show channel names
D2im names As String
Dim de As PortAudioDeviceInfoMBS = po.DeviceInfo(defaultASIOInputDevice)
For i As Integer = 0 To de.maxInputChannels-1
names.Append po.ASIOGetInputChannelName(defaultASIOInputDevice,i)
Next

MsgBox Join(names, EndOfLine)

The string will be no longer than 32 characters.

PortAudioMBS.ASIOGetOutputChannelName(DeviceIndex as Integer, ChannelIndex as Integer) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 20.0 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Queries name of output channel.
Example
Dim po As New PortAudioMBS

// find ASIO device
Dim defaultASIOOutputDevice As Integer

Dim hc As Integer = po.HostApiCount
For hi As Integer = 0 To hc
Dim host As PortAudioHostApiInfoMBS = po.HostApiInfo(hi)
If host<>Nil And host.Type = po.kHostApiASIO Then
defaultASIOOutputDevice = host.defaultOutputDevice
End If
Next

// show channel names
D2im names As String
Dim de As PortAudioDeviceInfoMBS = po.DeviceInfo(defaultASIOOutputDevice)
For i As Integer = 0 To de.maxOutputChannels-1
names.Append po.ASIOGetOutputChannelName(defaultASIOOutputDevice,i)
Next

MsgBox Join(names, EndOfLine)

The string will be no longer than 32 characters.

PortAudioMBS.ASIOGetSampleRate(byref rate as double) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Queries current sample rate.
Example
Dim d As Double
Dim n As Integer

n = PortAudioMBS.ASIOGetSampleRate(d)

If n = 0 Then
MsgBox Str(d)
Else
MsgBox "Error: "+Str(n)
End If

Rate will hold the current sample rate on return.
Returns error code.
If sample rate is unknown, sampleRate will be 0 and ASE_NoClock will be returned.
If no input/output is present ASE_NotPresent (-1000) will be returned.

PortAudioMBS.ASIOShowControlPanel(device as integer, parentWindow as DesktopWindow) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 22.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop only
Display the ASIO control panel for the specified device.

device: The global index of the device whose control panel is to be displayed.
parentWindow: On Windows, the calling application's main window handle or nil.

See also:

PortAudioMBS.ASIOShowControlPanel(device as integer, parentWindow as window = nil) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 20.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop only
Display the ASIO control panel for the specified device.
Example
Dim po As New PortAudioMBS

// find ASIO device
Dim defaultASIOOutputDevice As Integer

Dim hc As Integer = po.HostApiCount
For hi As Integer = 0 To hc
Dim host As PortAudioHostApiInfoMBS = po.HostApiInfo(hi)
If host<>Nil And host.Type = po.kHostApiASIO Then
defaultASIOOutputDevice = host.defaultOutputDevice
End If
Next

// show dialog
Call po.ASIOShowControlPanel(defaultASIOOutputDevice, window1)

device: The global index of the device whose control panel is to be displayed.
parentWindow: On Windows, the calling application's main window handle or nil.

See also:

PortAudioMBS.DisableHostAPI(API as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 12.1 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Disables a PortAudio Host API.
Example
if PortAudioMBS.DisableHostAPI("Core Audio") then // for Mac
MsgBox "OK"
else
MsgBox "Failed"
end if

This must be called before using any PortAudio function.
It removes the API from the list of APIs to be used when PortAudio initializes. This way you can avoid loading interfaces you don't need.
API name can be "MME", "Windows DirectSound", "Windows WASAPI", "ASIO", "Core Audio", "ALSA", "OSS".
Returns true on success.

PortAudioMBS.MacCoreAudioChannelName(DeviceIndex as Integer, ChannelIndex as Integer, Input as Boolean) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 20.0 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Queries channel name.

PortAudioMBS.MacCoreAudioGetBufferSizeRange(DeviceIndex as Integer, byref minBufferSizeFrames as Integer, byref maxBufferSizeFrames as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 20.0 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Retrieve the range of legal native buffer sizes for the specificed device, in sample frames.

device: The global index of the PortAudio device about which the query is being made.
minBufferSizeFrames: The minimum buffer size value.
maxBufferSizeFrames: The maximum buffer size value.

see kAudioDevicePropertyBufferFrameSizeRange in the CoreAudio SDK.

PortAudioMBS.SetDebugLogFile(File as FolderItem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 16.5 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Sets the debug file to log all PortAudio calls with parameters.

Pass nil to stop logging.
Returns true on success or false on failure.

Some examples using this method:

PortAudioMBS.Version as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 7.0 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Retrieve the release number of the currently running PortAudio build.

e.g. 1900

PortAudioMBS.VersionControlRevision as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 16.5 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Retrieve a version control revision text.

PortAudioMBS.VersionText as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 7.0 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Retrieve a textual description of the current PortAudio build.

e.g. "PortAudio V19-devel 13 October 2002"

PortAudioMBS.WinDefaultChannelMask(numChannels as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Audio MBS Audio Plugin 20.0 ❌ No ✅ Yes ❌ No ❌ No All
Map a channel count to a speaker channel mask for Windows.

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


The biggest plugin in space...