[id] = OpenMusic(id, filename$[, table])
filename$
and assigns
the id
to it. If you pass Nil in id
, OpenMusic()
will automatically choose
an identifier and return it. The file specified in filename$
will be opened
and prepared for playback. Please note that files opened using OpenMusic()
will be played using audio streaming. LoadSample() on the other hand, will
load the entire sound file into memory first. Thus, you should use
LoadSample() for playing short sounds and OpenMusic()
for longer sounds and background music.
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.
Starting with Hollywood 6.0, this function accepts an optional table argument which allows you to pass additional parameters:
Loader:
Adapter:
UserTags:
This command is also available from the preprocessor: Use @MUSIC to preload music objects!
OpenMusic(1, "Turrican2_Remix.mod") PlayMusic(1)The code above plays "Turrican2_Remix.mod".