warscript
Version:
A typescript library for Warcraft III using Warpack.
70 lines (69 loc) • 2.2 kB
TypeScript
/** @noSelfInFile */
import { Handle, HandleDestructor } from "./handle";
import { Unit } from "./unit";
export declare enum SoundChannel {
General = 0,
UnitSelection = 1,
UnitAcknowledgements = 2,
UnitMovement = 3,
UnitReady = 4,
Combat = 5,
Error = 6,
Music = 7,
UI = 8,
LoopingMovement = 9,
LoopingAmbient = 10,
Animations = 11,
Construction = 12,
Birth = 13,
Fire = 14
}
export declare enum SoundEax {
Default = "DefaultEAXON",
Acknowledgements = "HeroAcksEAX",
Environment = "DoodadsEAX",
Drums = "KotoDrumsEAX",
Attacks = "CombatSoundsEAX",
Abilities = "SpellsEAX",
Missiles = "MissilesEAX"
}
export type SoundPreset = Readonly<{
channel?: SoundChannel;
eax?: SoundEax;
fadeInRate?: number;
fadeOutRate?: number;
looping?: boolean;
volume?: number;
pitch?: number;
}>;
export type Sound3DPreset = SoundPreset & Readonly<{
stopWhenOutOfRange?: boolean;
minDistance?: number;
maxDistance?: number;
distanceCutoff?: number;
}>;
export declare namespace SoundPreset {
const UI: SoundPreset;
const Music: SoundPreset;
const Attack: Sound3DPreset;
const Ability: Sound3DPreset;
const AbilityLooping: Sound3DPreset;
const Missile: Sound3DPreset;
}
export declare class Sound extends Handle<jsound, [fadeOut?: boolean]> {
private _volume?;
protected onDestroy(fadeOut?: boolean): HandleDestructor;
get volume(): number;
set volume(v: number);
start(milliseconds?: number): void;
stop(fadeOut?: boolean): void;
restart(milliseconds?: number): void;
static play(fileName: string, preset: SoundPreset): void;
static create(fileName: string, preset: SoundPreset): Sound;
}
export declare class Sound3D extends Sound {
static playAtPosition(fileName: string, preset: Sound3DPreset, x?: number, y?: number, z?: number): void;
static playOnUnit(fileName: string, preset: Sound3DPreset, unit: Unit): void;
static createAtPosition(fileName: string, preset: Sound3DPreset, x?: number, y?: number, z?: number): Sound3D;
static createOnUnit(fileName: string, preset: Sound3DPreset, unit: Unit): Sound3D;
}