Add gilded bike horn instrument, expose MidiBank on instruments (#1034)

* Add gilded bike horn instrument, expose MidiBank on instruments

* Reduce soundfont size by removing duplicated samples
This commit is contained in:
Víctor Aguilera Puerto
2020-05-31 19:19:18 +02:00
committed by GitHub
parent ed9aae8005
commit bffe4df16f
7 changed files with 95 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ namespace Content.Client.GameObjects.Components.Instruments
[CanBeNull]
private IMidiRenderer _renderer;
private byte _instrumentProgram = 1;
private byte _instrumentBank = 0;
private uint _syncSequencerTick;
/// <summary>
@@ -81,6 +82,23 @@ namespace Content.Client.GameObjects.Components.Instruments
}
}
/// <summary>
/// Changes the instrument bank the midi renderer will use.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public byte InstrumentBank
{
get => _instrumentBank;
set
{
_instrumentBank = value;
if (_renderer != null)
{
_renderer.MidiBank = _instrumentBank;
}
}
}
/// <summary>
/// Whether there's a midi song being played or not.
/// </summary>
@@ -115,6 +133,7 @@ namespace Content.Client.GameObjects.Components.Instruments
if (_renderer != null)
{
_renderer.MidiBank = _instrumentBank;
_renderer.MidiProgram = _instrumentProgram;
_renderer.TrackingEntity = Owner;
_renderer.OnMidiPlayerFinished += () => { OnMidiPlaybackEnded?.Invoke(); EndRenderer(); SendNetworkMessage(new InstrumentStopMidiMessage()); };
@@ -149,6 +168,7 @@ namespace Content.Client.GameObjects.Components.Instruments
{
base.ExposeData(serializer);
serializer.DataField(ref _instrumentProgram, "program", (byte)1);
serializer.DataField(ref _instrumentBank, "bank", (byte)0);
}
public override void HandleNetworkMessage(ComponentMessage message, INetChannel channel, ICommonSession session = null)

Binary file not shown.

View File

@@ -210,3 +210,22 @@
- type: Item
Size: 24
sprite: Objects/Instruments/banjo.rsi
- type: entity
name: gilded bike horn
description: An exquisitely decorated bike horn, capable of honking in a variety of notes.
parent: BaseHandheldInstrument
id: BikeHornInstrument
components:
- type: Instrument
program: 1
bank: 1
- type: Sprite
sprite: Objects/Instruments/bike_horn.rsi
state: icon
- type: Icon
sprite: Objects/Instruments/bike_horn.rsi
state: icon
- type: Item
Size: 24
sprite: Objects/Instruments/bike_horn.rsi

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

View File

@@ -0,0 +1,56 @@
{
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "CC-BY-SA-3.0",
"copyright": "https://github.com/vgstation-coders/vgstation13 at 8d9c91e19cb52713c7f7f1804c2b6f7203f8d331",
"states": [
{
"name": "icon",
"directions": 1,
"delays": [
[
1
]
]
},
{
"name": "inhand-left",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
},
{
"name": "inhand-right",
"directions": 4,
"delays": [
[
1
],
[
1
],
[
1
],
[
1
]
]
}
]
}