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

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

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

revision 2542 by schoenebeck, Mon Nov 25 02:22:38 2013 UTC revision 2543 by schoenebeck, Sat May 10 02:06:58 2014 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file access library    *   *   libgig - C++ cross-platform Gigasampler format file access library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003-2013 by Christian Schoenebeck                      *   *   Copyright (C) 2003-2014 by Christian Schoenebeck                      *
6   *                              <cuse@users.sourceforge.net>               *   *                              <cuse@users.sourceforge.net>               *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
# Line 169  namespace RIFF { Line 169  namespace RIFF {
169          endian_native = 2          endian_native = 2
170      } endian_t;      } endian_t;
171    
172        /** General chunk structure of a file. */
173        enum layout_t {
174            layout_standard = 0, ///< Standard RIFF file layout: First chunk in file is a List chunk which contains all other chunks and there are no chunks outside the scope of that very first (List) chunk.
175            layout_flat     = 1  ///< Not a "real" RIFF file: First chunk in file is an ordinary data chunk, not a List chunk, and there might be other chunks after that first chunk.
176        };
177    
178      /** @brief Ordinary RIFF Chunk      /** @brief Ordinary RIFF Chunk
179       *       *
180       * Provides convenient methods to access data of ordinary RIFF chunks       * Provides convenient methods to access data of ordinary RIFF chunks
# Line 179  namespace RIFF { Line 185  namespace RIFF {
185              Chunk(File* pFile, unsigned long StartPos, List* Parent);              Chunk(File* pFile, unsigned long StartPos, List* Parent);
186              String         GetChunkIDString();              String         GetChunkIDString();
187              uint32_t       GetChunkID() { return ChunkID; }             ///< Chunk ID in unsigned integer representation.              uint32_t       GetChunkID() { return ChunkID; }             ///< Chunk ID in unsigned integer representation.
188                File*          GetFile()    { return pFile;   }             ///< Returns pointer to the chunk's File object.
189              List*          GetParent()  { return pParent; }             ///< Returns pointer to the chunk's parent list chunk.              List*          GetParent()  { return pParent; }             ///< Returns pointer to the chunk's parent list chunk.
190              unsigned long  GetSize() const { return CurrentChunkSize; } ///< Chunk size in bytes (without header, thus the chunk data body)              unsigned long  GetSize() const { return CurrentChunkSize; } ///< Chunk size in bytes (without header, thus the chunk data body)
191              unsigned long  GetNewSize() { return NewChunkSize;     }    ///< New chunk size if it was modified with Resize().              unsigned long  GetNewSize() { return NewChunkSize;     }    ///< New chunk size if it was modified with Resize().
# Line 321  namespace RIFF { Line 328  namespace RIFF {
328          public:          public:
329              File(uint32_t FileType);              File(uint32_t FileType);
330              File(const String& path);              File(const String& path);
331                File(const String& path, uint32_t FileType, endian_t Endian, layout_t layout);
332              stream_mode_t GetMode();              stream_mode_t GetMode();
333              bool          SetMode(stream_mode_t NewMode);              bool          SetMode(stream_mode_t NewMode);
334              void SetByteOrder(endian_t Endian);              void SetByteOrder(endian_t Endian);
335              String GetFileName();              String GetFileName();
336              void SetFileName(const String& path);              void SetFileName(const String& path);
337              bool IsNew() const;              bool IsNew() const;
338                layout_t GetLayout() const;
339              virtual void Save();              virtual void Save();
340              virtual void Save(const String& path);              virtual void Save(const String& path);
341              virtual ~File();              virtual ~File();
# Line 344  namespace RIFF { Line 353  namespace RIFF {
353              String Filename;              String Filename;
354              bool   bEndianNative;              bool   bEndianNative;
355              bool   bIsNewFile;              bool   bIsNewFile;
356                layout_t Layout; ///< An ordinary RIFF file is always set to layout_standard.
357    
358              void LogAsResized(Chunk* pResizedChunk);              void LogAsResized(Chunk* pResizedChunk);
359              void UnlogResized(Chunk* pResizedChunk);              void UnlogResized(Chunk* pResizedChunk);
# Line 353  namespace RIFF { Line 363  namespace RIFF {
363              stream_mode_t  Mode;              stream_mode_t  Mode;
364              ChunkList ResizedChunks; ///< All chunks which have been resized (enlarged / shortened).              ChunkList ResizedChunks; ///< All chunks which have been resized (enlarged / shortened).
365    
366                void __openExistingFile(const String& path, uint32_t* FileType = NULL);
367              unsigned long GetFileSize();              unsigned long GetFileSize();
368              void ResizeFile(unsigned long ulNewSize);              void ResizeFile(unsigned long ulNewSize);
369              #if POSIX              #if POSIX

Legend:
Removed from v.2542  
changed lines
  Added in v.2543

  ViewVC Help
Powered by ViewVC