File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ namespace CATHODE
1313 /* DATA/ENV/PRODUCTION/x/WORLD/SOUNDBANKDATA.DAT */
1414 public class SoundBankData : CathodeFile
1515 {
16+ //NOTE: you can use Utilities.SoundHashedString to hash these strings and get the Wwise ID used in other places like SoundEventData
17+
1618 public List < string > Entries = new List < string > ( ) ;
1719 public static new Implementation Implementation = Implementation . CREATE | Implementation . LOAD | Implementation . SAVE ;
1820 public SoundBankData ( string path ) : base ( path ) { }
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ override protected bool SaveInternal()
7575 #region STRUCTURES
7676 public class Soundbank
7777 {
78- public uint id ;
78+ public uint id ; //This is the hashed soundbank string name (hashed via Utilities.SoundHashedString)
7979 public List < Event > events = new List < Event > ( ) ;
8080
8181 public class Event
Original file line number Diff line number Diff line change 66using System . Linq ;
77using System . Numerics ;
88using System . Runtime . InteropServices ;
9- using System . Runtime . Serialization . Formatters . Binary ;
9+ using System . Runtime . Serialization . Formatters . Binary ;
10+ using System . Text ;
1011
1112namespace CathodeLib
1213{
@@ -212,6 +213,21 @@ public static uint AnimationHashedString(string str)
212213 return hash ;
213214 }
214215
216+ //Generate a hashed string for use in sound system (wwise FNV-1)
217+ public static uint SoundHashedString ( string str )
218+ {
219+ byte [ ] namebytes = Encoding . UTF8 . GetBytes ( str . ToLower ( ) ) ;
220+ uint hash = 2166136261 ;
221+ for ( int i = 0 ; i < namebytes . Length ; i ++ )
222+ {
223+ byte namebyte = namebytes [ i ] ;
224+ hash = hash * 16777619 ;
225+ hash = hash ^ namebyte ;
226+ hash = hash & 0xFFFFFFFF ;
227+ }
228+ return hash ;
229+ }
230+
215231 //Read a PAK
216232 public static List < PAKContent > ReadPAK ( string path , FileIdentifiers type )
217233 {
You can’t perform that action at this time.
0 commit comments