/[svn]/libgig/trunk/src/RIFF.cpp
ViewVC logotype

Diff of /libgig/trunk/src/RIFF.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3047 by schoenebeck, Wed May 18 18:04:49 2016 UTC revision 3048 by schoenebeck, Fri Nov 25 18:34:45 2016 UTC
# Line 313  namespace RIFF { Line 313  namespace RIFF {
313       *  @param WordCount  number of data words to read       *  @param WordCount  number of data words to read
314       *  @param WordSize   size of each data word to read       *  @param WordSize   size of each data word to read
315       *  @returns          number of successfully read data words or 0 if end       *  @returns          number of successfully read data words or 0 if end
316       *                    of file reached or error occured       *                    of file reached or error occurred
317       */       */
318      file_offset_t Chunk::Read(void* pData, file_offset_t WordCount, file_offset_t WordSize) {      file_offset_t Chunk::Read(void* pData, file_offset_t WordCount, file_offset_t WordSize) {
319          #if DEBUG          #if DEBUG
# Line 382  namespace RIFF { Line 382  namespace RIFF {
382       *  @param WordSize   size of each data word to write       *  @param WordSize   size of each data word to write
383       *  @returns          number of successfully written data words       *  @returns          number of successfully written data words
384       *  @throws RIFF::Exception  if write operation would exceed current       *  @throws RIFF::Exception  if write operation would exceed current
385       *                           chunk size or any IO error occured       *                           chunk size or any IO error occurred
386       *  @see Resize()       *  @see Resize()
387       */       */
388      file_offset_t Chunk::Write(void* pData, file_offset_t WordCount, file_offset_t WordSize) {      file_offset_t Chunk::Write(void* pData, file_offset_t WordCount, file_offset_t WordSize) {
# Line 455  namespace RIFF { Line 455  namespace RIFF {
455       * @param pData             destination buffer       * @param pData             destination buffer
456       * @param WordCount         number of 8 Bit signed integers to read       * @param WordCount         number of 8 Bit signed integers to read
457       * @returns                 number of read integers       * @returns                 number of read integers
458       * @throws RIFF::Exception  if an error occured or less than       * @throws RIFF::Exception  if an error occurred or less than
459       *                          \a WordCount integers could be read!       *                          \a WordCount integers could be read!
460       */       */
461      file_offset_t Chunk::ReadInt8(int8_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::ReadInt8(int8_t* pData, file_offset_t WordCount) {
# Line 476  namespace RIFF { Line 476  namespace RIFF {
476       * @param pData             source buffer (containing the data)       * @param pData             source buffer (containing the data)
477       * @param WordCount         number of 8 Bit signed integers to write       * @param WordCount         number of 8 Bit signed integers to write
478       * @returns                 number of written integers       * @returns                 number of written integers
479       * @throws RIFF::Exception  if an IO error occured       * @throws RIFF::Exception  if an IO error occurred
480       * @see Resize()       * @see Resize()
481       */       */
482      file_offset_t Chunk::WriteInt8(int8_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::WriteInt8(int8_t* pData, file_offset_t WordCount) {
# Line 492  namespace RIFF { Line 492  namespace RIFF {
492       * @param pData             destination buffer       * @param pData             destination buffer
493       * @param WordCount         number of 8 Bit unsigned integers to read       * @param WordCount         number of 8 Bit unsigned integers to read
494       * @returns                 number of read integers       * @returns                 number of read integers
495       * @throws RIFF::Exception  if an error occured or less than       * @throws RIFF::Exception  if an error occurred or less than
496       *                          \a WordCount integers could be read!       *                          \a WordCount integers could be read!
497       */       */
498      file_offset_t Chunk::ReadUint8(uint8_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::ReadUint8(uint8_t* pData, file_offset_t WordCount) {
# Line 513  namespace RIFF { Line 513  namespace RIFF {
513       * @param pData             source buffer (containing the data)       * @param pData             source buffer (containing the data)
514       * @param WordCount         number of 8 Bit unsigned integers to write       * @param WordCount         number of 8 Bit unsigned integers to write
515       * @returns                 number of written integers       * @returns                 number of written integers
516       * @throws RIFF::Exception  if an IO error occured       * @throws RIFF::Exception  if an IO error occurred
517       * @see Resize()       * @see Resize()
518       */       */
519      file_offset_t Chunk::WriteUint8(uint8_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::WriteUint8(uint8_t* pData, file_offset_t WordCount) {
# Line 529  namespace RIFF { Line 529  namespace RIFF {
529       * @param pData             destination buffer       * @param pData             destination buffer
530       * @param WordCount         number of 16 Bit signed integers to read       * @param WordCount         number of 16 Bit signed integers to read
531       * @returns                 number of read integers       * @returns                 number of read integers
532       * @throws RIFF::Exception  if an error occured or less than       * @throws RIFF::Exception  if an error occurred or less than
533       *                          \a WordCount integers could be read!       *                          \a WordCount integers could be read!
534       */       */
535      file_offset_t Chunk::ReadInt16(int16_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::ReadInt16(int16_t* pData, file_offset_t WordCount) {
# Line 550  namespace RIFF { Line 550  namespace RIFF {
550       * @param pData             source buffer (containing the data)       * @param pData             source buffer (containing the data)
551       * @param WordCount         number of 16 Bit signed integers to write       * @param WordCount         number of 16 Bit signed integers to write
552       * @returns                 number of written integers       * @returns                 number of written integers
553       * @throws RIFF::Exception  if an IO error occured       * @throws RIFF::Exception  if an IO error occurred
554       * @see Resize()       * @see Resize()
555       */       */
556      file_offset_t Chunk::WriteInt16(int16_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::WriteInt16(int16_t* pData, file_offset_t WordCount) {
# Line 566  namespace RIFF { Line 566  namespace RIFF {
566       * @param pData             destination buffer       * @param pData             destination buffer
567       * @param WordCount         number of 8 Bit unsigned integers to read       * @param WordCount         number of 8 Bit unsigned integers to read
568       * @returns                 number of read integers       * @returns                 number of read integers
569       * @throws RIFF::Exception  if an error occured or less than       * @throws RIFF::Exception  if an error occurred or less than
570       *                          \a WordCount integers could be read!       *                          \a WordCount integers could be read!
571       */       */
572      file_offset_t Chunk::ReadUint16(uint16_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::ReadUint16(uint16_t* pData, file_offset_t WordCount) {
# Line 587  namespace RIFF { Line 587  namespace RIFF {
587       * @param pData             source buffer (containing the data)       * @param pData             source buffer (containing the data)
588       * @param WordCount         number of 16 Bit unsigned integers to write       * @param WordCount         number of 16 Bit unsigned integers to write
589       * @returns                 number of written integers       * @returns                 number of written integers
590       * @throws RIFF::Exception  if an IO error occured       * @throws RIFF::Exception  if an IO error occurred
591       * @see Resize()       * @see Resize()
592       */       */
593      file_offset_t Chunk::WriteUint16(uint16_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::WriteUint16(uint16_t* pData, file_offset_t WordCount) {
# Line 603  namespace RIFF { Line 603  namespace RIFF {
603       * @param pData             destination buffer       * @param pData             destination buffer
604       * @param WordCount         number of 32 Bit signed integers to read       * @param WordCount         number of 32 Bit signed integers to read
605       * @returns                 number of read integers       * @returns                 number of read integers
606       * @throws RIFF::Exception  if an error occured or less than       * @throws RIFF::Exception  if an error occurred or less than
607       *                          \a WordCount integers could be read!       *                          \a WordCount integers could be read!
608       */       */
609      file_offset_t Chunk::ReadInt32(int32_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::ReadInt32(int32_t* pData, file_offset_t WordCount) {
# Line 624  namespace RIFF { Line 624  namespace RIFF {
624       * @param pData             source buffer (containing the data)       * @param pData             source buffer (containing the data)
625       * @param WordCount         number of 32 Bit signed integers to write       * @param WordCount         number of 32 Bit signed integers to write
626       * @returns                 number of written integers       * @returns                 number of written integers
627       * @throws RIFF::Exception  if an IO error occured       * @throws RIFF::Exception  if an IO error occurred
628       * @see Resize()       * @see Resize()
629       */       */
630      file_offset_t Chunk::WriteInt32(int32_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::WriteInt32(int32_t* pData, file_offset_t WordCount) {
# Line 640  namespace RIFF { Line 640  namespace RIFF {
640       * @param pData             destination buffer       * @param pData             destination buffer
641       * @param WordCount         number of 32 Bit unsigned integers to read       * @param WordCount         number of 32 Bit unsigned integers to read
642       * @returns                 number of read integers       * @returns                 number of read integers
643       * @throws RIFF::Exception  if an error occured or less than       * @throws RIFF::Exception  if an error occurred or less than
644       *                          \a WordCount integers could be read!       *                          \a WordCount integers could be read!
645       */       */
646      file_offset_t Chunk::ReadUint32(uint32_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::ReadUint32(uint32_t* pData, file_offset_t WordCount) {
# Line 657  namespace RIFF { Line 657  namespace RIFF {
657       *       *
658       * @param s                 destination string       * @param s                 destination string
659       * @param size              number of characters to read       * @param size              number of characters to read
660       * @throws RIFF::Exception  if an error occured or less than       * @throws RIFF::Exception  if an error occurred or less than
661       *                          \a size characters could be read!       *                          \a size characters could be read!
662       */       */
663      void Chunk::ReadString(String& s, int size) {      void Chunk::ReadString(String& s, int size) {
# Line 678  namespace RIFF { Line 678  namespace RIFF {
678       * @param pData             source buffer (containing the data)       * @param pData             source buffer (containing the data)
679       * @param WordCount         number of 32 Bit unsigned integers to write       * @param WordCount         number of 32 Bit unsigned integers to write
680       * @returns                 number of written integers       * @returns                 number of written integers
681       * @throws RIFF::Exception  if an IO error occured       * @throws RIFF::Exception  if an IO error occurred
682       * @see Resize()       * @see Resize()
683       */       */
684      file_offset_t Chunk::WriteUint32(uint32_t* pData, file_offset_t WordCount) {      file_offset_t Chunk::WriteUint32(uint32_t* pData, file_offset_t WordCount) {
# Line 690  namespace RIFF { Line 690  namespace RIFF {
690       * the chunk.       * the chunk.
691       *       *
692       * @returns                 read integer word       * @returns                 read integer word
693       * @throws RIFF::Exception  if an error occured       * @throws RIFF::Exception  if an error occurred
694       */       */
695      int8_t Chunk::ReadInt8() {      int8_t Chunk::ReadInt8() {
696          #if DEBUG          #if DEBUG
# Line 706  namespace RIFF { Line 706  namespace RIFF {
706       * within the chunk.       * within the chunk.
707       *       *
708       * @returns                 read integer word       * @returns                 read integer word
709       * @throws RIFF::Exception  if an error occured       * @throws RIFF::Exception  if an error occurred
710       */       */
711      uint8_t Chunk::ReadUint8() {      uint8_t Chunk::ReadUint8() {
712          #if DEBUG          #if DEBUG
# Line 723  namespace RIFF { Line 723  namespace RIFF {
723       * needed.       * needed.
724       *       *
725       * @returns                 read integer word       * @returns                 read integer word
726       * @throws RIFF::Exception  if an error occured       * @throws RIFF::Exception  if an error occurred
727       */       */
728      int16_t Chunk::ReadInt16() {      int16_t Chunk::ReadInt16() {
729          #if DEBUG          #if DEBUG
# Line 740  namespace RIFF { Line 740  namespace RIFF {
740       * needed.       * needed.
741       *       *
742       * @returns                 read integer word       * @returns                 read integer word
743       * @throws RIFF::Exception  if an error occured       * @throws RIFF::Exception  if an error occurred
744       */       */
745      uint16_t Chunk::ReadUint16() {      uint16_t Chunk::ReadUint16() {
746          #if DEBUG          #if DEBUG
# Line 757  namespace RIFF { Line 757  namespace RIFF {
757       * needed.       * needed.
758       *       *
759       * @returns                 read integer word       * @returns                 read integer word
760       * @throws RIFF::Exception  if an error occured       * @throws RIFF::Exception  if an error occurred
761       */       */
762      int32_t Chunk::ReadInt32() {      int32_t Chunk::ReadInt32() {
763          #if DEBUG          #if DEBUG
# Line 774  namespace RIFF { Line 774  namespace RIFF {
774       * needed.       * needed.
775       *       *
776       * @returns                 read integer word       * @returns                 read integer word
777       * @throws RIFF::Exception  if an error occured       * @throws RIFF::Exception  if an error occurred
778       */       */
779      uint32_t Chunk::ReadUint32() {      uint32_t Chunk::ReadUint32() {
780          #if DEBUG          #if DEBUG
# Line 1576  namespace RIFF { Line 1576  namespace RIFF {
1576       * Loads an existing RIFF file with all its chunks.       * Loads an existing RIFF file with all its chunks.
1577       *       *
1578       * @param path - path and file name of the RIFF file to open       * @param path - path and file name of the RIFF file to open
1579       * @throws RIFF::Exception if error occured while trying to load the       * @throws RIFF::Exception if error occurred while trying to load the
1580       *                         given RIFF file       *                         given RIFF file
1581       */       */
1582      File::File(const String& path)      File::File(const String& path)
# Line 1623  namespace RIFF { Line 1623  namespace RIFF {
1623       * @param Endian - whether the file uses little endian or big endian layout       * @param Endian - whether the file uses little endian or big endian layout
1624       * @param layout - general file structure type       * @param layout - general file structure type
1625       * @param fileOffsetSize - (optional) preference how to deal with large files       * @param fileOffsetSize - (optional) preference how to deal with large files
1626       * @throws RIFF::Exception if error occured while trying to load the       * @throws RIFF::Exception if error occurred while trying to load the
1627       *                         given RIFF-alike file       *                         given RIFF-alike file
1628       */       */
1629      File::File(const String& path, uint32_t FileType, endian_t Endian, layout_t layout, offset_size_t fileOffsetSize)      File::File(const String& path, uint32_t FileType, endian_t Endian, layout_t layout, offset_size_t fileOffsetSize)
# Line 1650  namespace RIFF { Line 1650  namespace RIFF {
1650       * @param path - path and file name of the RIFF file or RIFF-alike file to       * @param path - path and file name of the RIFF file or RIFF-alike file to
1651       *               be opened       *               be opened
1652       * @param FileType - (optional) expected chunk ID of first chunk in file       * @param FileType - (optional) expected chunk ID of first chunk in file
1653       * @throws RIFF::Exception if error occured while trying to load the       * @throws RIFF::Exception if error occurred while trying to load the
1654       *                         given RIFF file or RIFF-alike file       *                         given RIFF file or RIFF-alike file
1655       */       */
1656      void File::__openExistingFile(const String& path, uint32_t* FileType) {      void File::__openExistingFile(const String& path, uint32_t* FileType) {
# Line 1854  namespace RIFF { Line 1854  namespace RIFF {
1854       *       *
1855       * @param pProgress - optional: callback function for progress notification       * @param pProgress - optional: callback function for progress notification
1856       * @throws RIFF::Exception if there is an empty chunk or empty list       * @throws RIFF::Exception if there is an empty chunk or empty list
1857       *                         chunk or any kind of IO error occured       *                         chunk or any kind of IO error occurred
1858       */       */
1859      void File::Save(progress_t* pProgress) {      void File::Save(progress_t* pProgress) {
1860          //TODO: implementation for the case where first chunk is not a global container (List chunk) is not implemented yet (i.e. Korg files)          //TODO: implementation for the case where first chunk is not a global container (List chunk) is not implemented yet (i.e. Korg files)

Legend:
Removed from v.3047  
changed lines
  Added in v.3048

  ViewVC Help
Powered by ViewVC