1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
fstream ifs ("/Users/LilianaVess/Desktop/daremoshiranai.wav", ios_base::in);
if(ifs.is_open())
{
char First_Chunk_ID[5] ={NULL} ;
ifs.read(First_Chunk_ID,4);
long Chunk_Data_Size;
ifs.read( reinterpret_cast<char*>(&Chunk_Data_Size), sizeof(4) );
char RIFF_Type[5] ={NULL} ;
ifs.read(RIFF_Type,4);
char Wave_Chunk_ID[5] = {NULL} ;
ifs.read(Wave_Chunk_ID,4);
long Wave_Chunck_Size;
ifs.read( reinterpret_cast<char*>(&Wave_Chunck_Size), sizeof(4) );
char Audio_Format[3]={NULL};
ifs.read(Audio_Format,2);
char Num_Channel[3]={NULL};
ifs.read(Num_Channel,2);
char Sample_Rate[5]={NULL};
ifs.read(Sample_Rate,4);
char Avg_bps[5]={NULL};
ifs.read(Avg_bps,4);
char Block_Align[3]={NULL};
ifs.read(Block_Align,2);
char Significant_Bits_Sample[3]={NULL};
ifs.read(Significant_Bits_Sample,2);
char Third_Chunk_ID[5] = {NULL} ;
ifs.read(Third_Chunk_ID, 4);
long Data_Size;
ifs.read( reinterpret_cast<char*>(&Data_Size), sizeof(4) );
char Data[20000];
ifs.read(Data,20000);
cout << "First_Chunk_ID : " << First_Chunk_ID << endl
<< "Chunk_Data_Size : " << Chunk_Data_Size << endl
<< "RIFF_Type : " << RIFF_Type<< endl
<< "Wave_Chunk_ID: " << Wave_Chunk_ID<< endl
<< "Wave_Chunck_Size : " << Wave_Chunck_Size << endl
<< "Audio_Format : " << Audio_Format<< endl
<< "Num_Channel : " << Num_Channel << endl
<< "Sample_Rate : " << Sample_Rate << endl
<< "Avg_bps :" << Avg_bps << endl
<< "Block_Align :" << Block_Align << endl
<< "Significant_Bits_Sample :" << Significant_Bits_Sample << endl
<< "Third_Chunk_ID : " << Third_Chunk_ID << endl
<< " Data_Size " << Data_Size << endl
<< "Data gcount : " << ifs.gcount() << endl;
}
}
|