Primitive 0x0017 - Play / Stop Sound Effect
This primitive plays or stops a sound associated with an object.
There is no SimPe wizard for this instruction, so the following table details the meaning of each of the operands.
Operand | Description | Operand Values |
---|---|---|
0 & 1 | Sound Index | This is an index into the STR# 0x4132 resource. If the value >= 20000, subtract 20000 and use the semi-global resource. If the value >= 10000, subtract 10000 and use the global resource |
2 & 3 | Sample Rate | |
4 - bit 1 | Unused | |
4 - bit 2 | Controls the Source object | Off: Me On: Stack Object |
4 - bit 3 | Unused | |
4 - bit 4 | Unused | |
4 - bit 5 | Auto-Vary | Off: flase On: true |
4 - bit 6 | Unused | |
4 - bit 7 | Play / Stop | Off: Play On: Stop |
4 - bit 8 | Unused | |
5 | Volume level | |
6 thru 15 | Unused |
// Decompiled with JetBrains decompiler // Type: pjse.BhavNameWizards.WizPrim0x0017 // Assembly: pjse.coder.plugin, Version=4.0.3349.37576, Culture=neutral, PublicKeyToken=null using SimPe; using SimPe.PackedFiles.Wrapper; using System; namespace pjse.BhavNameWizards { public class WizPrim0x0017 : BhavWizPrim { public WizPrim0x0017(Instruction i) : base(i) { } protected override string Operands(bool lng) { byte[] numArray = new byte[16]; ((byte[]) this.instruction.Operands).CopyTo((Array) numArray, 0); ((byte[]) this.instruction.Reserved1).CopyTo((Array) numArray, 8); string str1 = "" + (((int) numArray[4] & 64) != 0 ? pjse.Localization.GetString("Stop") : pjse.Localization.GetString("Play")); int num = (int) BhavWiz.ToShort(numArray[0], numArray[1]); Scope scope = Scope.Private; if (num >= 10000 && num < 20000) { scope = Scope.Global; num -= 10000; } else if (num >= 20000) { scope = Scope.SemiGlobal; num -= 20000; } string str2 = this.readStr(scope, GS.GlobalStr.Sound, (ushort) num, lng ? -1 : 60, lng ? Detail.Normal : Detail.ErrorNames); if (str2.Length > 0) str1 = str1 + " " + str2; if (lng) str1 = str1 + ", " + pjse.Localization.GetString("bwp_source") + ": " + this.dataOwner(((int) numArray[4] & 2) == 0 ? (byte) 3 : (byte) 4, (ushort) 11) + ", " + pjse.Localization.GetString("bwp17_autoVary") + ": " + (((int) numArray[4] & 16) != 0).ToString() + ", " + pjse.Localization.GetString("bwp17_sampleRate") + ": 0x" + Helper.HexString(BhavWiz.ToShort(numArray[2], numArray[3])) + ", " + pjse.Localization.GetString("bwp17_volume") + ": 0x" + Helper.HexString(numArray[5]); return str1; } } }