Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Commit

Permalink
Add some XACT Clip info (thanks Tom!)
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Jan 27, 2014
1 parent dff80e9 commit 7764f44
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions MonoGame.Framework/Audio/CueData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,19 @@ public XACTClip(BinaryReader reader, double clipVolume)
// Full Event information
uint eventInfo = reader.ReadUInt32();

// XACT Event Type
// XACT Event Type, Timestamp
uint eventType = eventInfo & 0x0000001F;
uint eventTimestamp = (eventInfo >> 5) & 0x0000FFFF;
// uint eventUnknown = eventInfo >> 21;

// Random offset, unused
reader.ReadUInt16();

// Load the Event
if (eventType == 1)
{
// Unknown values
reader.ReadBytes(3);
// Unknown value
reader.ReadByte();

/* Event Flags
* 0x01 = Break Loop
Expand Down Expand Up @@ -353,8 +358,8 @@ public XACTClip(BinaryReader reader, double clipVolume)
}
else if (eventType == 3)
{
// Unknown values
reader.ReadBytes(3);
// Unknown value
reader.ReadByte();

/* Event Flags
* 0x01 = Break Loop
Expand Down Expand Up @@ -404,8 +409,8 @@ public XACTClip(BinaryReader reader, double clipVolume)
}
else if (eventType == 4)
{
// Unknown values
reader.ReadBytes(3);
// Unknown value
reader.ReadByte();

/* Event Flags
* 0x01 = Break Loop
Expand Down Expand Up @@ -457,8 +462,8 @@ public XACTClip(BinaryReader reader, double clipVolume)
}
else if (eventType == 6)
{
// Unknown values
reader.ReadBytes(3);
// Unknown value
reader.ReadByte();

/* Event Flags
* 0x01 = Break Loop
Expand Down Expand Up @@ -540,7 +545,7 @@ public XACTClip(BinaryReader reader, double clipVolume)
else if (eventType == 8)
{
// Unknown values
reader.ReadBytes(5);
reader.ReadBytes(3);

// Operand Constant
float constant = reader.ReadSingle();
Expand All @@ -554,7 +559,14 @@ public XACTClip(BinaryReader reader, double clipVolume)
}
else
{
// TODO: All XACT Events
/* TODO: All XACT Events.
* The following type information is based on
* third-party contributions:
* Type 0 - Stop Event
* Type 7 - Pitch Event
* Type 9 - Marker Event
* -flibit
*/
throw new Exception(
"EVENT TYPE " + eventType + " NOT IMPLEMENTED!"
);
Expand Down

0 comments on commit 7764f44

Please sign in to comment.