Fix preview sound pooling + add BTS preview sound
This commit is contained in:
parent
be12dfad5b
commit
564602fdbe
|
@ -2527,7 +2527,7 @@ MonoBehaviour:
|
|||
m_Calls:
|
||||
- m_Target: {fileID: 9208581106079180837}
|
||||
m_TargetAssemblyTypeName: HeavenStudio.Editor.EditorSettings, Assembly-CSharp
|
||||
m_MethodName: OnCursorCheckboxChanged
|
||||
m_MethodName: OnPreviewNoteSoundsChanged
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
|
BIN
Assets/Resources/Sfx/games/builtToScaleDS/PianoPreview.ogg
Normal file
BIN
Assets/Resources/Sfx/games/builtToScaleDS/PianoPreview.ogg
Normal file
Binary file not shown.
|
@ -0,0 +1,22 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 32a60be2b7dcb764a91b761a6a3d3022
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -26,12 +26,12 @@ namespace HeavenStudio.Games.Loaders
|
|||
{
|
||||
new Param.CollapseParam((x, _) => !(bool)x, new string[] { "note1", "note2", "note3", "note4", "note5", "note6"})
|
||||
}),
|
||||
new Param("note1", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 0, 3, 4, "builtToScaleDS/Piano"), "1st note", "Set the number of semitones up or down this note should be pitched."),
|
||||
new Param("note2", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 2, 3, 4, "builtToScaleDS/Piano"), "2nd note", "Set the number of semitones up or down this note should be pitched."),
|
||||
new Param("note3", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 4, 3, 4, "builtToScaleDS/Piano"), "3rd note", "Set the number of semitones up or down this note should be pitched."),
|
||||
new Param("note4", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 5, 3, 4, "builtToScaleDS/Piano"), "4th note", "Set the number of semitones up or down this note should be pitched."),
|
||||
new Param("note5", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 7, 3, 4, "builtToScaleDS/Piano"), "5th note", "Set the number of semitones up or down this note should be pitched. This note plays together with the 6th note."),
|
||||
new Param("note6", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 12, 3, 4, "builtToScaleDS/Piano"), "6th note", "Set the number of semitones up or down this note should be pitched. This note plays together with the 5th note."),
|
||||
new Param("note1", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 0, 3, 4, "builtToScaleDS/PianoPreview"), "1st note", "Set the number of semitones up or down this note should be pitched."),
|
||||
new Param("note2", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 2, 3, 4, "builtToScaleDS/PianoPreview"), "2nd note", "Set the number of semitones up or down this note should be pitched."),
|
||||
new Param("note3", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 4, 3, 4, "builtToScaleDS/PianoPreview"), "3rd note", "Set the number of semitones up or down this note should be pitched."),
|
||||
new Param("note4", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 5, 3, 4, "builtToScaleDS/PianoPreview"), "4th note", "Set the number of semitones up or down this note should be pitched."),
|
||||
new Param("note5", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 7, 3, 4, "builtToScaleDS/PianoPreview"), "5th note", "Set the number of semitones up or down this note should be pitched. This note plays together with the 6th note."),
|
||||
new Param("note6", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 12, 3, 4, "builtToScaleDS/PianoPreview"), "6th note", "Set the number of semitones up or down this note should be pitched. This note plays together with the 5th note."),
|
||||
}
|
||||
},
|
||||
new GameAction("play piano", "Play Note")
|
||||
|
@ -40,7 +40,7 @@ namespace HeavenStudio.Games.Loaders
|
|||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("type", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 0, 3, 4, "builtToScaleDS/Piano"), "Semitones", "Set the number of semitones up or down this note should be pitched.")
|
||||
new Param("type", new EntityTypes.Note(-EntityTypes.Note.maxSemitones, EntityTypes.Note.maxSemitones, 0, 3, 4, "builtToScaleDS/PianoPreview"), "Semitones", "Set the number of semitones up or down this note should be pitched.")
|
||||
},
|
||||
},
|
||||
new GameAction("color", "Color Palette")
|
||||
|
|
|
@ -85,8 +85,17 @@ public class NotePropertyPrefab : NumberPropertyPrefab
|
|||
private void PlayPreview(EntityTypes.Note note, int currentSemitones)
|
||||
{
|
||||
if (note.sampleName.Equals("") || !PersistentDataManager.gameSettings.previewNoteSounds) return;
|
||||
|
||||
if(previewAudioSource) previewAudioSource.Stop();
|
||||
|
||||
if (previewAudioSource != null)
|
||||
{
|
||||
if (!previewAudioSource.available)
|
||||
{
|
||||
GameManager.instance.SoundObjects.Release(previewAudioSource);
|
||||
}
|
||||
|
||||
previewAudioSource.Stop();
|
||||
previewAudioSource = null;
|
||||
}
|
||||
|
||||
float pitch = SoundByte.GetPitchFromSemiTones(currentSemitones, true);
|
||||
previewAudioSource = SoundByte.PlayOneShotGame(note.sampleName, pitch: pitch, volume: 0.75f, forcePlay: true, ignoreConductorPause: true);
|
||||
|
|
|
@ -117,6 +117,7 @@ namespace HeavenStudio.Util
|
|||
{
|
||||
if (!ignoreConductorPause && !(cond.isPlaying || cond.isPaused))
|
||||
{
|
||||
Debug.Log("release 1");
|
||||
GameManager.instance.SoundObjects.Release(this);
|
||||
return;
|
||||
}
|
||||
|
@ -174,11 +175,15 @@ namespace HeavenStudio.Util
|
|||
{
|
||||
if (!ignoreConductorPause && !(cond.isPlaying || cond.isPaused))
|
||||
{
|
||||
Debug.Log("release2");
|
||||
|
||||
GameManager.instance.SoundObjects.Release(this);
|
||||
return;
|
||||
}
|
||||
if (!(looping || paused || audioSource.isPlaying))
|
||||
{
|
||||
Debug.Log("release3");
|
||||
|
||||
GameManager.instance.SoundObjects.Release(this);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue