Up: GEOS SDK TechDocs | Up | Prev: SocketRemoveLoadOnMsg() ... | Next: SoundFreeMusic() ...

SoundAllocMusic()

word	SoundAllocMusic( /* Returns a SOUND_ERROR_ value */
        const word 		*song, 
        word 		voices,
        MemHandle		*control );

This routine takes a pointer to a fixed buffer of music and allocates a MemHandle which may then be passed to SoundPlayMusic() to play the music. The handle is returned in the address specified by control . SoundAllocMusic() returns a non-zero value if it encounters an error trying to allocate the music block.

If the music buffer is in a movable resource, you must initialize it using SoundInitMusic() instead of SoundAllocMusic() . The voices argument is the number of voices in the buffer.

SoundAllocMusicNote()

word SoundAllocMusicNote( /* Returns a SOUND_ERROR_... value. */
        InstrumentPatch				instrument, 
        word				instTable,
        word 				frequency, 
        word 				volume,
        SoundStreamDeltaTimeType				DeltaType, 
        word 				duration,
        MemHandle				*control);

This routine allocates a MemHandle which may be passed to SoundPlayMusicNote() . You must provide all information about the note: its frequency, volume, and duration.

To play the note using a standard instrument, pass the instrument's value in instrument and zero in instTable . To use a custom instrument, instTable : instrument should be a pointer to the instrument.

Specify the frequency in Hertz or use one of the constants such as MIDDLE_C_b to specify a standard note frequency. Volume ranges from zero to 0xffff--you may wish to use a constant value such as DYNAMIC_FFF if you want help trying to choose a loudness. The note's duration is determined by its delta type, one of SSDTT_MSEC, SSDTT_TICKS, and SSDTT_TEMPO. If you pass SSDTT_MSEC or SSDTT_TICKS, the duration is measured in milliseconds or ticks (each tick is one sixtieth of a second). If you pass SSDTT_TEMPO, you may set the size of your time unit when you call SoundPlayMusicNote() . The duration determines how many time units the note should play. If the delta type is SSDTT_TICKS and duration is 30, then the note will sound for half a second.

The handle of the newly allocated note will be stored at the location specified by control . SoundAllocMusicNote() returns non-zero if there is an error allocating the note.

SoundAllocMusicStream()

word	SoundAllocMusicStream( /* Returns a SOUND_ERROR_... value */
        word 		streamType,
        word 		priority,
        word 		voices,
        word 		tempo,
        MemHandle		*control);

This routine allocates a handle suitable for passing to SoundPlayToMusicStream() . The handle will be returned at the address specified by control. SoundAllocMusicStream() returns a non-zero value if there is an error allocating the handle.

It is passed several arguments. The SoundStreamType determines how much space to allocate for the stream and will determine how much data can be written to the stream at one time. If you pass SST_ONE_SHOT, it indicates that the stream will not be explicitly destroyed, and that your stream should destroy the stream when the song is done. You must specify how many voices there are in the music buffer. You must also pass a starting tempo for the music stream.

SoundAllocSampleStream()

word SoundAllocSampleStream( /* Returns a SOUND_ERROR_... value */
        MemHandle		*control);

This routine allocates a sample stream handle. If the returned handle is null , the library was unavailable (i.e. some other thread has grabbed exclusive access).

SoundDisableSampleStream()

void 	SoundDisableSampleStream(
        MemHandle 		mh);

This routine disassociates the DAC player from the passed sample handle. Before you play more sounds using the handle, you will have to call SoundEnableSampleStream() again.

SoundEnableSampleStream()

word	SoundEnableSampleStream( /* Returns a SOUND_ERROR_... value */
        MemHandle 		mh,
        SoundPriority		priority,
        word 		rate,
        word 		manufacturerID,
        DACSampleFormat		format);

This routine associates a DAC player with the allocated sample handle. You must pass the sound handle, as returned by SoundAllocSampleStream() . You must also pass certain pieces of information about the sound you will be playing on the DAC device: the priority with which to grab the DAC player (e.g. SP_STANDARD), the sampling rate, and the format of the sample (as identified by a manufacturerID and a DACSampleFormat value).


Up: GEOS SDK TechDocs | Up | Prev: SocketRemoveLoadOnMsg() ... | Next: SoundFreeMusic() ...