Samples and envelopes become associated with an instrument by creating an attachment item. You can use the same sample on multiple instruments, or you can use multiple samples on one instrument. What you really need to know is when a specific attachment has finished. There are two ways to do this:
MonitorAttachment()
to request a signal when the sample or envelope has finished. This method can be used with WaitSignal()
which lets a task sleep until the attachment is finished.GetAudioItemInfo()
with AF_TAG_STATUS.Be careful when you are polling for an instrument to finish. Never loop continuously while polling. This is called busy waiting. Busy waiting takes up CPU cycles and can cause a drop in performance or a deadlock.
See Preparing Instruments, for complete programming details.
See Audio Folio Calls, in the 3DO Music and Audio Programmer's Reference for information on these calls.
See the example files ta_attach.c and sample_envelope.c for examples of MonitorAttachment()
usage.