1
votes

In short: I would like to buffer a whole audio file (wave) in the heap. So basically, I would use one arrays for each channel, containing max 10 min * 60 sec * 44100 samples. (I just limit the length to 10min and converting to 44100 samples/sec if necessary.)

So I would have to use two arrays with a length of 26460000 elements at max. Regarding the size, the arrays would contain 16bit integers, adding up to ~100mbyte per file. (The applications should be allowed to open 4 files at once, so the memory used would add up to ~400mbytes)

The question is, if this would work on a windows (32bit) system or if I should use a more dynamic sample management instead? I guess what would help is to cut the buffer int chunks of (for example) 1024 samples, so I wouldn't have to use a huge array but a bunch of smaller arrays.

If this wouldn't be a good idea, how could I implement a sample management that could handle sudden jumps to a specific position in the file or repeating some samples. (So a "simple" circle buffer which overwrites old / used samples wouldn't help really...)

1

1 Answers

0
votes

No big deal even on Win32. Do use std::vector::reserve, you know up front how many samples there are.