Used with BASS_OPUS_StreamCreate to initialize a raw Opus decoder.
typedef struct { BYTE version; BYTE channels; WORD preskip; DWORD inputrate; short gain; BYTE mapping; BYTE streams; BYTE coupled; BYTE chanmap[255]; } BASS_OPUS_HEAD;
version | This should be 1, but anything below 16 will be accepted. |
channels | This is the number of output channels. |
preskip | This is the number of samples to discard from the decoder output when starting playback. |
inputrate | This is the sample rate of the original input (before encoding), in Hz. |
gain | This is a gain in dB to be applied when decoding, stored in 8.8 fixed-point. |
mapping | This is the channel mapping family, which indicates the order and semantic meaning of the output channels. |
streams | This is the total number of streams encoded in each packet. |
coupled | This is the number of streams whose decoders are to be configured to produce two channels (stereo). This must be no larger than streams. |
chanmap | This table defines the mapping from encoded streams to output channels. channels determines the number of elements used (the rest can be omitted). |
streams, coupled, and chanmap are not used (they can be omitted) when mapping is 0. channels is usually limited to 2 in this case, but BASS_OPUS_StreamCreate allows higher numbers to be used and automatically sets appropriate streams, coupled, and chanmap values for them. Standard channel mapping family 1 values are used for up to 8 channels, and channel mapping family 255 with sequential uncoupled channels (ie. coupled = 0) is used for any more than that.
BASS_OPUS_HEAD head = { 1, 2 }; // version = 1, channels = 2, everything else = 0 HSTREAM stream = BASS_OPUS_StreamCreate(&head, 0, OpusStreamProc, 0); // create the stream