public override void MouseOver(int i, int j) { int soundCode = GetSoundCode(i, j); Main.NewText("GetPitch now Octave:" + PitchHelper.DecodeOctave(soundCode) + " Name:" + PitchHelper.DecodePitchName(soundCode)); base.MouseOver(i, j); }
public int GetSoundCode(int i, int j) { Tile tile = Main.tile[i, j]; int styleX = tile.frameX / 18; int styleY = tile.frameY / 18; return(PitchHelper.EncodeSoundCode((int)EPitchType.Piano, styleY + 3, styleX + 1)); }
public override bool NewRightClick(int i, int j) { int soundCode = GetSoundCode(i, j); PitchHelper.PlaySound(mod, soundCode, i * 16 + 8, j * 16); int dust = Dust.NewDust(new Vector2(i * 16 - 6, j * 16 - 2), 0, 0, DustType <Dusts.MusicalNote>()); Main.dust[dust].velocity.X = 0f; Main.dust[dust].velocity.Y = -1f; return(base.NewRightClick(i, j)); }
public int GetSoundCode(int i, int j) { Tile tile = Main.tile[i, j]; int keyIndex = MicroKeyboardPitchMap[tile.frameX / 18 + tile.frameY / 18 * 4]; if (keyIndex == 13) { return(PitchHelper.EncodeSoundCode((int)EPitchType.Piano, 5, 1)); } return(PitchHelper.EncodeSoundCode((int)EPitchType.Piano, 4, keyIndex)); }
public void PlayPianoSound(int keyIndex) { if (keyIndex < keyRange) { int soundCode; if (keyIndex < 7) { soundCode = PitchHelper.EncodeSoundCode(1, 3, KeyIndex2Pitch[keyIndex] + 12); } else if (keyIndex < 14) { soundCode = PitchHelper.EncodeSoundCode(1, 4, KeyIndex2Pitch[keyIndex]); } else { soundCode = PitchHelper.EncodeSoundCode(1, 5, KeyIndex2Pitch[keyIndex] - 12); } PitchHelper.PlaySound(ModLoader.GetMod("Pianist"), soundCode); Main.NewText("PlayPianoSound " + keyIndex); } }