# LoadSoundFile

Preloads the first part of a sound file.

### Synopsis

`Err LoadSoundFile( SoundFilePlayer *sfp, char *FileName )`

### Description

This function preloads the first part of a sound file to be played. The file should be an AIFF file. The appropriate DSP instrument to play this sound file is loaded for you at the same time.

### Arguments

sfp
  A pointer to the SoundFilePlayer.

FileName
  A pointer to the sound file.

### Return Value

This function returns 0 if successful or an error code (a negative value) if an error occurs.

### Implementation

Library call implemented in music.lib V20.

### Caveats

Prior to V24 this function failed to check the file's block size. It always assumed that it was 2048 bytes. As of V24 it does check. However, there has always been an implicit requirement that buffer size be a multiple of block size. Not having buffers be a multiple of block size could result in memory overruns. The sound file player now checks buffer size against block size and returns an error if the buffer size is not a multiple of block size.

This means that an application using 10K buffers will work fine on a 2K block file and will simply fail on a 4K block file system. To prevent this choose a buffer size that is a multiple of all of the block sizes that your application is expected to support.

If this restriction is too severe, use the advanced sound player instead.

### Associated Files

soundfile.h, music.lib

### See Also

``OpenSoundFile`(),CloseSoundFile(), DeleteSoundFilePlayer(), ReadSoundFile(), RewindSoundFile(), ServiceSoundFile(), StartSoundFile(), StopSoundFile(), UnloadSoundFile() CreateSoundFilePlayer()`