Name
MUSIC -- preload a music file for later use (V2.0)
Synopsis
@MUSIC id, filename$[, table]
Function
Use this preprocessor command to preload a music object which you want to play later using PlayMusic(). The music file can be in any format supported by Hollywood. Please have a look at the OpenMusic() documentation for information on supported music formats. If the music file is in a streaming format, this preprocessor command will only initialize the music object for later playback. It will not load large music objects completely into memory but they will be played as a sound stream buffered from disk.

The third argument is optional. It is a table that can be used to set further options for the loading operation. The following fields of the table can be used:

Link:
Set this field to False if you do not want to have this music file linked to your executable/applet when you compile your script. This field defaults to True which means that the music file is linked to your executable/applet when Hollywood is in compile mode.

Loader:
This tag allows you to specify one or more format loaders that should be asked to load this music file. This must be set to a string containing the name(s) of one or more loader(s). Defaults to the loader set using SetDefaultLoader(). See Loaders and adapters for details. (V6.0)

Adapter:
This tag allows you to specify one or more file adapters that should be asked to open the specified file. This must be set to a string containing the name(s) of one or more adapter(s). Defaults to the adapter set using SetDefaultAdapter(). See Loaders and adapters for details. (V6.0)

UserTags:
This tag can be used to specify additional data that should be passed to loaders and adapters. If you use this tag, you must set it to a table of key-value pairs that contain the additional data that should be passed to plugins. See User tags for details. (V10.0)

Music formats that are supported on all platforms are RIFF WAVE, IFF 8SVX, IFF 16SV, Protracker modules, and formats you have a plugin for. Depending on the platform Hollywood is running on, more music formats might be supported. For example, on Windows, Hollywood supports all formats that DirectShow can load, and on macOS, all formats recognized by Apple's AudioFile interface are supported.

If you want to open the music file manually, please use the OpenMusic() command.

Inputs
id
a value that is used to identify this music object later in the code
filename$
the file you want to have loaded
table
optional: a table configuring further options (see above)
Example
@MUSIC 1, "TurricanII_Remix.mod"
The code above opens "TurricanII_Remix.mod" so that it can be played later using PlayMusic().

Show TOC