# spAddMarker

Add a new SPMarker to an SPSound.

### Synopsis

`Err spAddMarker (SPSound *sound, uint32 position, const char *markerName)`

### Description

Adds a new SPMarker to the specified SPSound.

All markers added to an SPSound are automatically freed when the SPSounds is freed by `spRemoveSound()`. A marker may be manually freed by calling `spRemoveMarker()`.

### Arguments

sound
  Pointer to an SPSound to which to add an SPMarker.

position
  Position (in frames) within the sound data for the new marker. The range is 0..nframes, where nframes is the length of the sound in frames. 0 places the new marker before the first frame in the sound; nframes places the marker after the last frame in the sound. This position must be DMA-aligned, or else this function returns ML_ERR_BAD_SAMPLE_ALIGNMENT.

markerName
  Name for the new marker. This name must be unique for the sound. Names are compared case-insensitively. The name passed in to this function is copied, so the caller need not keep the string buffer pointed to by markerName intact after calling this function.

### Return Value

Non-negative value on success; negative error code on failure.

### Implementation

Library call implemented in music.lib V24.

### Associated Files

soundplayer.h, music.lib

### See Also

``spRemoveMarker`(), spBranchAtMarker(), spStopAtMarker(), spContinueAtMarker(), spSetMarkerDecisionFunction(), spClearMarkerDecisionFunction()`