Witam, cos nie moge odtworzyc .wav
Co robie nie tak ;< ?
FILE *wavFile;
wavFile = fopen(FileDialog1->GetPath(), "rb");
if( wavFile == NULL )
{
}
else
{
typedef struct WAV_HEADER{
char RIFF[4];
unsigned long ChunkSize;
char WAVE[4];
char fmt[4];
unsigned long Subchunk1Size;
unsigned short AudioFormat;
unsigned short NumOfChan;
unsigned long SamplesPerSec;
unsigned long BytesPerSec;
unsigned short BlockAlign;
unsigned short BitsPerSample;
char Subchunk2ID[4];
unsigned long Subchunk2Size;
}wav_hdr;
wav_hdr wavHeader;
int headerSize = sizeof(wav_hdr),filelength = 0;
fread(&wavHeader,headerSize,1,wavFile);
fclose(wavFile);
SAMPLE_RATE = wavHeader.SamplesPerSec;
NUM_CHANNELS = wavHeader.NumOfChan;
data.frameIndex = 0;
numSamples = ((8 * wavHeader.Subchunk2Size)/wavHeader.BitsPerSample );
totalFrames = (numSamples / NUM_CHANNELS);
NUM_SECONDS = (totalFrames / SAMPLE_RATE);
fread( data.recordedSamples, wavHeader.Subchunk2Size, totalFrames, wavFile );
fclose( wavFile );