So I got easily distracted today from working on Veh code and started poking around ambience file format. I'd be curious if anyone else has done analysis on them. This is pretty rough break down that I'll likely improve once I spend more time on audio but I thought I would post it.
soundx.dll: sub_10003A30(char *)
SMACX (not full list of functions but I thought might be interesting as list of triggers, not all factions use all):
void __cdecl load_music(int factionID)
void __cdecl ambience_veh(int vehID)
int __cdecl ambience(int)
Ambience::load(char const *)
Ambience::unload(void)
FactionAmbience::begin(void)
FactionAmbience::tech(void)
FactionAmbience::terraform(void)
FactionAmbience::production(void)
FactionAmbience::general(void)
FactionAmbience::basewin_show(void)
FactionAmbience::basewin_hide(void)
FactionAmbience::design_window_show(void)
FactionAmbience::design_window_hide(void)
FactionAmbience::new_base(void)
FactionAmbience::popup1(void)
FactionAmbience::eot(void)
FactionAmbience::hostility(void)
FactionAmbience::energy_resources(void)
FactionAmbience::base_liberated(void)
prgm: [size: 36 + variable string lengths]
offset : [size]
+0: [4] 'prgm' ; string header
+4: [4] length ; excludes header and length
+8: [4] unk1 ; audio property?
+12: [4] unk2 ; audio property?
+16: [4] unk3 ; audio property?
+20: [4] unk4 ; audio property?
+24: [4] unk5 ; audio property?
+28: [4] unk6 ; audio property?
+32: [4] unk7 ; audio property?
+36: [variable] ref1 (null terminated string) ; kmap reference or file path?
+??: [variable] ref2 (null terminated string) ; can be same as ref1; offset is ref1 length + 1; optional?
prgm count:
aset1.amb: 14 (SMACX factions)
bset1.amb: 12 (Believers)
gset1.amb: 13 (Gaians, Peacekeepers)
mset1.amb: 10 (Hive, Morgan)
pset1.amb: 1 (unused, incomplete Peacekeepers?)
sset1.amb: 7 (Spartans)
uset2.amb: 8 (University)
ustart.amb: 8 (Start Menu)
kmap: [size: 44 + variable string lengths]
offset : [size]
+0: [4] 'kmap' ; string header
+4: [4] length ; excludes header and length
+8: [4] unk1 ; audio property?
+12: [4] unk2 ; audio property?
+16: [4] unk3 ; audio property?
+20: [variable] ref1 (null terminated string) ; reference used by prgm?
+??: [4] unk4 ; audio property?
+??: [4] unk5 ; audio property?
+??: [4] unk6 ; audio property?
+??: [4] unk7 ; audio property?
+??: [4] unk8 ; audio property?
+??: [variable] ref2 (null terminated string) ; looks to be file path
+??: [4] unk9 ; looks like it could be some kind of length or offset
kmap count:
aset1.amb: 12 (SMACX factions)
bset1.amb: 12 (Believers)
gset1.amb: 13 (Gaians, Peacekeepers)
mset1.amb: 10 (Hive, Morgan)
pset1.amb: 1 (unused, incomplete Peacekeepers?)
sset1.amb: 13 (Spartans)
uset2.amb: 8 (University)
ustart.amb: 8 (Start Menu)
trak: [length: 20]
offset : [size]
+0: [4] 'trak' ; string header
+4: [4] length ; excludes header and length
+8: [4] unk1 (signed); index?
+12: [4] unk2 (signed); index?
+16: [4] unk3 (signed); index?
trak count:
aset1.amb: 12 (SMACX factions)
bset1.amb: 6 (Believers)
gset1.amb: 27 (Gaians, Peacekeepers)
mset1.amb: 18 (Hive, Morgan)
pset1.amb: 0 (unused, incomplete Peacekeepers?)
sset1.amb: 5 (Spartans)
uset2.amb: 6 (University)
ustart.amb: 16 (Start Menu)
glbl: [size: 8 + variable length]
offset : [size]
+0: [4] 'glbl' ; string header
+4: [4] length ; excludes header and length
+??: looks like a large number of index values
glbl count:
aset1.amb: 1 (SMACX factions)
bset1.amb: 1 (Believers)
gset1.amb: 1 (Gaians, Peacekeepers)
mset1.amb: 1 (Hive, Morgan)
pset1.amb: 1 (unused, incomplete Peacekeepers?)
sset1.amb: 1 (Spartans)
uset2.amb: 1 (University)
ustart.amb: 1 (Start Menu)
chnl: header referenced in soundx.dll function but unused in amb files; assume this is related to setting some kind of channel data
MThd: start of midi part of file
See:
http://somascape.org/midi/tech/mfile.html