Scripting API

Scripting API

AudioImporter

Class in Abyss.Core, from Abyss.Core.

The engine's importer of sound clips: a clip's file read whole, mixed to mono and its sample rate lowered if asked, and written again as Ogg Vorbis, IMA ADPCM or 16-bit PCM; see abyss_core::audio::import.

public static class AudioImporter

Remarks

Into the project's cache, beside its textures and models: cache/audio/2c/2c41….ogg, or .wav, named by the clip's identity, so a clip renamed or moved keeps its import. The editor imports in the background and tells the world (World.UseImportedAudio), and a game played from its folders reads the imports it made (AudioImporter.UseCache).

A clip As Encoded is not imported: it is played and packed as its file is.

Properties

Version

public static uint Version { get; }

The importer's version: an import made by another is made again.

Methods

ArtifactOf

public static string ArtifactOf(string cache, AssetGuid id, AudioCompression compression)

Where a clip's import is kept in a cache: audio/b6/<id>.ogg for Vorbis, .wav for ADPCM and PCM.

Parameters

  • cache: The cache folder, its whole path.
  • id: The clip's identity.
  • compression: How it is encoded, which its extension says.

Import

public static ImportedAudio Import(string source, AudioEncoding encoding, string artifact)

Imports source as encoding says, into artifact. Any thread.

Parameters

  • source: The sound file, its whole path.
  • encoding: How it is encoded; As Encoded is refused, being no import.
  • artifact: The file to write, its whole path; written whole, its folder made.

Returns What it made.

Exceptions

  • AbyssException: The source cannot be read or is no sound the engine plays, or the import cannot be written; the message says which and why.
  • AbyssException: In a game's executable, which is built without what only the editor does (AbyssStatus.NotInBuiltGame).

Peaks

public static AudioPeaks Peaks(string file, int columns)

Reads a clip's file whole: what it holds, and its waveform columns wide. No world; any thread, and it takes as long as the file takes to decode.

Parameters

  • file: The sound file, its whole path: a clip's own, or its import.
  • columns: How many columns wide the waveform is.

Exceptions

  • AbyssException: The file cannot be read, or is no sound the engine plays.
  • AbyssException: In a game's executable, which is built without what only the editor does (AbyssStatus.NotInBuiltGame).

UseCache

public static IReadOnlyList<string> UseCache(World world, AssetDatabase database, string cache)

Tells world of every clip under database's root that is imported and that cache holds the import of: what a game played from its folders plays them from, the imports the editor made.

Parameters

  • world: The world to tell.
  • database: What every file under the asset root is called, and its settings.
  • cache: The cache the imports are in, its whole path.

Returns What could not be used, in words: each clip with no import there, which is played as its file encodes it.