APTR handle = hw_LockSample(lua_ID *id, int readonly, struct hwTagList * tags, struct hwos_LockSampleStruct *smplock);
lua_ID
. See Object identifiers for details.
You also have to pass a pointer to a struct hwos_LockSampleStruct
which
will be filled with all the information you need by hw_LockSample()
. struct hwos_LockSampleStruct
looks like this:
struct hwos_LockSampleStruct { APTR Buffer; // [out] int BufferSize; // [out] int Samples; // [out] int Channels; // [out] int Bits; // [out] int Frequency; // [out] ULONG Flags; // [out] }; |
hw_LockSample()
will write to the structure members as follows:
Buffer:
BufferSize:
Buffer
in bytes.
Samples:
Channels:
Bits:
Frequency:
Flags:
HWSNDFLAGS_BIGENDIAN
HWSNDFLAGS_SIGNEDINT
If you do not want to write to the raw PCM buffer, pass True
in the readonly
parameter. hw_LockSample()
will be faster than as it does not have to update
the sample data in the sound card memory.
Do not hold sample locks longer than necessary. In particular, do not return control to the script while holding a sample lock because the script might try to modify the sample then and this will lead to trouble in case the sample is still locked. You should call hw_UnLockSample() as soon as possible.
True
for read-only access, False
for read/write accessNULL
for nowstruct hwos_LockSampleStruct
that is to be filled
by this functionNULL
on error