Skip to main content

PlaySnd

PlaySnd [/I=resourceIndex /M=promptStr /N=resNameStr /P=pathName /Q /R=resourceID /Z] fileNameStr

warning

PlaySnd is obsolete. Use PlaySound instead.

The PlaySnd operation plays a sound from a file's 'snd ' resource.

Parameters

The file containing the sound is specified by fileNameStr and /P=pathName where pathName is the name of an Igor symbolic path. fileNameStr can be a full path to the file, in which case /P is not needed, a partial path relative to the folder associated with pathName, or the name of a file in the folder associated with pathName. If Igor cannot determine the location of the file from fileNameStr and pathName, it displays a dialog allowing you to specify the file.

If you use a full or partial path for fileNameStr, see Path Separators for details on forming the path.

Flags

/I=resourceIndexSpecifies the 'snd' resource to load by resource index, starting from 1.
/M=promptStrSpecifies a prompt to use if PlaySnd needs to put up a dialog to find the file.
/N=resNameStrSpecifies the resource to load by resource name.
/P=pathNameSpecifies the folder to look in for the file. pathName is the name of an existing symbolic path.
/QQuiet: suppresses the insertion of 'snd ' info into the history area.
/R=resourceIDSpecifies the 'snd ' resource to load by resource ID.
/ZDoesn't actually play the sound, just checks for its existence.

Details

At least one of /I, /N or /R must be specified. PlaySnd tries to play a sound from an 'snd ' resource. Most programs store sounds in 'snd ' resources.

If /P=pathName is omitted, then fileNameStr can take on three special values:

"Clipboard":Loads data from the Clipboard.
"System":Loads data from the System file.
"Igor":Loads data from the Igor Pro application.

If you use /P=pathName, note that it is the name of an Igor symbolic path, created via NewPath. It is not a file system path like "hd:Folder1:" or "C:\\Folder1\\". See Symbolic Paths for details.

There are no sounds in the Igor Pro application file.

If the file is not fully specified and fileNameStr is not one of these special values, then PlaySnd presents a dialog from which you can select a file. "Fully specified" means that Igor can determine the name of the file (from the fileNameStr parameter) and the folder containing the file (from the /P=pathName flag or from the fileNameStr parameter).

PlaySnd sets the variable V_flag to 1 if the sound exists and fits in available memory or to 0 otherwise.

If the sound exists, PlaySnd also sets the string variable S_info to:

"SOURCE:sourceName;RESOURCENAME:resourceName;RESOURCEID:resourceID"

If the sound is not a resource then resourceName is "" and resourceID is 0. sourceName will be the name of the file that was loaded or "Clipboard", "System" or "Igor".

Examples

PlaySnd/I=1 "Igor"      // plays the first 'snd ' resource in Igor
PlaySnd/I=1/P=mySnds/Z "Wild Eep"
If( V_flag ) // Any 'snd ' in the "Wild Eep" file?
Print S_info // Yes, print resource number, etc
Endif

This prints the following into the history area:

SOURCE:resource fork;RESOURCENAME:Wild Eep;RESOURCEID:8;