53 using std::stringstream;
55 using namespace Nsound;
92 M_THROW(
"setDefaultSampleSize(): Can't use size " << size);
120 const boolean & use_ieee_floats)
128 #pragma clang diagnostic push
129 #pragma clang diagnostic ignored "-Wunused-function"
208 return static_cast<int32>(((i & 0xff000000) >> 24 |
209 ((i & 0x00ff0000) >> 8 |
210 ((i & 0x0000ff00) << 8 |
211 ((i & 0x000000ff) << 24)))));
218 return static_cast<int32>(((i & 0x00ff0000) >> 16 |
220 ((i & 0x000000ff) << 16))));
227 return static_cast<int32>(((i & 0x0000ff00) >> 8 |
228 ((i & 0x000000ff) << 8)));
232 #pragma clang diagnostic pop
235 #ifdef NSOUND_PLATFORM_OS_WINDOWS
238 #define LM_UNUSED __attribute__((unused))
250 size_t _
LM_UNUSED = fread(reinterpret_cast<char*>(&temp64), n_bytes, 1, fd);
253 #ifdef NSOUND_BIG_ENDIAN
262 if(temp64 & 0x0000800000000000ULL)
264 temp64 |= 0xffff000000000000ULL;
270 if(temp64 & 0x0000000080000000ULL)
272 temp64 |= 0xffffffff00000000ULL;
278 if(temp64 & 0x0000000000800000ULL)
280 temp64 |= 0xffffffffff000000ULL;
286 if(temp64 & 0x0000000000008000ULL)
288 temp64 |= 0xffffffffffff0000ULL;
310 size_t _
LM_UNUSED = fread(reinterpret_cast<char*>(&temp32),
sizeof(
float32), 1, fd);
313 #ifdef NSOUND_BIG_ENDIAN
330 size_t _
LM_UNUSED = fread(reinterpret_cast<char*>(&temp64),
sizeof(
float64), 1, fd);
333 #ifdef NSOUND_BIG_ENDIAN
352 #ifdef NSOUND_BIG_ENDIAN
356 fwrite(reinterpret_cast<char*>(&value), n_bytes, 1, output);
369 #ifdef NSOUND_BIG_ENDIAN
374 fwrite(reinterpret_cast<char*>(&value), 1,
sizeof(
float32), output);
387 #ifdef NSOUND_BIG_ENDIAN
394 fwrite(reinterpret_cast<char*>(&value),
sizeof(
float64), 1, output);
400 const std::string & filename,
403 std::stringstream * ss)
406 fd = fopen(filename.c_str(),
"rb");
410 M_THROW(
"Wavefile::read(): unable to open file '" << filename <<
"'");
424 M_THROW(
"Wavefile::read(): '" << filename
425 <<
"', could not read 'RIFF' from file");
441 "Wavefile::read(): '" << filename
442 <<
"', could not read 'WAVE' from file");
449 size_t cur_pos = ftell(fd);
450 fseek(fd, 0, SEEK_END);
451 size_t end_pos = ftell(fd);
454 #ifdef NSOUND_PLATFORM_OS_WINDOWS
455 fseek(fd, static_cast<long>(cur_pos), SEEK_SET);
457 fseek(fd, cur_pos, SEEK_SET);
466 uint32 average_bytes_per_second = 0;
467 uint32 block_alignment = 0;
468 uint32 bits_per_sample = 0;
479 size_t pos = ftell(fd);
484 average_bytes_per_second =
static_cast<uint32>(
readInt(fd, 4));
488 #ifdef NSOUND_PLATFORM_OS_WINDOWS
489 fseek(fd, static_cast<long>(pos + static_cast<size_t>(chunk_size)), SEEK_SET);
491 fseek(fd, pos + static_cast<size_t>(chunk_size), SEEK_SET);
497 fseek(fd, chunk_size, SEEK_CUR);
505 if(cur_pos >= end_pos)
511 <<
"', reached end of file before finding the "
524 if(data_length > (end_pos - cur_pos))
527 <<
"the data chunk size indicates the file is truncated!" << endl
528 <<
" data_chunk_size = " << data_length << endl
529 <<
" actual data size = " << (end_pos - cur_pos) << endl;
532 boolean fmt_found =
true;
538 <<
"', data length is zero!");
547 <<
"', channels is zero!");
552 if(bits_per_sample == 0)
556 <<
"', bits_per_sample is zero!");
565 n_samples = data_length / channels / (bits_per_sample / 8);
575 <<
"['RIFF'] = ['RIFF']"
578 <<
"[riff_chunk_length] = ["
583 <<
"['WAVE'] = ['WAVE']"
586 <<
"['fmt '] = ['fmt ']"
589 <<
"[format_tag] = ["
601 <<
"[sample_rate] = ["
606 <<
"[bytes_per_second] = ["
607 << average_bytes_per_second
611 <<
"[block_alignment] = ["
616 <<
"[bits_per_sample] = ["
621 <<
"['data'] = ['data']"
624 <<
"[data_length_bytes] = ["
629 <<
"[data_length_samples] = [";
636 <<
"[data_length_seconds] = ["
637 << (
static_cast<float32>(n_samples) /
638 static_cast<float32>(sample_rate))
647 <<
"[data_length_seconds] = [unknown!]"
666 <<
"', Nsound currently only supports PCM and IEEE Floating "
667 <<
"Point formats, not '"
679 switch(bits_per_sample)
726 M_THROW(
"Wavefile::read(): bits_per_sample = "
747 for(
uint32 ch = 0; ch < channels; ++ch)
751 bool format_mismatch =
false;
754 for(
uint32 i = 0; i < n_samples; ++i)
762 if(bits_per_sample == 32)
766 else if(bits_per_sample == 64)
772 format_mismatch =
true;
780 <<
"Wavefile::read(\""
783 <<
"IEEE Float but bits_per_sample = "
789 (*ss) <<
"channel[" << ch <<
"] = ";
791 for(
uint32 i = 0; i < n_samples; ++i)
802 else if(b_vector != NULL)
805 for(
uint32 i = 0; i < n_samples; ++i)
815 uint32 channels_to_store =
static_cast<uint32>(b_vector->size());
817 if(channels < channels_to_store)
819 channels_to_store = channels;
823 for(
uint32 ch = 0; ch < channels_to_store; ++ch)
829 if(bits_per_sample == 8)
834 *((*b_vector)[ch]) << static_cast<float64>(sample)
839 if(bits_per_sample == 32)
841 *((*b_vector)[ch]) << static_cast<float64>(
844 else if(bits_per_sample == 64)
850 M_THROW(
"Wavefile::read(): format is "
851 <<
"IEEE Float but bits_per_sample = "
858 for(
uint32 ch = channels_to_store; ch < channels; ++ch)
870 for(
uint32 i = 0; i < n_samples; ++i)
873 for(
uint32 ch = 0; ch < channels; ++ch)
879 if(bits_per_sample == 8)
884 (*as)[ch] <<
static_cast<float64>(sample) / data_scale;
888 if(bits_per_sample == 32)
892 else if(bits_per_sample == 64)
898 M_THROW(
"Wavefile::read(): format is "
899 <<
"IEEE Float but bits_per_sample = "
909 M_THROW(
"Wavefile::read(): unhandled case!");
922 boolean was_successful =
read(filename, NULL, &as, NULL);
924 return was_successful;
935 const std::string & filename,
938 std::stringstream ss;
956 if( bits_per_sample != 8 &&
957 bits_per_sample != 16 &&
958 bits_per_sample != 24 &&
959 bits_per_sample != 32 &&
960 bits_per_sample != 48 &&
961 bits_per_sample != 64)
964 <<
"bits per sample must be 8, 16, 24, 32, 48, 64");
970 output = fopen(filename.c_str(),
"wb");
975 <<
"unable to open file '"
987 uint32 data_length = n_samples * channels * (bits_per_sample / 8);
993 uint32 riff_chunk_length = data_length + 36;
996 uint32 block_alignment = channels * (bits_per_sample / 8);
1000 uint32 bytes_per_second = sample_rate * block_alignment;
1008 writeInt(output,4,riff_chunk_length);
1015 writeInt(output,4,bytes_per_second);
1016 writeInt(output,2,block_alignment);
1017 writeInt(output,2,bits_per_sample);
1040 switch(bits_per_sample)
1082 int64 positive_data_scale =
static_cast<int64>(data_scale);
1083 int64 negitive_data_scale =
static_cast<int64>(-1.0 * data_scale);
1085 for(
uint32 i = 0; i < n_samples; i++)
1087 for(
uint32 ch = 0; ch < channels; ++ch)
1091 scaled =
static_cast<int64>(as[ch][i] * data_scale);
1093 if(scaled > positive_data_scale)
1095 scaled = positive_data_scale;
1097 else if(scaled < negitive_data_scale)
1099 scaled = negitive_data_scale;
1105 if(bits_per_sample == 32)
1109 else if(bits_per_sample == 64)
1118 <<
"\"): format is "
1119 <<
"IEEE Float but bits_per_sample = "
1120 << bits_per_sample);
1133 const string & filename,
1138 if( bits_per_sample != 8 &&
1139 bits_per_sample != 16 &&
1140 bits_per_sample != 24 &&
1141 bits_per_sample != 32 &&
1142 bits_per_sample != 48 &&
1143 bits_per_sample != 64)
1146 <<
"bits per sample must be 8, 16, 24, 32, 64");
1153 output = fopen(filename.c_str(),
"wb");
1157 <<
"unable to open file '"
1169 uint32 data_length = n_samples * channels * (bits_per_sample / 8);
1175 uint32 riff_chunk_length = data_length + 36;
1178 uint32 block_alignment = channels * (bits_per_sample / 8);
1181 uint32 bytes_per_second = sample_rate * block_alignment;
1189 writeInt(output,4,riff_chunk_length);
1196 writeInt(output,4,bytes_per_second);
1197 writeInt(output,2,block_alignment);
1198 writeInt(output,2,bits_per_sample);
1221 switch(bits_per_sample)
1264 int64 positive_data_scale =
static_cast<int64>(data_scale);
1265 int64 negitive_data_scale =
static_cast<int64>(-1.0 * data_scale);
1267 for(
uint32 i = 0; i < n_samples; ++i)
1271 scaled =
static_cast<int64>(buffer[i] * data_scale);
1273 if(scaled > positive_data_scale)
1275 scaled = positive_data_scale;
1277 else if(scaled < negitive_data_scale)
1279 scaled = negitive_data_scale;
1285 if(bits_per_sample == 32)
1289 else if(bits_per_sample == 64)
1295 M_THROW(
"Wavefile::read(): format is "
1296 <<
"IEEE Float but bits_per_sample = "
1297 << bits_per_sample);
1313 case 0x0000:
return "Unknown";
1314 case 0x0001:
return "Microsoft PCM";
1315 case 0x0002:
return "Microsoft ADPCM";
1316 case 0x0003:
return "IEEE Float";
1317 case 0x0004:
return "Compaq VSELP";
1318 case 0x0005:
return "IBM CVSD";
1319 case 0x0006:
return "Microsoft ALAW";
1320 case 0x0007:
return "Microsoft MULAW";
1321 case 0x000A:
return "Microsoft Windows Media Audio Speech";
1322 case 0x0010:
return "OKI ADPCM";
1323 case 0x0011:
return "Intel DVI ADPCM";
1324 case 0x0012:
return "Videologic MediaSpace ADPCM";
1325 case 0x0013:
return "Sierra ADPCM";
1326 case 0x0014:
return "Antex Electronics G.723 ADPCM";
1327 case 0x0015:
return "DSP Solution DIGISTD";
1328 case 0x0016:
return "DSP Solution DIGIFIX";
1329 case 0x0017:
return "Dialogic OKI ADPCM";
1330 case 0x0018:
return "MediaVision ADPCM";
1331 case 0x0019:
return "HP CU";
1332 case 0x0020:
return "Yamaha ADPCM";
1333 case 0x0021:
return "Speech Compression Sonarc";
1334 case 0x0022:
return "DSP Group True Speech";
1335 case 0x0023:
return "Echo Speech EchoSC1";
1336 case 0x0024:
return "Audiofile AF36";
1337 case 0x0025:
return "APTX";
1338 case 0x0026:
return "AudioFile AF10";
1339 case 0x0027:
return "Prosody 1612";
1340 case 0x0028:
return "LRC";
1341 case 0x0030:
return "Dolby AC2";
1342 case 0x0031:
return "Microsoft GSM610";
1343 case 0x0032:
return "Microsoft MSNAudio";
1344 case 0x0033:
return "Antex ADPCME";
1345 case 0x0034:
return "Control Res VQLPC";
1346 case 0x0035:
return "Digireal";
1347 case 0x0036:
return "DigiADPCM AC2";
1348 case 0x0037:
return "Control Res CR10";
1349 case 0x0038:
return "NMS VBXADPCM AC2";
1350 case 0x0039:
return "Roland RDAC";
1351 case 0x003A:
return "EchoSC3";
1352 case 0x003B:
return "Rockwell ADPCM";
1353 case 0x003C:
return "Rockwell Digit LK";
1354 case 0x003D:
return "Xebec";
1355 case 0x0040:
return "Antex Electronics G.721";
1356 case 0x0041:
return "Antex Electronics G.728 CELP";
1357 case 0x0042:
return "Microsoft MSG723";
1358 case 0x0050:
return "MPEG";
1359 case 0x0052:
return "Voxware RT24";
1360 case 0x0053:
return "InSoft PAC";
1361 case 0x0055:
return "MPEG Layer 3";
1362 case 0x0057:
return "AMR NB";
1363 case 0x0058:
return "AMR WB";
1364 case 0x0059:
return "Lucent G.723";
1365 case 0x0060:
return "Cirrus";
1366 case 0x0061:
return "ESPCM";
1367 case 0x0062:
return "Voxware";
1368 case 0x0063:
return "Canopus Atrac";
1369 case 0x0064:
return "APICOM G.726 ADPCM";
1370 case 0x0065:
return "APICOM G.722 ADPCM";
1371 case 0x0066:
return "Microsoft DSAT";
1372 case 0x0067:
return "Microsoft DSAT Display";
1373 case 0x0069:
return "Voxware Byte Aligned";
1374 case 0x0070:
return "Voxware AC8";
1375 case 0x0071:
return "Voxware AC10";
1376 case 0x0072:
return "Voxware AC16";
1377 case 0x0073:
return "Voxware AC20";
1378 case 0x0074:
return "Voxware Metavoice";
1379 case 0x0075:
return "Voxware Metasound";
1380 case 0x0076:
return "Voxware RT29HW";
1381 case 0x0077:
return "Voxware VR12";
1382 case 0x0078:
return "Voxware VR18";
1383 case 0x0079:
return "Voxware TQ40";
1384 case 0x0080:
return "Softsound";
1385 case 0x0081:
return "Voxware TQ60";
1386 case 0x0082:
return "MSRT24";
1387 case 0x0083:
return "AT&T G.729A";
1388 case 0x0084:
return "Motion Pixels MVI MV12";
1389 case 0x0085:
return "DF G.726";
1390 case 0x0086:
return "DF GSM610";
1391 case 0x0088:
return "ISIAudio";
1392 case 0x0089:
return "Onlive";
1393 case 0x0091:
return "Siemens SBC24";
1394 case 0x0092:
return "Dolby AC3 SPDIF";
1395 case 0x0093:
return "Mediasonic G723";
1396 case 0x0094:
return "Prosody 8KBPS";
1397 case 0x0097:
return "ZyXEL ADPCM";
1398 case 0x0098:
return "Philips LPCBB";
1399 case 0x0099:
return "Packed";
1400 case 0x00A0:
return "Malden PhonyTalk";
1401 case 0x00FF:
return "AAC";
1402 case 0x0100:
return "Rhetorex ADPCM";
1403 case 0x0101:
return "IBM MULAW";
1404 case 0x0102:
return "IBM ALAW";
1405 case 0x0103:
return "IBM ADPCM";
1406 case 0x0111:
return "Vivo G.723";
1407 case 0x0112:
return "Vivo Siren";
1408 case 0x0123:
return "DEC G.723";
1409 case 0x0125:
return "Sanyo LD ADPCM";
1410 case 0x0130:
return "Siprolab ACEPLNET";
1411 case 0x0131:
return "Siprolab ACELP4800";
1412 case 0x0132:
return "Siprolab ACELP8V3";
1413 case 0x0133:
return "Siprolab G729";
1414 case 0x0134:
return "Siprolab G729A";
1415 case 0x0135:
return "Siprolab Kelvin";
1416 case 0x0140:
return "G726 ADPCM";
1417 case 0x0150:
return "Qualcomm Purevoice";
1418 case 0x0151:
return "Qualcomm Halfrate";
1419 case 0x0155:
return "Tub GSM";
1420 case 0x0160:
return "WMAV1";
1421 case 0x0161:
return "WMAV2";
1422 case 0x0162:
return "WMAV3";
1423 case 0x0163:
return "WMAV3 L";
1424 case 0x0200:
return "Creative ADPCM";
1425 case 0x0202:
return "Creative FastSpeech8";
1426 case 0x0203:
return "Creative FastSpeech10";
1427 case 0x0210:
return "UHER ADPCM";
1428 case 0x0220:
return "Quarterdeck";
1429 case 0x0230:
return "iLink VC";
1430 case 0x0240:
return "Raw Sport";
1431 case 0x0250:
return "IPI HSX";
1432 case 0x0251:
return "IPI RPELP";
1433 case 0x0260:
return "CS2";
1434 case 0x0270:
return "Sony ATRAC3";
1435 case 0x028E:
return "Siren";
1436 case 0x0300:
return "Fujitsu FM Towns Snd";
1437 case 0x0400:
return "BTV Digital";
1438 case 0x0401:
return "IMC";
1439 case 0x0450:
return "QDesign Music";
1440 case 0x0680:
return "AT&T VME VMPCM";
1441 case 0x0681:
return "TCP";
1442 case 0x1000:
return "Olivetti OLIGSM";
1443 case 0x1001:
return "Olivetti OLIADPCM";
1444 case 0x1002:
return "Olivetti OLICELP";
1445 case 0x1003:
return "Olivetti OLISBC";
1446 case 0x1004:
return "Olivetti OLIOPR";
1447 case 0x1100:
return "LH Codec";
1448 case 0x1400:
return "Norris";
1449 case 0x1401:
return "AT&T ISIAudio";
1450 case 0x1500:
return "AT&T Soundspace Music Compression";
1451 case 0x2000:
return "DVM";
1452 case 0x2001:
return "DTS";
1453 case 0x2048:
return "Sonic";
1454 case 0x4143:
return "AAC AC";
1455 case 0x674f:
return "Vorbis 1";
1456 case 0x6750:
return "Vorbis 2";
1457 case 0x6751:
return "Vorbis 3";
1458 case 0x676f:
return "Vorbis 1+";
1459 case 0x6770:
return "Vorbis 2+";
1460 case 0x6771:
return "Vorbis 3+";
1461 case 0x706d:
return "AAC PM";
1462 case 0x7A21:
return "GSM AMR CBR";
1463 case 0x7A22:
return "GSM AMR VBR";
1464 case 0xF1AC:
return "FLAC";
1465 case 0xFFFE:
return "WAVE_FORMAT_EXTENSIBLE";
1466 case 0xFFFF:
return "Experimental";
1479 b_vector.push_back(&lhs);
1532 ID3v1Tag(
const std::string & filename,
boolean show_warnings)
1540 if(filename.size() > 0)
1542 this->
read(filename,show_warnings);
1550 #define NOT_FOUND -1
1557 uint32 header_limit = 72 ;
1560 size_t data_length = 0;
1567 fseek(fin, 0, SEEK_SET);
1575 M_THROW(
"ID3v1Tag::find(): could not read 'RIFF' from file");
1589 M_THROW(
"ID3v1Tag::find(): could not read 'WAVE' from file");
1596 while(count < header_limit)
1609 if(count >= header_limit)
1611 cerr <<
"*** Error --> ID3v1Tag::find(): did not find the 'data'"
1616 size_t cur_pos = ftell(fin);
1617 fseek(fin, 0, SEEK_END);
1618 size_t end_pos = ftell(fin);
1621 #ifdef NSOUND_PLATFORM_OS_WINDOWS
1622 fseek(fin, static_cast<long>(cur_pos), SEEK_SET);
1623 fseek(fin, static_cast<long>(data_length), SEEK_CUR);
1625 fseek(fin, cur_pos, SEEK_SET);
1626 fseek(fin, data_length, SEEK_CUR);
1630 cur_pos = ftell(fin);
1631 while(cur_pos < end_pos-2)
1635 if(3 != fread(t, 1, 3, fin))
1637 M_THROW(
"ID3v1Tag::find(): IO error reading file");
1641 if(t[0] ==
'T' && t[1] ==
'A' && t[2] ==
'G')
1646 cur_pos = ftell(fin);
1650 if(cur_pos >= end_pos)
1656 fseek(fin, -3, SEEK_CUR);
1663 read(
const std::string & filename,
boolean show_warnings)
1665 FILE * fin = fopen(filename.c_str(),
"rb");
1669 M_THROW(
"ID3v1Tag::read(): could not open the file '"
1680 M_THROW(
"ID3v1Tag::read(): ID3v1Tag::find() failed!");
1684 if(tag_pos ==
NOT_FOUND && show_warnings)
1687 cerr <<
"*** Warning --> ID3v1Tag::read(): could not find the ID3v1 'TAG'"
1693 #ifdef NSOUND_PLATFORM_OS_WINDOWS
1694 fseek(fin, static_cast<long>(tag_pos), SEEK_SET);
1696 fseek(fin, tag_pos, SEEK_SET);
1701 memset(reinterpret_cast<char *>(&tag), 0,
sizeof(
RawTag));
1707 cerr <<
"*** Error --> ID3v1Tag::read(): failed to read the ID3v1 TAG!"
1714 this->
title.clear();
1716 this->
album.clear();
1722 for(
uint32 i = 0; i < 30; ++i)
1729 for(
uint32 i = 0; i < 30; ++i)
1736 for(
uint32 i = 0; i < 30; ++i)
1743 for(
uint32 i = 0; i < 4; ++i)
1750 for(
uint32 i = 0; i < 30; ++i)
1764 write(
const std::string & filename,
boolean show_warnings)
1766 FILE * fin = fopen(filename.c_str(),
"r+b");
1770 M_THROW(
"ID3v1Tag::write(): could not open the file '"
1780 M_THROW(
"ID3v1Tag::write(): ID3v1Tag::find() failed!"
1789 fseek(fin, 0, SEEK_END);
1795 #ifdef NSOUND_PLATFORM_OS_WINDOWS
1796 fseek(fin, static_cast<long>(tag_pos), SEEK_SET);
1798 fseek(fin, tag_pos, SEEK_SET);
1804 memset(reinterpret_cast<char *>(&tag), 0,
sizeof(
RawTag));
1810 #define MIN(a,b) ((a < b) ? a : b)
1849 M_THROW(
"ID3v1Tag::write(): failed to write the ID3v1Tag!");
1862 out <<
"header : TAG" << endl
1863 <<
"title : " << rhs.
title << endl
1864 <<
"artist : " << rhs.
artist << endl
1865 <<
"album : " << rhs.
album << endl
1866 <<
"year : " << rhs.
year << endl
1867 <<
"comment : " << rhs.
comment << endl
1868 <<
"genre : " << rhs.
genre;
static boolean read(const std::string &fileName, AudioStream &astream)
static const raw_float64 SIGNED_48_BIT_
static int64 readInt(FILE *fd, uint32 n_bytes)
static const raw_float64 SIGNED_24_BIT_
#define M_ASSERT_VALUE(a, op, value)
static const uint32 RIFF_
std::ostream & operator<<(std::ostream &out, const Buffer &rhs_buffer)
static boolean readHeader(const std::string &filename, std::string &info)
Reads the basic header information and sets the info string.
static void writeFloat64(FILE *output, float64 value)
float64 getSampleRate() const
Returns the sample rate of the stream.
static int64 swapBytesInt48(const uint64 &i)
uint32 getLength() const
Returns the number of samples of audio data in the stream.
static const raw_float64 SIGNED_16_BIT_
static const uint16 WAVE_FORMAT_PCM_
std::vector< Buffer * > BufferPointerVector
static uint16 default_wave_format_
static const raw_float64 SIGNED_32_BIT_
uint32 getLength() const
Returns the number of samples in the Buffer.
static boolean write(const std::string &fileName, const AudioStream &as, uint32 bits_per_sample=16)
static uint32 default_sample_size_
void setNChannels(uint32 channels)
static const uint32 PEAK_
static std::string decodeFormatTag(const uint16 format_tag)
uint32 getNChannels(void) const
Returns the number of audio channels in the stream.
void operator>>(const AudioStream &lhs, AudioPlayback &rhs)
boolean write(const std::string &filename, boolean show_warnings=true)
Returns true if it successfully wrote the tag to the end of the file, false otherwise.
static float64 readFloat64(FILE *fd)
std::vector< Buffer > BufferVector
static const uint32 FACT_
static void writeInt(FILE *output, uint32 n_bytes, int64 value)
static int64 swapBytesInt64(const uint64 &i)
Endian Conversion.
static void setDefaults(const float64 &sample_rate=44100.0, const float64 &sample_bits=16.0, const boolean &use_ieee_floats=false)
static int32 swapBytesInt32(const uint32 i)
unsigned long long uint64
static void writeFloat32(FILE *output, float32 value)
static uint32 getDefaultSampleRate()
static void setIEEEFloat(boolean flag)
static int32 swapBytesInt16(const uint32 i)
static const raw_float64 SIGNED_8_BIT_
static const raw_float64 SIGNED_64_BIT_
A Buffer for storing audio samples.
static const uint32 DATA_
static uint32 default_sample_rate_
int64 findID3v1Tag(FILE *fin)
ID3v1Tag(const std::string &filename="", boolean show_warnings=true)
static void setDefaultSampleRate(const int32 rate)
static void setDefaultSampleSize(uint32 size)
boolean read(const std::string &filename, boolean show_warnings=true)
Returns true if it found the tag, false otherwise.
static uint32 getDefaultSampleSize()
static const uint16 WAVE_FORMAT_IEEE_FLOAT_
void setSampleRate(uint32 sample_rate)
static float32 readFloat32(FILE *fd)
static const uint32 WAVE_
static int32 swapBytesInt24(const uint32 i)