Handling Chunks Of Raw Audio Data With Sdl - Help?


Khatoblepas

Still Fresh
Joined
Dec 28, 2005
Messages
94
Age
35
Location
England
Website
Visit site
I'm trying to write out a cloned engine for Albion (obscure PC RPG, circa 1996), and I've got most of the visual bits ready for coding, but the audio escapes me. My problem is this:

The digital audio files for Albion are stored in four files, SAMPLE0.XLD, SAMPLE1.XLD, SAMPLE2.XLD and WAVELIB0.XLD. All of these are merely containers for RAW Audio files recorded at Mono 11Khz. Unfortunately, I haven't found any functions in SDL for taking raw data out of an array and playing it at a specified frequency. It seems you can't have multiple sampling frequencies, but I think I may be wrong. The XMIDI files, also are stored in the same way as the samples. However am I going to get it to fit into SDL's functions?

As far as I know, my options are this:

Unpack the whole file on the fly into Mixer_LoadRAW and only play the parts that are needed, then unload it when not needed.
Which would be easiest to do, I guess, but very slow.

Unpack the four files at the start of the game in the init and play only the parts that are needed.
Wastes RAM! But also very easy and doesn't need constant unloading.

Seek the appropriate files and read only the sample needed at the time on the fly, and...
This is where I run into trouble. Usually, I'd just dump the sample, (with added header), to disk, and reload it back in. But I can't do that for the 2x, since there is no harddrive. I'd need to find some way of loading the RAW sample into th SDL Mixer sample memory. I'd know which sample was which, since I've been looking at the easier XLDs for months now. o.o I'd create IDfiles for it. But it's my favourite way of doing things, since it allows for quick, minimal loading and very little RAM wasted. But I'd need help to figure out how I'd do it. Same for the XMIDI, really. And what IS XMIDI? The same as MIDI?

I wanna make something special for the 2x, and Albion is my favourite game, so yay. SDL must be used because of TV-Out and porting issues (The Lead Programmer of Albion wants to run it on modern computers, and so do I, so, if it's in SDL it's easily ported. WinAlbion and LinAlbion! Yay!).

I'm sorry if this is in the wrong section. They look so similar. o.o And I do need help.
 
Back
Top