Platforms to show: All Mac Windows Linux Cross-Platform
Back to AVAudioPlayerMBS class.
AVAudioPlayerMBS.averagePowerForChannel(channel as Integer) as Double
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
channelNumber: The audio channel whose average power value you want to obtain. Channel numbers are zero-indexed. A monaural signal, or the left channel of a stereo signal, has channel number 0.
Returns a floating-point representation, in decibels, of a given audio channel's current average power. A return value of 0 dB indicates full scale, or maximum power; a return value of -160 dB indicates minimum power (that is, near silence).
If the signal provided to the audio player exceeds ±full scale, then the return value may exceed 0 (that is, it may enter the positive range).
To obtain a current average power value, you must call the updateMeters method before calling this method.
AVAudioPlayerMBS.Constructor(Data as MemoryBlock, byref error as NSErrorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
data: A block of data containing a sound to play. The audio data must be in a format supported by Core Audio. For a list of supported formats, see "Using Audio" in Multimedia Programming Guide.
Error: Pass in the address of a nil-initialized NSError object. If an error occurs, upon return the NSError object describes the error. If you do not want error information, pass in NULL.
On success, you get an initialized AVAudioPlayer object. Else the handle property is 0 and the Error parameter contains a code that describes the problem.
See also:
- Constructor(Data as MemoryBlock, fileTypeHintUtiString as string, byref error as NSErrorMBS)
- Constructor(File as folderitem, byref error as NSErrorMBS)
- Constructor(File as folderitem, fileTypeHintUtiString as string, byref error as NSErrorMBS)
- Constructor(URL as string, byref error as NSErrorMBS)
- Constructor(URL as string, fileTypeHintUtiString as string, byref error as NSErrorMBS)
AVAudioPlayerMBS.Constructor(Data as MemoryBlock, fileTypeHintUtiString as string, byref error as NSErrorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 14.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
data: The data object containing the audio.
fileTypeHintUtiString: A UTI that is used as a file type hint. The supported UTIs are defined in File Format UTIs.
error: If an error occurs, upon return the NSError object describes the error.
The utiString file type hint tells the parser what kind of sound data to expect so that data that may possibly be corrupt, can be successfully parsed.
Available in OS X v10.9 and later, but plugin calls variant without filetypehint on older versins.
See also:
- Constructor(Data as MemoryBlock, byref error as NSErrorMBS)
- Constructor(File as folderitem, byref error as NSErrorMBS)
- Constructor(File as folderitem, fileTypeHintUtiString as string, byref error as NSErrorMBS)
- Constructor(URL as string, byref error as NSErrorMBS)
- Constructor(URL as string, fileTypeHintUtiString as string, byref error as NSErrorMBS)
AVAudioPlayerMBS.Constructor(File as folderitem, byref error as NSErrorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
File: A folderitem identifying the sound file to play. The audio data must be in a format supported by Core Audio. For a list of supported formats, see "Using Audio" in Multimedia Programming Guide.
Error: If an error occurs, upon return the NSError object describes the error..
On success, you have an initialized AVAudioPlayer object. On failure, the Error parameter contains a code that describes the problem.
See also:
- Constructor(Data as MemoryBlock, byref error as NSErrorMBS)
- Constructor(Data as MemoryBlock, fileTypeHintUtiString as string, byref error as NSErrorMBS)
- Constructor(File as folderitem, fileTypeHintUtiString as string, byref error as NSErrorMBS)
- Constructor(URL as string, byref error as NSErrorMBS)
- Constructor(URL as string, fileTypeHintUtiString as string, byref error as NSErrorMBS)
AVAudioPlayerMBS.Constructor(File as folderitem, fileTypeHintUtiString as string, byref error as NSErrorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 14.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: A URL identifying the sound file to play. The audio data must be in a format supported by Core Audio.
utiString: A UTI that is used as a file type hint. The supported UTIs are defined in File Format UTIs. See AVFileType* strings.
Error: If an error occurs, upon return the NSError object describes the error.
The utiString file type hint tells the parser what kind of sound data to expect so that files which are not self identifying, or possibly even corrupt, can be successfully parsed.
Available in OS X v10.9 and later, but plugin calls variant without hint for older versions.
See also:
- Constructor(Data as MemoryBlock, byref error as NSErrorMBS)
- Constructor(Data as MemoryBlock, fileTypeHintUtiString as string, byref error as NSErrorMBS)
- Constructor(File as folderitem, byref error as NSErrorMBS)
- Constructor(URL as string, byref error as NSErrorMBS)
- Constructor(URL as string, fileTypeHintUtiString as string, byref error as NSErrorMBS)
AVAudioPlayerMBS.Constructor(URL as string, byref error as NSErrorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: A URL identifying the sound file to play. The audio data must be in a format supported by Core Audio. For a list of supported formats, see "Using Audio" in Multimedia Programming Guide.
Error: If an error occurs, upon return the NSError object describes the error..
On success, you have an initialized AVAudioPlayer object. On failure, the Error parameter contains a code that describes the problem.
See also:
- Constructor(Data as MemoryBlock, byref error as NSErrorMBS)
- Constructor(Data as MemoryBlock, fileTypeHintUtiString as string, byref error as NSErrorMBS)
- Constructor(File as folderitem, byref error as NSErrorMBS)
- Constructor(File as folderitem, fileTypeHintUtiString as string, byref error as NSErrorMBS)
- Constructor(URL as string, fileTypeHintUtiString as string, byref error as NSErrorMBS)
AVAudioPlayerMBS.Constructor(URL as string, fileTypeHintUtiString as string, byref error as NSErrorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 14.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
url: A URL identifying the sound file to play. The audio data must be in a format supported by Core Audio.
utiString: A UTI that is used as a file type hint. The supported UTIs are defined in File Format UTIs. See AVFileType* strings.
Error: If an error occurs, upon return the NSError object describes the error.
The utiString file type hint tells the parser what kind of sound data to expect so that files which are not self identifying, or possibly even corrupt, can be successfully parsed.
Available in OS X v10.9 and later, but plugin calls variant without hint for older versions.
See also:
- Constructor(Data as MemoryBlock, byref error as NSErrorMBS)
- Constructor(Data as MemoryBlock, fileTypeHintUtiString as string, byref error as NSErrorMBS)
- Constructor(File as folderitem, byref error as NSErrorMBS)
- Constructor(File as folderitem, fileTypeHintUtiString as string, byref error as NSErrorMBS)
- Constructor(URL as string, byref error as NSErrorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Calling pause leaves the audio player prepared to play; it does not release the audio hardware that was acquired upon calling play or prepareToPlay.
AVAudioPlayerMBS.peakPowerForChannel(channel as Integer) as Double
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
channelNumber: The audio channel whose peak power value you want to obtain. Channel numbers are zero-indexed. A monaural signal, or the left channel of a stereo signal, has channel number 0.
Returns a floating-point representation, in decibels, of a given audio channel's current peak power. A return value of 0 dB indicates full scale, or maximum power; a return value of -160 dB indicates minimum power (that is, near silence).
If the signal provided to the audio player exceeds ±full scale, then the return value may exceed 0 (that is, it may enter the positive range).
To obtain a current peak power value, you must call the updateMeters method before calling this method.
AVAudioPlayerMBS.play as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns true on success, or false on failure.
Calling this method implicitly calls the prepareToPlay method if the audio player is not already prepared to play.
AVAudioPlayerMBS.playAtTime(time as Double = 0.0) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
time: The number of seconds to delay playback, relative to the audio output device's current time.
Returns true on success, or false on failure.
To learn about the virtual audio output device's timeline, read the description for the deviceCurrentTime property.
Calling this method implicitly calls the prepareToPlay method if the audio player is not already prepared to play.
AVAudioPlayerMBS.prepareToPlay as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns true on success, or false on failure.
Calling this method preloads buffers and acquires the audio hardware needed for playback, which minimizes the lag between calling the play method and the start of sound output.
Calling the stop method, or allowing a sound to finish playing, undoes this setup.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Calling this method, or allowing a sound to finish playing, undoes the setup performed upon calling the play or prepareToPlay methods.
The stop method does not reset the value of the currentTime property to 0. In other words, if you call stop during playback and then call play, playback resumes at the point where it left off.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | AVFoundation | MBS AVFoundation Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
To obtain current audio power values, you must call this method before calling averagePowerForChannel or peakPowerForChannel.
The items on this page are in the following plugins: MBS AVFoundation Plugin.