libertyernie / brawltools

BrawlBox and BrawlLib
http://forums.kc-mm.com/index.php?topic=67847.0
142 stars 31 forks source link

Implementing BrawlLib into another project #177

Closed The-Silver-Kid closed 6 years ago

The-Silver-Kid commented 6 years ago

I am creating a program to read and play RSTM files (Mostly BRSTM and BCSTM files) and I was wondering how I would go about using BrawlLib to handle this for me so I wouldnt have to recreate one myself. I have looked at the RSTMNode.cs and all of its base classes but I just cant seem to get anywhere with it.

Also if this is not the correct place for this type of a request, sorry. i just didn't know where else to go for it.

libertyernie commented 6 years ago

You can create an RSTMNode from a file with NodeFactory:

NodeFactory.FromFile(null, "C:\\file.brstm");

The important thing to note is that RSTMNode (and a couple other classes, I think) implement IAudioSource. Calling CreateStreams() will get you an array of IAudioStream (usually just one) which are either mono or stereo. Then you can use ReadSamples (and Wrap when you reach the end of the loop, if any.)

You might want to check out VGAudio - it supports RSTM and a bunch of other formats, and it's also written in C#.

The-Silver-Kid commented 6 years ago

Thanks. Ill look into both and see what works best for what I need.