APTR handle = BeginSampleStream(STRPTR filename, struct SaveSampleCtrl
*ctrl, struct hwTagList *tags);
HWEXT_SAVESAMPLE_STREAM
extension bit has been set. See Extension plugins for details. In that case,
this function must create a new sample stream in the specified filename. After
Hollywood has called this function, it will then call WriteSampleStream()
to add PCM data to your sample stream. Once all PCM data has been added,
Hollywood will call FinishSampleStream() on the stream handle.
Hollywood passes a pointer to a struct SaveSampleCtrl to this function.
This structure looks like this:
struct SaveSampleCtrl
{
APTR Data; // [unused]
int DataSize; // [unused]
int Samples; // [unused]
int Channels; // [in]
int Bits; // [in]
int Frequency; // [in]
ULONG Flags; // [in]
ULONG FormatID; // [in]
STRPTR Adapter; // [in]
struct hwUserTagList *UserTags; // [in]
int BitRate; // [in]
int Quality; // [in]
};
|
In this structure Hollywood passes information about the encoding of the PCM samples
that will be passed to your WriteSampleStream() function by Hollywood. The
following information is passed to your BeginSampleStream() function:
Data:
DataSize:
Samples:
Channels:
Bits:
Frequency:
Flags:
HWSNDFLAGS_BIGENDIAN
HWSNDFLAGS_SIGNEDINT
FormatID:
Adapter:NULL, Hollywood wants your plugin to
use the file adapter specified in Adapter to save the sample. This means that you
have to use hw_FOpenExt() instead of hw_FOpen() to save the sample.
UserTags:UserTags could
also be intended for another plugin, namely the file adapter plugin passed
in Adapter. See User tags for details.
BitRate:Bitrate tag
when calling Hollywood commands such as SaveMusic(). If the user hasn't set the
Bitrate tag, this member will be set to -1.
Quality:Quality tag
when calling Hollywood commands such as SaveMusic(). If the user hasn't set the
Quality tag, this member will be set to -1.
This function has to return a handle to the stream if the sample stream has been successfully
created or NULL if there was an error.
struct SaveSampleCtrl containing information about the sample formatNULL at the momentNULL in case of an error