@@ -595,8 +595,8 @@ static string constructAnnotationText(Annotation annotation)
595
595
void LoadAndPlaySound ( byte [ ] data , string soundName )
596
596
{
597
597
var ( header , pcmData ) = SawyerStreamReader . LoadWavFile ( data ) ;
598
- var uiSoundObj = new UiSoundObject { Data = pcmData , Header = header , SoundName = soundName } ;
599
- var uiSoundObjectList = new UiSoundObjectList ( ) ;
598
+ var uiSoundObj = new UiSoundObject ( soundName , header , pcmData ) ;
599
+ var uiSoundObjectList = new UiSoundObjectList ( soundName ) ;
600
600
uiSoundObjectList . Audio . Add ( uiSoundObj ) ;
601
601
CurrentUIObject = uiSoundObjectList ;
602
602
@@ -608,16 +608,16 @@ void LoadAndPlaySound(byte[] data, string soundName)
608
608
}
609
609
}
610
610
611
- void LoadSoundEffectFile ( byte [ ] data )
611
+ void LoadSoundEffectFile ( byte [ ] data , string soundName )
612
612
{
613
613
var sfxs = SawyerStreamReader . LoadSoundEffectsFromCSS ( data ) ;
614
614
615
615
var i = 0 ;
616
- var uiSoundObjectList = new UiSoundObjectList ( ) ;
616
+ var uiSoundObjectList = new UiSoundObjectList ( soundName ) ;
617
617
618
618
foreach ( var ( header , pcmData ) in sfxs )
619
619
{
620
- var uiSoundObj = new UiSoundObject { Data = pcmData , Header = SawyerStreamWriter . WaveFormatExToRiff ( header , pcmData . Length ) , SoundName = Enum . GetValues < SoundId > ( ) . ToList ( ) [ i ++ ] . ToString ( ) } ;
620
+ var uiSoundObj = new UiSoundObject ( Enum . GetValues < SoundId > ( ) . ToList ( ) [ i ++ ] . ToString ( ) , SawyerStreamWriter . WaveFormatExToRiff ( header , pcmData . Length ) , pcmData ) ;
621
621
uiSoundObjectList . Audio . Add ( uiSoundObj ) ;
622
622
}
623
623
@@ -654,6 +654,7 @@ public void ImportWave(string soundNameToUpdate)
654
654
if ( currentUIObject is UiSoundObjectList uiSoundObjList )
655
655
{
656
656
var soundObj = uiSoundObjList . Audio . Single ( s => s . SoundName == soundNameToUpdate ) ;
657
+ //soundObj = new UiSoundObject(soundNameToUpdate, header, pcmData);
657
658
soundObj . Header = header ;
658
659
soundObj . Data = pcmData ;
659
660
RefreshObjectUI ( ) ;
@@ -664,10 +665,10 @@ public void ImportWave(string soundNameToUpdate)
664
665
{
665
666
logger . Info ( $ "Replacing music track { soundNameToUpdate } with { openFileDialog . FileName } ") ;
666
667
}
667
- else
668
- {
669
- logger . Warning ( $ "Sound name { soundNameToUpdate } was not recognised - no action will be taken.") ;
670
- }
668
+ // else // commenting out because this falsely triggers for cs1.dat for sound effect names
669
+ // {
670
+ // logger.Warning($"Sound name {soundNameToUpdate} was not recognised - no action will be taken.");
671
+ // }
671
672
}
672
673
}
673
674
}
@@ -954,7 +955,7 @@ void LoadNull(string dataKey)
954
955
955
956
void LoadG1 ( string filename )
956
957
{
957
- CurrentUIObject = new UiG1 { G1 = model . G1 } ;
958
+ CurrentUIObject = new UiG1 ( model . G1 ) ;
958
959
LoadDataDump ( filename , true ) ;
959
960
}
960
961
@@ -990,7 +991,7 @@ void tv_AfterSelect(object sender, TreeViewEventArgs e)
990
991
{
991
992
logger . Debug ( $ "Loading sound effects for { e . Node . Name } ") ;
992
993
var sfx = model . SoundEffects [ e . Node . Name ] ;
993
- LoadSoundEffectFile ( sfx ) ;
994
+ LoadSoundEffectFile ( sfx , e . Node . Text ) ;
994
995
}
995
996
else if ( Path . GetExtension ( e . Node . Name ) . Equals ( ".dat" , StringComparison . OrdinalIgnoreCase ) )
996
997
{
@@ -1247,7 +1248,7 @@ void RefreshObjectUI()
1247
1248
1248
1249
var hdr = soundObject . SoundObjectData . PcmHeader ;
1249
1250
var text = uiLocoObj . LocoObject . StringTable . Table [ "Name" ] [ LanguageId . English_UK ] ?? "<null>" ;
1250
- var pn = CreateSoundUI ( new UiSoundObject { Data = soundObject . PcmData , Header = SawyerStreamWriter . WaveFormatExToRiff ( hdr , soundObject . PcmData . Length ) , SoundName = text } ) ;
1251
+ var pn = CreateSoundUI ( new UiSoundObject ( text , SawyerStreamWriter . WaveFormatExToRiff ( hdr , soundObject . PcmData . Length ) , soundObject . PcmData ) ) ;
1251
1252
flpImageTable . Controls . Add ( pn ) ;
1252
1253
}
1253
1254
0 commit comments