ndspy.soundGroup: Sound Groups

The ndspy.soundGroup module contains classes and enumerations related to sound groups.

A group is a collection of IDs of items that exist elsewhere in an SDAT file, which can be of different types. Games use groups to make lists of files that should be loaded together.

ndspy represents a group as a list of GroupEntrys.

See also

If you aren’t familiar with how SDAT files are structured, consider reading the appendix explaining this.

class ndspy.soundGroup.GroupEntryType
Base class:

enum.IntEnum

An enumeration that distinguishes between the types of files that a group entry can refer to.

SSEQ

The group entry refers to a SSEQ (sequence) file.

SBNK

The group entry refers to a SBNK (instrument bank) file.

SWAR

The group entry refers to a SWAR (wave archive) file.

SSAR

The group entry refers to a SSAR (sequence archive) file.

class ndspy.soundGroup.SWARLoadMethod
Base class:

enum.IntEnum

An enumeration that distinguishes between the ways in which a SWAR can be loaded.

Note

ndspy doesn’t expose raw SDAT file IDs, and that functionality seems to never really be used in practice (and there’s honestly no good reason to do so), so you don’t really need to worry about this very much.

FILE_IDS

ndspy.soundBank.SBNK.waveArchiveIDs contains raw SDAT file IDs.

SWAR_IDs

ndspy.soundBank.SBNK.waveArchiveIDs contains SWAR IDs.

class ndspy.soundGroup.GroupEntry([type[, options[, id]]])

An entry in a sound group.

SSEQ group entries usually have GroupEntry.loadSSEQ and GroupEntry.loadSWAR set to True, and GroupEntry.SWARLoadMethod set to SWARLoadMethod.SWAR_IDS.

SBNK group entries usually have GroupEntry.loadSWAR set to True, and GroupEntry.SWARLoadMethod set to SWARLoadMethod.SWAR_IDS.

SWAR group entries usually have GroupEntry.loadSWAR set to True, and GroupEntry.SWARLoadMethod set to SWARLoadMethod.SWAR_IDS.

SSAR group entries usually have GroupEntry.loadSSAR set to True.

Parameters:
id

The ID (index) of the file the group entry refers to.

Type:

int

Default:

0

loadSBNKSWARsFrom

This attribute determines how SWAR IDs in an SBNK (see: ndspy.soundBank.SBNK.waveArchiveIDs) will be interpreted – either as raw SDAT file IDs or as SWAR IDs.

Note

ndspy doesn’t expose raw SDAT file IDs, and this functionality seems to never really be used in practice (and there’s honestly no good reason to do so), so you don’t really need to worry about this very much.

Note

This value hasn’t been tested; the explanation here is based on reverse-engineeered code. If you test it, please send a PR to update this documentation with your findings!

Type:

SWARLoadMethod

Default:

SWARLoadMethod.SWAR_IDS

loadSSAR

Whether this group entry should cause a SSAR to be loaded.

Type:

bool

Default:

False

loadSSEQ

Whether this group entry should cause a SSEQ to be loaded.

Type:

bool

Default:

False

loadSWAR

Whether this group entry should cause a SWAR to be loaded.

Type:

bool

Default:

False

type

The type of file the group entry refers to.

Type:

GroupEntryType

Default:

GroupEntryType.SSEQ

classmethod fromFlags(type, id[, loadSSEQ[, loadSBNKSWARsFrom[, loadSWAR[, loadSSAR]]]])

Create a sound group entry from individual attribute values.

Parameters:
  • type – The initial value for the type attribute.

  • id – The initial value for the id attribute.

  • loadSSEQ – The initial value for the loadSSEQ attribute.

  • loadSBNKSWARsFrom – The initial value for the loadSBNKSWARsFrom attribute.

  • loadSWAR – The initial value for the loadSWAR attribute.

  • loadSSAR – The initial value for the loadSSAR attribute.

Returns:

The sound group entry object.

Return type:

GroupEntry

save()

Return this sound group entry’s type, options value, and id as a triple. This matches the parameters of the default class constructor.

Returns:

The group entry’s type, options value, and id.

Return type:

(type, options, id), where type is of type GroupEntryType, options is of type int, and id is of type int