AudioContent

class AudioContent : ContentItem, System.IDisposable

Encapsulates and provides operations, such as format conversions, on the source audio. This type is produced by the audio importers and used by audio processors to produce compiled audio assets.

readonly string FileName

The name of the original source audio file.

readonly AudioFileType FileType

The type of the original source audio file.

readonly System.Collections.ObjectModel.ReadOnlyCollection<Byte> Data

The current raw audio data without header information.

readonly System.TimeSpan Duration

The duration of the audio data.

readonly AudioFormat Format

The current format of the audio data.

readonly int LoopLength

The current loop length in samples.

readonly int LoopStart

The current loop start location in samples.

public void ConvertFormat(ConversionFormat formatType, ConversionQuality quality, string saveToFile)

Transcodes the source audio to the target format and quality.

Parameters:
  • formatType (Microsoft.Xna.Framework.Content.Pipeline.Audio.ConversionFormat) – Format to convert this audio to.
  • quality (Microsoft.Xna.Framework.Content.Pipeline.Audio.ConversionQuality) – Quality of the processed output audio. For streaming formats, it can be one of the following: Low (96 kbps), Medium (128 kbps), Best (192 kbps). For WAV formats, it can be one of the following: Low (11kHz ADPCM), Medium (22kHz ADPCM), Best (44kHz PCM)
  • saveToFile (string) – The name of the file that the converted audio should be saved into. This is used for SongContent, where the audio is stored external to the XNB file. If this is null, then the converted audio is stored in the Data property.
public void SetData(System.Byte[] data, AudioFormat format, System.TimeSpan duration, int loopStart, int loopLength)
Parameters:
  • data (System.Byte[]) –
  • format (Microsoft.Xna.Framework.Content.Pipeline.Audio.AudioFormat) –
  • duration (System.TimeSpan) –
  • loopStart (int) –
  • loopLength (int) –
public void Dispose()