--- libgig/trunk/src/DLS.h 2013/01/07 23:23:58 2394 +++ libgig/trunk/src/DLS.h 2014/05/10 02:06:58 2543 @@ -2,7 +2,7 @@ * * * libgig - C++ cross-platform Gigasampler format file access library * * * - * Copyright (C) 2003-2013 by Christian Schoenebeck * + * Copyright (C) 2003-2014 by Christian Schoenebeck * * * * * * This library is free software; you can redistribute it and/or modify * @@ -204,6 +204,16 @@ struct range_t { uint16_t low; ///< Low value of range. uint16_t high; ///< High value of range. + + inline bool operator< (const range_t& other) const { + if (low < other.low) return true; + if (low > other.low) return false; + return high < other.high; + } + + inline bool operator== (const range_t& other) const { + return low == other.low && high == other.high; + } }; /** Defines Sample Loop Points. */ @@ -328,6 +338,7 @@ dlsid_t* pDLSID; ///< Points to a dlsid_t structure if the file provided a DLS ID else is NULL. Resource* GetParent() { return pParent; } + const Resource* GetParent() const { return pParent; } virtual void UpdateChunks(); void GenerateDLSID(); virtual void CopyAssign(const Resource* orig); @@ -384,12 +395,13 @@ void* LoadSampleData(); void ReleaseSampleData(); - unsigned long GetSize(); + unsigned long GetSize() const; void Resize(int iNewSize); unsigned long SetPos(unsigned long SampleCount, RIFF::stream_whence_t Whence = RIFF::stream_start); unsigned long Read(void* pBuffer, unsigned long SampleCount); unsigned long Write(void* pBuffer, unsigned long SampleCount); virtual void UpdateChunks(); + virtual void CopyAssign(const Sample* orig); protected: RIFF::List* pWaveList; RIFF::Chunk* pCkData; @@ -398,6 +410,7 @@ Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset); virtual ~Sample(); + void CopyAssignCore(const Sample* orig); friend class File; friend class Region; // Region has to compare the wave pool offset to get its sample }; @@ -478,6 +491,7 @@ File(); File(RIFF::File* pRIFF); String GetFileName(); + void SetFileName(const String& name); Sample* GetFirstSample(); ///< Returns a pointer to the first Sample object of the file, NULL otherwise. Sample* GetNextSample(); ///< Returns a pointer to the next Sample object of the file, NULL otherwise. Sample* AddSample();