APTR handle = OpenStream(STRPTR filename, struct LoadSoundCtrl *ctrl);
NULL
. The handle returned by OpenStream()
is
an opaque datatype that only your plugin knows about. Hollywood will simply pass
this handle back to your StreamSamples() function when it wants to
have the raw PCM data of the sound file.
This function also has to provide certain information about the sound file it
has just opened. This information has to be written to the struct LoadSoundCtrl
that is passed in the second parameter. This structure looks like this:
struct LoadSoundCtrl { ULONG Samples; // [out] int Channels; // [out] int Bits; // [out] int Frequency; // [out] ULONG Flags; // [out] int SubSong; // [in] -- V5.3 int NumSubSongs; // [out] -- V5.3 STRPTR Adapter; // [in] -- V6.0 struct hwUserTagList *UserTags; // [in] -- V10.0 }; |
The following information has to be written to the struct LoadSoundCtrl
pointer
by OpenStream()
:
Samples:
HWSNDFLAGS_INFINITE
flag (see below).
Channels:
Bits:
Frequency:
Flags:
HWSNDFLAGS_BIGENDIAN
HWSNDFLAGS_SIGNEDINT
HWSNDFLAGS_CANSEEK
HWSNDFLAGS_INFINITE:
Samples
to 0. (V9.0)
SubSong:
NumSubSongs:
Adapter:
NULL
, Hollywood wants your plugin to
use the file adapter specified in Adapter
to open the sound file. This means that you
have to use hw_FOpenExt() instead of hw_FOpen()
to open the sound file. Make sure to check for Hollywood 6.0 before trying to access
this member because it isn't there in previous versions. See hw_FOpenExt for details. (V6.0)
UserTags:
UserTags
could
also be intended for another plugin, namely the file adapter plugin passed
in Adapter
. See User tags for details. Make sure to check for Hollywood 10.0
before trying to access this member because it isn't there in previous versions.
(V10.0)
Please note that you should not use ANSI C functions like fopen()
to
open the file that is passed to this function because the filename that is passed
to this function can also be a specially formatted filename specification that
Hollywood uses to load files that have been linked to applets or executables. In
order to be able to load these files correctly, you have to use special IO functions
provided by Hollywood. See File IO information for details.
struct LoadSoundCtrl
for storing information
about the sound fileNULL
if plugin doesn't
want to handle this sound file