Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSSoundMBS class.

NSSoundMBS.channelMapping as Integer()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 14.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Provides the receiver’s channel map.

A channel map correlates a sound’s channels to the the output-device’s channels. For example, a two-channel sound being played on a five-channel device should have a channel map to optimize the sound-playing experience. The default map, correlates the first sound channel to the first output channel, the second sound channel to the second output channel, and so on.

Available in OS X v10.5 and later. Deprecated in OS X v10.9.

NSSoundMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initializes the receiver with data from a pasteboard.

NSSound expects the data to have a proper magic number, sound header, and data for the formats it supports.

See also:

NSSoundMBS.Constructor(data as MemoryBlock)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initializes the receiver with a given audio data.

data: Audio data with which the receiver is to be initialized. The data must have a proper magic number, sound header, and data for the formats the NSSound class supports.

See also:

NSSoundMBS.Constructor(file as folderitem, ByReference as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initializes the receiver with the the audio data located at a given file.
Example
dim s as NSSoundMBS
dim f as FolderItem

f=SpecialFolder.Desktop.Child("test.mp3")

s=new NSSoundMBS(f,true)

call s.play

file: Path to the sound file.
ByReference: When true only the name of the sound is stored with the NSSound instance when archived using encodeWithCoder:; otherwise the audio data is archived along with the instance. (not used in Xojo)

See also:

NSSoundMBS.Constructor(url as string, ByReference as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initializes the receiver with the audio data located at a given URL.

url: URL to the sound file with which the receiver is to be initialized.
ByReference: When true only the name of the sound is stored with the NSSound instance when archived using encodeWithCoder:; otherwise the audio data is archived along with the instance. (not used in Xojo)

See also:

NSSoundMBS.currentTime as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Provides the receiver's playback progress in seconds.

Receiver's playback progress in seconds.

Sounds start with currentTime == 0 and end with currentTime == ([<sound> duration] - 1).

Available in Mac OS X v10.5 and later.
This property is not archived, copied, or stored on the pasteboard.
(Read and Write computed property)

NSSoundMBS.duration as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Provides the duration of the receiver in seconds.

Available in Mac OS X v10.5 and later.

NSSoundMBS.isPlaying as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Indicates whether the receiver is playing its audio data.

True when the receiver is playing its audio data, false otherwise.

NSSoundMBS.loops as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Indicates whether the receiver restarts playback when it reaches the end of its content.

True when the receiver restarts playback when it finishes, false otherwise.
Default: false

Available in Mac OS X v10.5 and later.

When loops is true, the delegate does not call the SoundFinished event on the end of its content and restarts playback.
(Read and Write computed property)

NSSoundMBS.name as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the name assigned to the receiver.

Name assigned to the receiver; "" when no name has been assigned.

NSSoundMBS.pause as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Pauses audio playback.

True when playback is paused successfully, false when playback is already paused or when an error occurred.

NSSoundMBS.play as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initiates audio playback.

True when playback is initiated, false when playback is already in progress or when an error occurred.

This method initiates playback asynchronously and returns control to your application. Therefore, your application can continue doing work while the audio is playing.

NSSoundMBS.playbackDeviceIdentifier as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Identifies the receiver's output device.

Returns an unique identifier of a sound output device.
Available in Mac OS X v10.5 and later.
(Read and Write computed property)

NSSoundMBS.resume as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Resumes audio playback.

True when playback is resumed, false when playback is in progress or when an error occurred.

Assumes the receiver has been previously paused by sending it pause.

NSSoundMBS.setChannelMapping(mapping() as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 14.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Specifies the receiver’s channel map.

Mapping: Audio-channel—to—device–channel mappings for the receiver.

Available in OS X v10.5 and later. Deprecated in OS X v10.9.

NSSoundMBS.setDelegate(DelegateHandler as NSSoundDelegateMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Set the receiver's delegate.

You can assign one delegate to several sounds.
But the delegate object is not referenced, so keep it alive with your own reference, so RB won't destroy it too early.

NSSoundMBS.setName(name as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Registers the receiver under a given name.

Returns True when successful; false otherwise.

If the receiver is already registered under another name, this method first unregisters the prior name.

NSSoundMBS.stop as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Concludes audio playback.

True when playback is concluded successfully or if it's paused, false otherwise.

NSSoundMBS.volume as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Provides the volume of the receiver.

This method does not affect the systemwide volume.
Available in Mac OS X v10.5 and later.

0.0 is not sound and 1.0 is full sound.
(Read and Write computed property)

NSSoundMBS.writeToPasteboard

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Writes the receiver's data to a pasteboard.

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


The biggest plugin in space...