Totally new to this.
Have written an app that loads sound files into an array and plays them all back simultaneously. I feel confident that this is the worst way to do this. Here’s my code:
a segmentation fault is something that happens when you try to put your hands in a memory area you are not supposed to poke your fingers into; it often happens when you make mistakes with pointers and/or arrays and makes you program close in your face.
in your code you’re creating an array 195 char long, for 195 times, which i suppose was not the way you wanted it.
Thanks for the reply. I get segmentation fault now. How would I go about achieving the same ends? I want to load 195 files (more, actually), and play them simultaneously.
ops, sorry… try to declare songNumber as a char* then cast it to a string after the sprintf() call.
for the hardware part: first thing i would do would be to sum up the size of all the audio files and check if you have enough free ram before loading the files.
I used char* and it runs again, but I still get a segmentation fault. Without doing the real math, I don’t think I have enough memory for this as I ultimately want to play something closer to 400 audio files simultaneously. I don’t think this is the best way to achieve this. Is this at all possible?
So…
What if I were to modify my approach. The program randomly select two audio files, merge them and output a new file, then grab another file, merge it and output that, and so on and so forth until I’d run through the entire array.
anyway, I don’t know what you’re trying to do, but are you sure you really need to mix all those files in your program? if they’ll play together all the time it would be probably easier o mix them with some sound editing software and importing just 1 file (or just a few) in your program…