arx-tools/arx-level-generator

Add OOP wrapper for playing speeches

Opened this issue · 0 comments

There's no way to have this coded similarly to how the Speak script class creates a wrapper around the play command.

speak [goblin_ouch]

It would be nice, if the Speak class could handle this as well and the goblin_ouch sound would be wrapped by the Audio class. Something like this:

const sound = new Audio({
  filename: "[goblin_ouch]",
  type: "speech" // currently only exact matches to speech subfolders exist, like "speech/english"
})

const soundScript = new Sound(sound, SoundFlags.VaryPitch) // note that the whole audio instance is passed, not just the filename

// ...

soundScript.play() // generates "speak [goblin_ouch]"