 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Frankie Leong Guest
|
Posted: Sat Feb 24, 2007 8:14 am Post subject: Separate Wave format and wave data |
|
|
I would like to separate the format block and data block from a wave file
(PCM) and store them in a table separately.
What is the size of the format block in byte?
Can the format block be generate by code, so that I don't need to store it?
I will also need to combine the 2 blocks again and send it to playSound.
Any simple and effective way?
Thank you |
|
| Back to top |
|
 |
Michel Leunen Guest
|
Posted: Sat Feb 24, 2007 9:09 pm Post subject: Re: Separate Wave format and wave data |
|
|
Frankie Leong wrote:
| Quote: | What is the size of the format block in byte?
|
The format block is a chunk of data beginning with an ID of four char
bytes containing the letters 'fmt '. After the chunk ID, you'll find the
chunk size. Here is the structure representing the Format chunk:
struct FormatChunk
{
char chunkID[4];
long chunkSize;
short wFormatTag;
unsigned short wChannels;
unsigned long dwSamplesPerSec;
unsigned long dwAvgBytesPerSec;
unsigned short wBlockAlign;
unsigned short wBitsPerSample;
// Note: there may be additional fields here, depending upon wFormatTag.
};
Note also that the format chunk *must* be the very first chunk.
| Quote: | Can the format block be generate by code, so that I don't need to store it?
|
You must at least allocate a structure (record) representing this chunk
and then fill it with the right data.
| Quote: |
I will also need to combine the 2 blocks again and send it to playSound.
|
The data chunk is as followed:
struct Chunk
{
char chunkID[4];
long chunkSize;
};
You can give the PlaySound() function a pointer to your record in memory
and specify SND_MEMORY as the fdwSound parameter.
HTH,
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
---------------------------------------- |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|