static unsafe IAudioStream[] CreateStreams(RSTMHeader *rstm) { switch ((WaveEncoding)rstm->HEADData->Part1->_format._encoding) { case WaveEncoding.ADPCM: return(ADPCMStream.GetStreams(rstm, rstm->DATAData->Data)); case WaveEncoding.PCM16: return(PCMStream.GetStreams(rstm, rstm->DATAData->Data)); } throw new Exception("RSTMLib does not support decoding RSTM files with this encoding."); }
public static ADPCMStream[] GetStreams(RSTMHeader* pRSTM, VoidPtr dataAddr) { HEADHeader* pHeader = pRSTM->HEADData; StrmDataInfo* part1 = pHeader->Part1; int c = part1->_format._channels; ADPCMStream[] streams = new ADPCMStream[c.RoundUpToEven() / 2]; for (int i = 0; i < streams.Length; i++) { int x = (i + 1) * 2 <= c ? 2 : 1; streams[i] = new ADPCMStream(pRSTM, x, i * 2, dataAddr); } return streams; }