Platforms to show: All Mac Windows Linux Cross-Platform
NSSoundMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Cocoa | MBS MacBase Plugin | 9.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
This class supports the same audio encodings and file formats that are supported by Core Audio and QuickTime.
To use this class, initialize a new instance with the desired file or audio data. You can configure assorted aspects of the audio playback, including the volume and whether the sound loops before you play it. Depending on the type of the audio data, this class may use either Core Audio or QuickTime to handle the actual playback. (Typically, it uses Core Audio to play files in the AIFF, WAVE, NeXT, SD2, AU, and MP3 formats and may use it for other formats in the future as well.) Playback occurs asynchronously so that your application can continue doing work.
You should retain NSSound objects before initiating playback or make sure you have a strong reference to them in a garbage-collected environment. Upon deallocation, a sound object stops playback of the sound (as needed) so that it can free up the corresponding audio resources. If you want to deallocate a sound object immediately after playback, assign a delegate and use the sound:didFinishPlaying: method to deallocate it.
If you want to play the system beep sound, use the NSBeep function.
- 5 properties
- property Handle as Integer
- property currentTime as Double
- property loops as boolean
- property playbackDeviceIdentifier as string
- property volume as Double
- 16 methods
- method channelMapping as Integer()
- method Constructor
- method Constructor(data as MemoryBlock)
- method Constructor(file as folderitem, ByReference as boolean)
- method Constructor(url as string, ByReference as boolean)
- method duration as Double
- method isPlaying as boolean
- method name as string
- method pause as boolean
- method play as boolean
- method resume as boolean
- method setChannelMapping(mapping() as Integer)
- method setDelegate(DelegateHandler as NSSoundDelegateMBS)
- method setName(name as string) as boolean
- method stop as boolean
- method writeToPasteboard
- 11 shared methods
- shared method availableSounds as string()
- shared method canInitWithPasteboard as boolean
- shared method NSSoundPboardType as string
- shared method soundNamed(name as string) as NSSoundMBS
- shared method soundUnfilteredFileTypes as string()
- shared method soundUnfilteredPasteboardTypes as string()
- shared method soundUnfilteredTypes as string()
- shared method soundWithContentsOfFile(file as folderitem, ByReference as boolean) as NSSoundMBS
- shared method soundWithContentsOfURL(url as string, ByReference as boolean) as NSSoundMBS
- shared method soundWithData(data as MemoryBlock) as NSSoundMBS
- shared method soundWithPasteboard as NSSoundMBS
This class has no sub classes.
Some events using this class:
- NSSoundDelegateMBS.SoundFinished(s as NSSoundMBS, didFinishPlaying as boolean)
Blog Entries
- MBS Xojo / Real Studio Plugins, version 14.3pr1
- MBS REALbasic plug-ins version 9.5
- MBS REALbasic plug-ins version 9.4
The items on this page are in the following plugins: MBS MacBase Plugin.
NSSoundDelegateMBS - NSSpeechRecognizerMBS