TABLE OF CONTENTS sound.datatype/sound.datatype sound.datatype/sound.datatype sound.datatype/sound.datatype NAME sound.datatype -- root data type for sounds. FUNCTION The sound.datatype is the super-class for any sound related classes. METHODS OM_NEW -- Create a new sound object. OM_GET -- Obtain the value of an attribute. OM_SET -- Set the values of multiple attributes. OM_UPDATE -- Update the values of multiple attributes. OM_DISPOSE -- Dispose of a sound object. GM_LAYOUT -- Layout the object and notify the application of the title and size. GM_HITTEST -- Determine if the object has been hit with the mouse. GM_GOACTIVE -- Tell the object to go active. On SELECTDOWN, the sound will start playing. GM_HANDLEINPUT -- Handle input. Currently input (other than SELECTDOWN) doesn't affect the sound. GM_RENDER -- Cause the graphic to render. Currently the graphic for the sound is just a static icon. DTM_TRIGGER -- Cause an event to occur. Possible events are: STM_PLAY -- Causes the sound to start playing. STM_STOP -- Causes the currently playing sound to stop. NOTE: Subclasses which support streaming data access may support more than just the STM_PLAY and STM_STOP events. DTM_COPY -- Copy the entire sound to the clipboard as 8SVX. NOTE: Up to and including V40 sound.datatype never stored a valid VoiceHeader with the file. This was fixed in V44. Subclasses which support streaming data access may not support this method. DTM_WRITE -- Write the entire sound to a file as 8SVX. NOTE: Up to and including V40 sound.datatype never stored a valid VoiceHeader with the file. This was fixed in V44. Subclasses which support streaming data access may not support this method. TAGS SDTA_VoiceHeader (struct VoiceHeader *) Set and get the base information for the sound. VoiceHeader is defined in . NOTE: Up to and including V40 sound.datatype never returned a valid VoiceHeader for OM_GET and the VoiceHeader data was ignored in the OM_NEW/OM_SET cases. This was fixed in V44. Applicability is (OM_NEW, OM_SET, OM_GET) SDTA_Sample (int8 *) Set and get the sound data. Starting with V40 the sample data does not need to be in CHIP memory. Starting with V44 the sample data does not need to start on a WORD-aligned address. Setting SDTA_Sample to NULL will stop sound replay if sound.datatype was started playing with a non-NULL SDTA_Sample parameter. The SDTA_Sample parameter selects mono playback on any sound channel that is currently available. NOTE: For streaming sound playback, SDTA_LeftSample, SDTA_RightSample, and SDTA_Sample will all be NULL (V44). Applicability is (OM_NEW, OM_SET, OM_GET) SDTA_SampleLength (uint32) Length of the sound data in bytes. Starting with V44 the sample data does not need to be an even number of bytes. Setting SDTA_SampleLength to 0 will stop sound replay. The amount of sound data in bytes is calculated with the simple formula: * Note: Even for stereo samples where you specify both SDTA_LeftSample and SDTA_RightSample, the SampleLength still only describes the number of bytes for *one* sample, as left and right sample must be of even size anyway. Applicability is (OM_NEW, OM_SET, OM_GET) SDTA_Period (uint16) Set and get the period of the sound (in timing intervals per sample). This attribute can be used to affect a playing sound. Please note that the Classic Amiga audio hardware does not reliably support playback periods shorter than 124; sound.datatype will limit the period to valid intervals (V44). Default for this tag is 394. Applicability is (OM_NEW, OM_SET, OM_GET) SDTA_Volume (uint16) Set and get the volume of the sound. This attribute can be used to affect a playing sound. Valid range is from 0 to 64. Default for this tag is 64. Applicability is (OM_NEW, OM_SET, OM_GET) SDTA_Cycles (uint16) Set and get the number of cycles the sound will be played. Default for this tag is 1. Applicability is (OM_NEW, OM_SET, OM_GET) SDTA_SignalTask (struct Task *) (V40) Task to signal when playback has completed, or if SDTA_Continuous is TRUE, when the next buffer is needed. Default for this tag is NULL. Applicability is (OM_NEW, OM_SET) SDTA_SignalBit (uint32) (V40) *OBSOLETE* Signal mask to use with SDTA_SignalTask or 0 to disable. NOTE: Due to a bug in sound.datatype V40 SDTA_SignalBit was actually implemented as a signal mask as opposed to a bit number. The documentation now reflects this and recommends the use of SDTA_SignalBitMask instead. If you intend to use a signal bit number instead of the mask, use the new V44 tag SDTA_SignalBitNumber below. Default for this tag is 0. Applicability is (OM_NEW, OM_SET) SDTA_Continuous (BOOL) (V40) Used to indicate that the sound datatype will be fed a continuous stream of data. Default for this tag is FALSE. Applicability is (OM_NEW) SDTA_SignalBitMask (uint32) (V44) Signal mask to use with SDTA_SignalTask or 0 to disable. This tag is an alias for SDTA_SignalBit. Default for this tag is 0. Applicability is (OM_NEW, OM_SET) SDTA_SignalBitNumber (int8) (V44) Signal bit to use with SDTA_SignalTask or -1 to disable. Default for this tag is -1. Applicability is (OM_NEW, OM_SET) SDTA_SamplesPerSec (uint16) (V44) Set and get the replay frequency of a sound (in Hz). This attribute can be used to affect a playing sound. Unlike the SDTA_Period tag, which serves the same purpose, this tag automatically takes the system clock value into account. Please note that the Amiga audio hardware does not reliably support playback rates beyond 28,000 samples per second; sound.datatype will limit the replay frequency to valid intervals. Applicability is (OM_NEW, OM_SET, OM_GET) SDTA_ReplayPeriod (struct TimeVal *) (V44) Get the replay period, i.e. the time it takes for the complete sound to be played. If the sample size has not been set yet, the Seconds and Microseconds members will be set to 0. If the sample is to be played continuously, both TimeVal members will be set to 0xFFFFFFFF. Applicability is (OM_GET) SDTA_Pan (int8) (V44) Set the stereo panning; this must be set to a number in the range of -64..64. A value of -64 will pan the sound to the left channel, silencing the right channel; a value of 64 will pan the sound to the right channel and silence the left channel. To centre playback, use a panning value of 0. The panning value only takes effect if a stereo sound is being played. Default for this tag is 0. Applicability is (OM_NEW, OM_SET) SDTA_FreeSampleData (BOOL) (V44) This tag controls whether sound.datatype will call FreeVec() on the sample data attached to an object. If the SDTA_Continuous attribute was set to TRUE, sound.datatype will never free any data attached to an object. It is safe to attach the same sample to more than one channel as sound.datatype will make sure that no sample data is freed twice. Default for this tag is TRUE. Applicability is (OM_NEW, OM_SET) SDTA_LeftSample (int8 *) (V44) Set and get the left channel sound data. The sample data does not need to be in CHIP memory and does not need to start on a WORD-aligned address. Setting SDTA_LeftSample to NULL will stop sound replay if sound.datatype was started playing with a non-NULL SDTA_LeftSample parameter. The SDTA_LeftSample parameter alone selects mono playback on any left sound channel that is currently available. Used together with the SDTA_RightSample parameter, stereo playback on any available stereo channels is selected. The SDTA_LeftSample parameter takes precedence over the the SDTA_Sample parameter. NOTE: For streaming sound playback, SDTA_LeftSample, SDTA_RightSample, and SDTA_Sample will all be NULL. Applicability is (OM_NEW, OM_SET, OM_GET) SDTA_RightSample (int8 *) (V44) Set and get the right channel sound data. The sample data does not need to be in CHIP memory and does not need to start on a WORD-aligned address. Setting SDTA_RightSample to NULL will stop sound replay if sound.datatype was started playing with a non-NULL SDTA_RightSample parameter. The SDTA_RightSample parameter alone selects mono playback on any right sound channel that is currently available. Used together with the SDTA_LeftSample parameter, stereo playback on any available stereo channels is selected. The SDTA_RightSample parameter takes precedence over the the SDTA_Sample parameter. NOTE: For streaming sound playback, SDTA_LeftSample, SDTA_RightSample, and SDTA_Sample will all be NULL. Applicability is (OM_NEW, OM_SET, OM_GET) SDTA_SyncSampleChange (BOOL) (V44) If SDTA_Continuous was set to TRUE, sound.datatype will expect a continuous stream of data to be played. By specifying "SDTA_SyncSampleChange,TRUE" you request that new sound data will be played only if the old data has been played completely (otherwise, playback would restart immediately with the new sound). If playback is currently in progress, the Task to change the sample data will be made to wait until playback of the old sound has finished. Default for this tag is FALSE. Applicability is (OM_NEW, OM_SET) DTA_Immediate (BOOL) (V44) Select and query whether playback should start immediately after the object has passed the layout process. Default for this tag is FALSE. Applicability is (OM_NEW, OM_SET, OM_GET) DTA_Repeat (BOOL) (V44) Select and query whether playback should loop indefinitely, regardless of the current SDTA_Cycles settings. Default for this tag is FALSE. Applicability is (OM_NEW, OM_SET, OM_GET) SDTA_BitsPerSample (uint8) (V53.2) Set and get the actual bitrate of the sample which can be 8, 16 or 32 bits. With this tag sound.datatype finally supports handling of samples >8bit. If AHI isn't available this tag MUST be set for 16 or 32bit sound data to get them (poorly) converted to 8bit. Default for this tag is 8. Applicability is (OM_NEW, OM_SET, OM_GET) NOTES You cannot switch between mono and stereo playback on the fly while the sound is still playing. First, stop the sound, then change the SDTA_Sample/SDTA_LeftSample/SDTA_LeftSample attributes. The sound.datatype implementation has been cleaned up for V44 to allow for streaming subclasses to be written. Such subclasses will always return NULL when their SDTA_LeftSample, SDTA_RightSample and SDTA_Sample attributes are queried. However, they will never return 0 for the SDTA_SampleLength and SDTA_SamplesPerSec attributes since these can be used to calculate the length of the entire sample. Streaming subclasses will respond to the DTM_TRIGGER method, to start, stop playback, etc. but may not support any other methods which rely upon the entire sample to reside in memory. BUGS The V44 autodocs stated that the default for the "SDTA_FreeSampleData" tag was FALSE. This has never been the case. In fact, it always defaults to TRUE.