Platforms to show: All Mac Windows Linux Cross-Platform

Back to PortAudioStreamMBS class.

PortAudioStreamMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Audio MBS Audio Plugin 20.1 ✅ Yes ✅ Yes ✅ Yes ❌ No All
The constructor.

PortAudioStreamMBS.OpenDefaultStream(numInputChannels as Integer, numOutputChannels as Integer, sampleFormat as Integer, sampleRate as Double, framesPerBuffer as Integer, Flags as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Audio MBS Audio Plugin 7.0 ✅ Yes ✅ Yes ✅ Yes ❌ No All
A simplified version of OpenStream() that opens the default input and/or output devices.

numInputChannels: The number of channels of sound that will be supplied to the stream callback or returned by ReadStream. It can range from 1 to the value of maxInputChannels in the PaDeviceInfo record for the default input device. If 0 the stream is opened as an output-only stream.

numOutputChannels: The number of channels of sound to be delivered to the stream callback or passed to Write. It can range from 1 to the value of maxOutputChannels in the PaDeviceInfo record for the default output dvice. If 0 the stream is opened as an output-only stream.

sampleFormat: The sample format of both the input and output buffers provided to the callback or passed to and from Read and Write.
sampleFormat may be any of the formats described by the PaSampleFormat enumeration.

sampleRate: Same as OpenStream parameter of the same name.
framesPerBuffer: Same as OpenStream parameter of the same name.

constants for the flags value:
const paNoFlag= 0no flags
const paClipOff= 1Disable default clipping of out of range samples.
const paDitherOff= 2Flag requests that where possible a full duplex stream will not discard overflowed input samples without calling the stream callback. This flag is only valid for full duplex callback streams and only when used in combination with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using this flag incorrectly results in a paInvalidFlag error being returned from OpenStream and OpenDefaultStream.
const paNeverDropInput= 4Flag requests that where possible a full duplex stream will not discard overflowed input samples without calling the stream callback. This flag is only valid for full duplex callback streams and only when used in combination with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using this flag incorrectly results in a paInvalidFlag error being returned from OpenStream and OpenDefaultStream.
const paPrimeOutputBuffersUsingStreamCallback= 8Call the stream callback to fill initial output buffers, rather than the default behavior of priming the buffers with zeros (silence). This flag has no effect for input-only and blocking read/write streams.

Returns an error code.

PortAudioStreamMBS.OpenStream(inputParameters as PortAudioStreamParametersMBS, outputParameters as PortAudioStreamParametersMBS, sampleRate as Double, framesPerBuffer as Integer, streamFlags as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Audio MBS Audio Plugin 7.0 ✅ Yes ✅ Yes ✅ Yes ❌ No All
Opens a stream for either input, output or both.

inputParameters: A object that describes the input parameters used by the opened stream. See PortAudioStreamParametersMBS for a description of these parameters. inputParameters must be nil for output-only streams.

outputParameters: A object that describes the output parameters used by the opened stream. See PortAudioStreamParametersMBS for a description of these parameters. outputParameters must be nil for input-only streams.

sampleRate: The desired sampleRate. For full-duplex streams it is the sample rate for both input and output

framesPerBuffer: The number of frames passed to the stream callback function, or the preferred block granularity for a blocking read/write stream. The special value paFramesPerBufferUnspecified (0) may be used to request that the stream callback will recieve an optimal (and possibly varying) number of frames based on host requirements and the requested latency settings.
Note: With some host APIs, the use of non-zero framesPerBuffer for a callback stream may introduce an additional layer of buffering which could introduce additional latency. PortAudio guarantees that the additional latency will be kept to the theoretical minimum however, it is strongly recommended that a non-zero framesPerBuffer value only be used when your algorithm requires a fixed number of frames per stream callback.

const paFramesPerBufferUnspecified=0

streamFlags: Flags which modify the behaviour of the streaming process. This parameter may contain a combination of flags ORed together. Some flags may only be relevant to certain buffer formats.

const paNoFlag= 0no flags
const paClipOff= 1Disable default clipping of out of range samples.
const paDitherOff= 2Flag requests that where possible a full duplex stream will not discard overflowed input samples without calling the stream callback. This flag is only valid for full duplex callback streams and only when used in combination with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using this flag incorrectly results in a paInvalidFlag error being returned from OpenStream and OpenDefaultStream.
const paNeverDropInput= 4Flag requests that where possible a full duplex stream will not discard overflowed input samples without calling the stream callback. This flag is only valid for full duplex callback streams and only when used in combination with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using this flag incorrectly results in a paInvalidFlag error being returned from OpenStream and OpenDefaultStream.
const paPrimeOutputBuffersUsingStreamCallback= 8Call the stream callback to fill initial output buffers, rather than the default behavior of priming the buffers with zeros (silence). This flag has no effect for input-only and blocking read/write streams.

If this the callback event is left empty the stream will be opened in 'blocking read/write' mode. In blocking mode, the client can receive sample data using Read and write sample data using Write, the number of samples that may be read or written without blocking is returned by ReadAvailable and WriteAvailable respectively.

Upon success OpenStream() returns paNoError and places a pointer to a valid PaStream in the stream argument. The stream is inactive (stopped).
If a call to OpenStream() fails, a non-zero error code is returned (see PaError for possible error codes) and the value of stream is invalid.

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


The biggest plugin in space...