@@ -204,8 +204,14 @@ private void readCustomSampleBanks(string str, SampleBankInfo bankInfo, bool ban
204
204
if ( stringBank == @"none" )
205
205
stringBank = null ;
206
206
string stringAddBank = addBank . ToString ( ) . ToLowerInvariant ( ) ;
207
+
207
208
if ( stringAddBank == @"none" )
209
+ {
210
+ bankInfo . EditorAutoBank = true ;
208
211
stringAddBank = null ;
212
+ }
213
+ else
214
+ bankInfo . EditorAutoBank = false ;
209
215
210
216
bankInfo . BankForNormal = stringBank ;
211
217
bankInfo . BankForAdditions = string . IsNullOrEmpty ( stringAddBank ) ? stringBank : stringAddBank ;
@@ -477,7 +483,7 @@ private List<HitSampleInfo> convertSoundType(LegacyHitSoundType type, SampleBank
477
483
478
484
if ( string . IsNullOrEmpty ( bankInfo . Filename ) )
479
485
{
480
- soundTypes . Add ( new LegacyHitSampleInfo ( HitSampleInfo . HIT_NORMAL , bankInfo . BankForNormal , bankInfo . Volume , bankInfo . CustomSampleBank ,
486
+ soundTypes . Add ( new LegacyHitSampleInfo ( HitSampleInfo . HIT_NORMAL , bankInfo . BankForNormal , bankInfo . Volume , true , bankInfo . CustomSampleBank ,
481
487
// if the sound type doesn't have the Normal flag set, attach it anyway as a layered sample.
482
488
// None also counts as a normal non-layered sample: https://osu.ppy.sh/help/wiki/osu!_File_Formats/Osu_(file_format)#hitsounds
483
489
type != LegacyHitSoundType . None && ! type . HasFlag ( LegacyHitSoundType . Normal ) ) ) ;
@@ -489,13 +495,13 @@ private List<HitSampleInfo> convertSoundType(LegacyHitSoundType type, SampleBank
489
495
}
490
496
491
497
if ( type . HasFlag ( LegacyHitSoundType . Finish ) )
492
- soundTypes . Add ( new LegacyHitSampleInfo ( HitSampleInfo . HIT_FINISH , bankInfo . BankForAdditions , bankInfo . Volume , bankInfo . CustomSampleBank ) ) ;
498
+ soundTypes . Add ( new LegacyHitSampleInfo ( HitSampleInfo . HIT_FINISH , bankInfo . BankForAdditions , bankInfo . Volume , bankInfo . EditorAutoBank , bankInfo . CustomSampleBank ) ) ;
493
499
494
500
if ( type . HasFlag ( LegacyHitSoundType . Whistle ) )
495
- soundTypes . Add ( new LegacyHitSampleInfo ( HitSampleInfo . HIT_WHISTLE , bankInfo . BankForAdditions , bankInfo . Volume , bankInfo . CustomSampleBank ) ) ;
501
+ soundTypes . Add ( new LegacyHitSampleInfo ( HitSampleInfo . HIT_WHISTLE , bankInfo . BankForAdditions , bankInfo . Volume , bankInfo . EditorAutoBank , bankInfo . CustomSampleBank ) ) ;
496
502
497
503
if ( type . HasFlag ( LegacyHitSoundType . Clap ) )
498
- soundTypes . Add ( new LegacyHitSampleInfo ( HitSampleInfo . HIT_CLAP , bankInfo . BankForAdditions , bankInfo . Volume , bankInfo . CustomSampleBank ) ) ;
504
+ soundTypes . Add ( new LegacyHitSampleInfo ( HitSampleInfo . HIT_CLAP , bankInfo . BankForAdditions , bankInfo . Volume , bankInfo . EditorAutoBank , bankInfo . CustomSampleBank ) ) ;
499
505
500
506
return soundTypes ;
501
507
}
@@ -534,6 +540,11 @@ private class SampleBankInfo
534
540
/// </summary>
535
541
public int CustomSampleBank ;
536
542
543
+ /// <summary>
544
+ /// Whether the bank for additions should be inherited from the normal sample in edit.
545
+ /// </summary>
546
+ public bool EditorAutoBank ;
547
+
537
548
public SampleBankInfo Clone ( ) => ( SampleBankInfo ) MemberwiseClone ( ) ;
538
549
}
539
550
@@ -558,21 +569,21 @@ public class LegacyHitSampleInfo : HitSampleInfo, IEquatable<LegacyHitSampleInfo
558
569
/// </summary>
559
570
public bool BankSpecified ;
560
571
561
- public LegacyHitSampleInfo ( string name , string ? bank = null , int volume = 0 , int customSampleBank = 0 , bool isLayered = false )
562
- : base ( name , bank ?? SampleControlPoint . DEFAULT_BANK , customSampleBank >= 2 ? customSampleBank . ToString ( ) : null , volume )
572
+ public LegacyHitSampleInfo ( string name , string ? bank = null , int volume = 0 , bool editorAutoBank = false , int customSampleBank = 0 , bool isLayered = false )
573
+ : base ( name , bank ?? SampleControlPoint . DEFAULT_BANK , customSampleBank >= 2 ? customSampleBank . ToString ( ) : null , volume , editorAutoBank )
563
574
{
564
575
CustomSampleBank = customSampleBank ;
565
576
BankSpecified = ! string . IsNullOrEmpty ( bank ) ;
566
577
IsLayered = isLayered ;
567
578
}
568
579
569
- public sealed override HitSampleInfo With ( Optional < string > newName = default , Optional < string > newBank = default , Optional < string ? > newSuffix = default , Optional < int > newVolume = default )
570
- => With ( newName , newBank , newVolume ) ;
580
+ public sealed override HitSampleInfo With ( Optional < string > newName = default , Optional < string > newBank = default , Optional < string ? > newSuffix = default , Optional < int > newVolume = default , Optional < bool > newEditorAutoBank = default )
581
+ => With ( newName , newBank , newVolume , newEditorAutoBank ) ;
571
582
572
- public virtual LegacyHitSampleInfo With ( Optional < string > newName = default , Optional < string > newBank = default , Optional < int > newVolume = default ,
583
+ public virtual LegacyHitSampleInfo With ( Optional < string > newName = default , Optional < string > newBank = default , Optional < int > newVolume = default , Optional < bool > newEditorAutoBank = default ,
573
584
Optional < int > newCustomSampleBank = default ,
574
585
Optional < bool > newIsLayered = default )
575
- => new LegacyHitSampleInfo ( newName . GetOr ( Name ) , newBank . GetOr ( Bank ) , newVolume . GetOr ( Volume ) , newCustomSampleBank . GetOr ( CustomSampleBank ) , newIsLayered . GetOr ( IsLayered ) ) ;
586
+ => new LegacyHitSampleInfo ( newName . GetOr ( Name ) , newBank . GetOr ( Bank ) , newVolume . GetOr ( Volume ) , newEditorAutoBank . GetOr ( EditorAutoBank ) , newCustomSampleBank . GetOr ( CustomSampleBank ) , newIsLayered . GetOr ( IsLayered ) ) ;
576
587
577
588
public bool Equals ( LegacyHitSampleInfo ? other )
578
589
// The additions to equality checks here are *required* to ensure that pooling works correctly.
@@ -604,7 +615,7 @@ public FileHitSampleInfo(string filename, int volume)
604
615
Path . ChangeExtension ( Filename , null )
605
616
} ;
606
617
607
- public sealed override LegacyHitSampleInfo With ( Optional < string > newName = default , Optional < string > newBank = default , Optional < int > newVolume = default ,
618
+ public sealed override LegacyHitSampleInfo With ( Optional < string > newName = default , Optional < string > newBank = default , Optional < int > newVolume = default , Optional < bool > newEditorAutoBank = default ,
608
619
Optional < int > newCustomSampleBank = default ,
609
620
Optional < bool > newIsLayered = default )
610
621
=> new FileHitSampleInfo ( Filename , newVolume . GetOr ( Volume ) ) ;
0 commit comments