how i create a big buffer of 1 MB to store a big sound data.
hi,
how can i create a big buffer ogf 1 MB to store sound to paly
can i use array of byte type ,, if yes then how???
plz help mee
January 29, 2004 11:39 AM
char *buffer = new char[1024]; // Or whatever size.
Don''t forget to eventually delete[] your buffer when you''re done.
char* buffer = new[1024 * 1024];
But you should think about streaming audio at that point, really.
But you should think about streaming audio at that point, really.
I created 2 buffers of 8 MB each,
char SoundBuffer1[1024*1024*8];
char SoundBuffer2[1024*1024*8];
So I can always play at least 1 at a time, and fade into another. Then once the fade is complete, I overwrite my new buffer with yet another song.. it works well and you don''t need to worry about allocation/freeing... It''s probably more efficient this way, and produces less memory holes since I dont constantly allocate/deallocate.
my songs can be at most 8mb mp3 or wave files..
char SoundBuffer1[1024*1024*8];
char SoundBuffer2[1024*1024*8];
So I can always play at least 1 at a time, and fade into another. Then once the fade is complete, I overwrite my new buffer with yet another song.. it works well and you don''t need to worry about allocation/freeing... It''s probably more efficient this way, and produces less memory holes since I dont constantly allocate/deallocate.
my songs can be at most 8mb mp3 or wave files..
What''s wrong with ::operator new( 1024 * 1024 )? This way you don''t have to tie it to a char, you can just specify its size in bytes.
January 29, 2004 05:26 PM
quote: Original post by superdeveloper
I created 2 buffers of 8 MB each,
char SoundBuffer1[1024*1024*8];
char SoundBuffer2[1024*1024*8];
So I can always play at least 1 at a time, and fade into another. Then once the fade is complete, I overwrite my new buffer with yet another song.. it works well and you don''t need to worry about allocation/freeing... It''s probably more efficient this way, and produces less memory holes since I dont constantly allocate/deallocate.
my songs can be at most 8mb mp3 or wave files..
Doesn''t it seem to you that it is inefficient to use such big static buffers? One mp3 file of 8Mb size will take about 80Mb of memory when it will be decompressed. I would advice you to use streaming.
quote: Original post by Anonymous Poster
...
Doesn''t it seem to you that it is inefficient to use such big static buffers? One mp3 file of 8Mb size will take about 80Mb of memory when it will be decompressed. I would advice you to use streaming.
ya I figured as much.. but I let my "media-manager" use this file data to play the music (memory-filter), so I am presuming that the filter will take bits-by-bits of the music and decompress it automatically for playback (in a separate volatile playback memory buffer). I should hope that it does not decompress the entire file.
My main concern is that I want no disk I/O during my rendering, so this was the only way I thought of... the only limitation is that the music is 8 MB maximum size (roughly 8 minutes I guess)..
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement