[Demudi-commits] r1470 - in libgig/trunk/debian: . patches

free-guest at alioth.debian.org free-guest at alioth.debian.org
Tue Jun 12 10:38:50 UTC 2007


Author: free-guest
Date: 2007-06-12 10:38:50 +0000 (Tue, 12 Jun 2007)
New Revision: 1470

Modified:
   libgig/trunk/debian/changelog
   libgig/trunk/debian/control
   libgig/trunk/debian/patches/00list
   libgig/trunk/debian/patches/10_cvs-snapshot.dpatch
   libgig/trunk/debian/rules
Log:
* Non-Maintainer upload
* New upstream release (Closes: #381628)
* Included upstream changelog
* Removed non debian/ files from diff.gz
* Move libgig3c2 to libgig6 to reflect the so name change
* Added makefile rule to package cvs snapshots
* Support passing DEB_BUILD_OPTIONS=athopt to for Athlon optimization
* New release.

Modified: libgig/trunk/debian/changelog
===================================================================
--- libgig/trunk/debian/changelog	2007-06-12 10:20:19 UTC (rev 1469)
+++ libgig/trunk/debian/changelog	2007-06-12 10:38:50 UTC (rev 1470)
@@ -1,37 +1,22 @@
-libgig (3.1.1-1) UNRELEASED; urgency=low
+libgig (3.1.1-0.1) unstable; urgency=low
 
-  * New upstream release
+  [ Free Ekanayaka ]
+  * Non-Maintainer upload
+  * New upstream release (Closes: #381628)
+  * Included upstream changelog
+  * Removed non debian/ files from diff.gz
+  * Move libgig3c2 to libgig6 to reflect the so name change
+  * Added makefile rule to package cvs snapshots
+  * Support passing DEB_BUILD_OPTIONS=athopt to for Athlon optimization
 
- -- Free Ekanayaka <freee at debian.org>  Wed,  4 Apr 2007 11:23:45 +0000
-
-libgig (3.1.0-2) UNRELEASED; urgency=low
-
-  * Compile with Athlon optimization
-
- -- Free Ekanayaka <freee at debian.org>  Fri, 16 Feb 2007 12:35:10 +0000
-
-libgig (3.1.0-1) UNRELEASED; urgency=low
-
   [ Christian Schoenebeck ]
   * libgig's home has changed slightly from
     http://stud.fh-heilbronn.de/~cschoene/projects/libgig/ to
     http://stud.hs-heilbronn.de/~cschoene/projects/libgig/
   * include NEWS file on installation
-  * new release
 
-  [ Free Ekanayaka ]
-  * Move libgig3c2 to libgig6 to reflect the so name change
-  * Added myself to Uploaders
-  * Added makefile rule to package cvs snapshots
-
  -- Free Ekanayaka <freee at debian.org>  Sat, 13 Jan 2007 00:49:40 +0100
 
-libgig (3.0.0-1) unstable; urgency=low
-
-  * New release.
-
- -- Christian Schoenebeck <cuse at users.sourceforge.net>  Fri, 28 Apr 2006 19:22:24 +0200
-
 libgig (2.0.d2-2) unstable; urgency=low
 
   * Cxx transistion (closes: #339205)
@@ -53,12 +38,6 @@
 
  -- Christian Schoenebeck <cuse at users.sourceforge.net>  Mon, 15 Aug 2005 19:19:57 +0200
 
-libgig (2.0.1-1) unstable; urgency=low
-
-  * New release.
-
- -- Christian Schoenebeck <cuse at users.sourceforge.net>  Sun, 12 Jun 2005 14:55:17 +0200
-
 libgig (2.0.cvs20050613+1-1) unstable; urgency=low
 
   * New upstream release (2.0.1)
@@ -71,6 +50,12 @@
 
  -- Paul Brossier <piem at debian.org>  Sun, 31 Jul 2005 00:19:09 +0100
 
+libgig (2.0.1-1) unstable; urgency=low
+
+  * New release.
+
+ -- Christian Schoenebeck <cuse at users.sourceforge.net>  Sun, 12 Jun 2005 14:55:17 +0200
+
 libgig (2.0.cvs20050523-1) unstable; urgency=low
 
   * fixed debian description (Closes: #310221)

Modified: libgig/trunk/debian/control
===================================================================
--- libgig/trunk/debian/control	2007-06-12 10:20:19 UTC (rev 1469)
+++ libgig/trunk/debian/control	2007-06-12 10:38:50 UTC (rev 1470)
@@ -2,7 +2,7 @@
 Section: devel
 Priority: optional
 Maintainer: Matt Flax <flatmax at pgb.unsw.edu.au>
-Uploaders: Paul Brossier <piem at debian.org>, Free Ekanayaka <freee at debian.org>
+Uploaders: Paul Brossier <piem at debian.org>
 Build-Depends: debhelper (>= 4.0.0), dpatch, pkg-config, libsndfile1-dev, doxygen, libtool, automake1.9
 Standards-Version: 3.7.2
 

Modified: libgig/trunk/debian/patches/00list
===================================================================
--- libgig/trunk/debian/patches/00list	2007-06-12 10:20:19 UTC (rev 1469)
+++ libgig/trunk/debian/patches/00list	2007-06-12 10:38:50 UTC (rev 1470)
@@ -1 +1 @@
-00_cvs-makefile
\ No newline at end of file
+00_cvs-makefile

Modified: libgig/trunk/debian/patches/10_cvs-snapshot.dpatch
===================================================================
--- libgig/trunk/debian/patches/10_cvs-snapshot.dpatch	2007-06-12 10:20:19 UTC (rev 1469)
+++ libgig/trunk/debian/patches/10_cvs-snapshot.dpatch	2007-06-12 10:38:50 UTC (rev 1470)
@@ -23,7 +23,2576 @@
 exit 0
 
 @DPATCH@
-Index: libgig/debian/changelog
-diff -u libgig/debian/changelog:1.11 libgig/debian/changelog:1.12
-Index: libgig/debian/rules
-diff -u libgig/debian/rules:1.5 libgig/debian/rules:1.6
+Index: libgig/ChangeLog
+diff -u libgig/ChangeLog:1.71 libgig/ChangeLog:1.85
+--- libgig/ChangeLog:1.71	Sat Mar 24 11:55:05 2007
++++ libgig/ChangeLog	Fri Jun  1 19:19:28 2007
+@@ -1,3 +1,48 @@
++Version CVS HEAD (?)
++
++  * packaging changes:
++    - added Mac OSX XCode project files (patch by Toshi Nagata)
++    - Dev-C++ (win32) project file is automatically updated with
++      the version info from configure.in
++
++  * src/DLS.cpp, src/DLS.h:
++    - added Sampler::AddSampleLoop() and Sampler::DeleteSampleLoop() methods
++    - fixed write support for big-endian systems
++    - improved handling of fixed length info strings - separate default
++      lengths can be specified for each INFO chunk
++    - added Resource::GenerateDLSID function
++
++  * src/gig.cpp, src/gig.h:
++    - fixed segmentation fault in the gig::File destructor sequence which
++      happened when gig::Group informations were accessed before
++    - fixed write support for big-endian systems
++    - defined lengths of a fixed set of info strings. These strings
++      are saved when the file is written, even if they are empty.
++    - added missing parameter initalizations in sample, region and
++      instrument constructors
++    - clear unused fields when saving samples and regions
++    - fixed write support bugs: v3 dimension limits and chunksize
++      weren't saved, leverage controller of type controlchange
++      couldn't be saved, group name list chunk was placed wrong,
++      dimension region chunks also placed wrong
++    - added initialization of some fixed info strings in file and
++      instrument
++    - write support: files created by libgig will now have the RIFF
++      chunks in correct order
++    - write support: two previously unknown fields in dimension
++      definition are now saved
++    - added constants for gig file versions
++    - write support: the 3crc and einf chunks are now created or
++      updated when a file is saved (3crc contains sample checksums,
++      einf contains file statistics)
++    - write support: DLSID is now generated on the file and the
++      instruments
++    - write support: improved the default values for dimension region
++      parameters
++
++  * src/RIFF.cpp, src/RIFF.h:
++    - added File::SetByteOrder method
++
+ Version 3.1.1 (24 Mar 2007)
+ 
+   * packaging changes:
+Index: libgig/Makefile.am
+diff -u libgig/Makefile.am:1.11 libgig/Makefile.am:1.12
+--- libgig/Makefile.am:1.11	Sat Mar 24 18:20:09 2007
++++ libgig/Makefile.am	Sun May  6 16:21:41 2007
+@@ -1,7 +1,7 @@
+ # require automake >= 1.5 (mandatory for option dist-bzip2)
+ AUTOMAKE_OPTIONS = 1.5 dist-bzip2
+ 
+-SUBDIRS = doc man src debian win32
++SUBDIRS = doc man src debian win32 osx
+ 
+ # to prevent compile errors on some systems
+ AM_CXXFLAGS = -pedantic
+Index: libgig/configure.in
+diff -u libgig/configure.in:1.23 libgig/configure.in:1.26
+--- libgig/configure.in:1.23	Sat Mar 24 18:20:09 2007
++++ libgig/configure.in	Sun May 27 13:54:23 2007
+@@ -38,6 +38,9 @@
+ 
+ AC_SUBST(SHLIB_VERSION_ARG)
+ AC_SUBST(SHARED_VERSION_INFO)
++AC_SUBST(LIBGIG_RELEASE_MAJOR)
++AC_SUBST(LIBGIG_RELEASE_MINOR)
++AC_SUBST(LIBGIG_RELEASE_BUILD)
+ 
+ have_audio_file_lib="false"
+ 
+@@ -66,7 +69,36 @@
+     exit -1;
+ fi
+ 
++AC_CHECK_HEADERS(uuid/uuid.h)
++AC_SEARCH_LIBS(uuid_generate, uuid)
++AC_CHECK_FUNCS(uuid_generate CFUUIDCreate)
++
++if test "$ac_cv_func_uuid_generate" = no -a "$ac_cv_func_CFUUIDCreate" = no; then
++   AC_MSG_WARN([No UUID generate function found.
++*** libgig will not be able to create DLSIDs in DLS and gig files.
++*** Install libuuid from e2fsprogs to solve this. Package might be called
++*** uuid-dev, libext2fs2-devel or e2fsprogs-devel.])
++fi
++
+ AM_CONFIG_HEADER(config.h)
+ AM_INIT_AUTOMAKE(libgig, "$LIBGIG_RELEASE_MAJOR.$LIBGIG_RELEASE_MINOR.$LIBGIG_RELEASE_BUILD")
+ 
+-AC_OUTPUT(Makefile doc/Makefile man/Makefile src/Makefile libgig.spec gig.pc Doxyfile man/dlsdump.1 man/gigdump.1 man/gigextract.1 man/rifftree.1 debian/Makefile src/testcases/Makefile win32/Makefile)
++AC_OUTPUT( \
++    Doxyfile \
++    gig.pc \
++    libgig.spec \
++    Makefile \
++    src/Makefile \
++    src/testcases/Makefile \
++    doc/Makefile \
++    man/Makefile \
++    man/dlsdump.1 \
++    man/gigdump.1 \
++    man/gigextract.1 \
++    man/rifftree.1 \
++    debian/Makefile \
++    osx/Makefile \
++    osx/libgig.xcodeproj/Makefile \
++    win32/Makefile \
++    win32/libgig.dev \
++)
+Index: libgig/osx/Makefile.am
+diff -u /dev/null libgig/osx/Makefile.am:1.1
+--- /dev/null	Mon Jun 11 06:25:49 2007
++++ libgig/osx/Makefile.am	Sun May  6 16:17:48 2007
+@@ -0,0 +1,3 @@
++SUBDIRS = libgig.xcodeproj
++
++EXTRA_DIST = autoconf_builder.sh wrapper.sh README.osx
+Index: libgig/osx/README.osx
+diff -u /dev/null libgig/osx/README.osx:1.2
+--- /dev/null	Mon Jun 11 06:25:49 2007
++++ libgig/osx/README.osx	Wed May 16 20:38:55 2007
+@@ -0,0 +1,107 @@
++Compiling libgig for Mac OS X with XCode
++========================================
++
++Requirements
++------------
++
++  The XCode project uses autotools build files. On Mac OS 10.4, you need
++  to install pkg-config (available at http://pkgconfig.freedesktop.org/wiki/).
++  
++  If you are to build the CVS snapshot, then you need to do the following
++  steps to make autotools work correctly:
++  
++  $ sudo ln -sf /usr/bin/glibtoolize /usr/local/bin/libtoolize
++  $ sudo cat >/usr/local/bin/aclocal <<'EOF'
++  #!/bin/sh
++  /usr/bin/aclocal -I /usr/local/share/aclocal $@
++  EOF
++  $ sudo chmod +x /usr/local/bin/aclocal
++  
++Layout of the Directories
++-------------------------
++
++  The XCode project for libgig creates a temporary build directory as
++  "$LIBGIG/../temp_build/$BUILD_STYLE" (where $LIBGIG is the libgig 
++  directory, and $BUILD_STYLE is the build style defined in the XCode 
++  project). In this directory, the following subdirectories are created 
++  and used:
++    $BASEGIG.build:
++      Intermediate build directory. Symbolic links to the original 
++      source files are placed and "configure && make" is performed in 
++      this directory. ($BASEGIG is the basename of the libgig directory.)
++    local:
++      The products are "installed" in this directory. libgig.a is in
++      local/lib, and gigdump, gigextract, dlsdump, rifftree are in
++      local/bin.
++  Such a layout allows you to build binaries of different architectures
++  (and build options) independently. On the other hand, you will need to
++  link libgig.a statically because you cannot expect other users to place
++  libgig.a at the same path. The XCode project takes care of this by
++  giving "--disable-shared" to configure.
++  
++  Also note that this temporary directory is outside the libgig directory
++  and will be shared with the Xcode projects for other linuxsampler 
++  subproducts. So it is best to create a common directory for all 
++  linuxsampler subproducts and place the libgig directory (and the
++  directories of other linuxsampler subproducts) in it.
++
++Universal Binaries
++------------------
++
++  You can create the Universal Binaries by selecting "Deployment_UB" build
++  style and build. The binaries for i386 and ppc architectures are built
++  separately and then automatically combined. The products are found in
++  $LIBGIG/../temp_build/Deployment_UB/local/{bin,lib}.
++  
++  You can also create the binaries for i386 and ppc architectures
++  separately by selecting "Deployment_i386" and "Deployment_ppc" built
++  styles respectively. This may be more convenient when you make your
++  binary exclusively for your own use, and/or the required libraries
++  (e.g. libsndfile, see below) are available only for a single
++  architecture.
++
++  Note that the current XCode project does _not_ take care of libgig.la
++  and pkgconfig/gig.pc when creating the Universal Binary.
++  
++  The libgig project is dependent on libsndfile, but you may not 
++  have a Universal Binary version of libsndfile. Don't worry, you 
++  can still create UB of libgig products. Follow these steps:
++  
++  - Get the sources of libsndfile and extract in $LIBGIG/..
++  - cd to $LIBGIG/../libsndfile-*
++  - env BUILD_STYLE=Deployment_ppc \
++    WITH_INSTALL=1 \
++    CONFIG_OPTIONS="--disable-shared" \
++    BUILD_BASE_DIR="$PWD/../temp_build" \
++    SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk" \
++    /bin/sh $LIBGIG/osx/autoconf_builder.sh 
++  - env BUILD_STYLE=Deployment_i386 \
++    WITH_INSTALL=1 \
++    CONFIG_OPTIONS="--disable-shared" \
++    BUILD_BASE_DIR="$PWD/../temp_build" \
++    SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk" \
++    /bin/sh $LIBGIG/osx/autoconf_builder.sh 
++
++  After these steps, the i386 and ppc versions of libsndfile.a are
++  created in $LIBGIG/../temp_build/Deployment_$ARCH/local/lib 
++  ($ARCH is either i386 or ppc). Now you can double-click on 
++  libgig.xcodeproj and build libgig with Deployment_UB build style.
++  When XCode is building libgig for each architecture, pkg-config 
++  will find the correct version of libsndfile.a in $LIBGIG/../
++  temp_build/Deployment_{ppc,i386}/local/lib.
++
++  (You can also easily create a Universal Binary of libsndfile.a,
++  but then you need to take care manually of the contents of 
++  libsndfile.la and pkgconfig/sndfile.pc.)
++
++Additional Information
++----------------------
++
++  The XCode project just invokes autoconf_builder.sh after
++  setting relevant environmental variables. If you are interested
++  (or feel suspicious), please examine autoconf_builder.sh.
++
++
++6 May 2007: First written by Toshi Nagata
++9 May 2007: Updated to account for the Deployment_UB target
++
+Index: libgig/osx/autoconf_builder.sh
+diff -u /dev/null libgig/osx/autoconf_builder.sh:1.2
+--- /dev/null	Mon Jun 11 06:25:49 2007
++++ libgig/osx/autoconf_builder.sh	Wed May 16 20:38:55 2007
+@@ -0,0 +1,227 @@
++#!/bin/sh
++# autoconf_builder.sh
++# Created by Toshi Nagata on 07/04/18.
++#
++# Copyright 2007 Toshi Nagata.
++#
++# Redistribution and use in source and binary forms, with or without modification, are permitted 
++# provided that the following conditions are met:
++#
++#   1. Redistributions of source code must retain the above copyright notice, this list of 
++# conditions and the following disclaimer.
++#   2. Redistributions in binary form must reproduce the above copyright notice, this list of 
++# conditions and the following disclaimer in the documentation and/or other materials provided 
++# with the distribution.
++#
++# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 
++# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 
++# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
++# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
++# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
++# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
++# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++#
++#  Influential environmental variables:
++#  ACTION(*): autoconf - run "make -f Makefile.cvs"; configure - run "configure";
++#		make - run "make"; install - run "make install";
++#		build (or empty string) - autoconf && configure && make (&& install)
++#		"install" step is only done if WITH_INSTALL is non-empty
++#  BUILD_STYLE(*): The build style. If it ends with "ppc" or "i386", it also specifies the architecture.
++#		If it ends with "UB" or "Universal", it creates the Universal Binaries for the products
++#		specified by $UB_PRODUCTS (see below).
++#		If any of the products are missing, then this script is recursively called for 
++#		$BUILD_STYLE's that have "ppc" and "i386" in place of "UB" or "Universal".
++#  WITH_INSTALL: When non-empty, "install" action is automatically done in "build" action.
++#  CFLAGS, CXXFLAGS: Compiler flags
++#  CONFIG_OPTIONS: Options for "configure"
++#  BUILD_BASE_DIR: Temporary building and install directory. By default "$PWD/build". The source
++#		tree is duplicated (by use of symbolic links) in $BUILD_BASE_DIR/$BUILD_STYLE/<basename>.build,
++#		where <basename> is the basename of the toplevel directory of the source tree (which also
++#		should be the current directory when this script is invoked). The product is "installed"
++#		into $BUILD_BASE_DIR/$BUILD_STYLE/local.
++#  SDKROOT: The root directory for SDK
++#  UB_PRODUCTS: The products for which Universal Binaries are to be created. The paths should be
++#		relative to $BUILD_BASE_DIR/$BUILD_STYLE/local. Eg. bin/some_executable, lib/some_library.a.
++#
++#  The variables marked with (*) are automatically set by Xcode.
++
++BASE_DIR=$PWD
++BASE_NAME=`basename $PWD`
++
++function rel2abs () {
++	(cd "$1"; pwd)
++}
++
++function abs2rel () {
++	/usr/bin/perl -e 'use File::Spec; print File::Spec->abs2rel($ARGV[0], $ARGV[1]), "\n";' "$1" "$2"
++}
++
++function link_recursive () {
++	local arg base i
++	arg="$1"
++	base=`basename "$arg"`
++	if test -d "$arg"; then
++		if expr "$base" = "CVS" "|" `rel2abs "$arg"` = "$BUILD_BASE_DIR" >/dev/null; then
++			echo "Skipping directory $arg"
++		else
++			echo "Copying directory $arg"
++			mkdir -p "$base"
++			cd "$base"
++			if ! expr "$arg" : "^/" >/dev/null; then
++				arg="../$arg"
++			fi
++			for i in "$arg"/*; do
++				link_recursive "$i"
++			done
++			cd ..
++		fi
++	else
++		echo "Linking $arg"
++		ln -sf $arg
++	fi
++}
++
++#  Sanity checks
++if test "x$BUILD_STYLE" = "x"; then
++	BUILD_STYLE="Default"
++fi
++if test "x$ACTION" = "x"; then
++	ACTION="build"
++fi
++if test "x$BUILD_BASE_DIR" = "x"; then
++	BUILD_BASE_DIR=$PWD/build
++fi
++mkdir -p "$BUILD_BASE_DIR" || exit $?
++BUILD_BASE_DIR=`rel2abs "$BUILD_BASE_DIR"`
++
++if test -e "$SDKROOT"; then
++	SYSROOT_CFLAGS="-isysroot $SDKROOT"
++else
++	SYSROOT_CFLAGS=
++fi
++PATH="/usr/local/bin:$PATH"
++
++
++ARCH_CFLAGS=""
++ARCH_CONFIG_OPTIONS=""
++case "$BUILD_STYLE" in
++    *ppc)
++	ARCH="ppc"
++	ARCH_CFLAGS="-arch ppc"
++	;;
++    *i386)
++	ARCH="i386"
++	ARCH_CFLAGS="-arch i386 -msse -msse2"
++	ARCH_CONFIG_OPTIONS="--host=i386-apple-darwin8"
++	;;
++	*UB)
++	ARCH="UB"
++	BUILD_STYLE_BASE=${BUILD_STYLE/UB/}
++	;;
++    *Universal)
++	ARCH="UB"	
++	BUILD_STYLE_BASE=${BUILD_STYLE/Universal/}
++	;;
++    *)
++	echo "Warning: architecture cannot be recognized from the build style"
++	ARCH="unknown"
++	;;
++esac
++
++case "$BUILD_STYLE" in
++    Development|Default)
++	OPT_CFLAGS="-O2 -g"
++	;;
++    Deployment*)
++	OPT_CFLAGS="-O3"
++	;;
++esac
++
++export CFLAGS="$SYSROOT_CFLAGS $ARCH_CFLAGS $OPT_CFLAGS $CFLAGS"
++export CXXFLAGS="$SYSROOT_CFLAGS $ARCH_CFLAGS $OPT_CFLAGS $CXXFLAGS"
++
++if test "x$ARCH" = "xUB" -a "x$ACTION" != "xclean"; then
++	#  Test the existence of the products
++	BUILD_STYLE_PPC=${BUILD_STYLE_BASE}ppc
++	BUILD_STYLE_386=${BUILD_STYLE_BASE}i386
++	for style in $BUILD_STYLE_PPC $BUILD_STYLE_386; do
++		missing=no
++		for i in $UB_PRODUCTS; do
++			if ! test -e "$BUILD_BASE_DIR/$style/local/$i"; then
++				missing=yes
++			fi
++		done
++		if test "$missing" = "yes"; then
++			BUILD_STYLE_SAVE=$BUILD_STYLE
++			export BUILD_STYLE=$style
++			echo "Building with BUILD_STYLE=$style"
++			/bin/sh $0 || exit $?
++			BUILD_STYLE=$BUILD_STYLE_SAVE
++		fi
++	done
++	mkdir -p "$BUILD_BASE_DIR/$BUILD_STYLE/local" || exit $?
++	cd "$BUILD_BASE_DIR"
++	for i in $UB_PRODUCTS; do
++		mkdir -p "$BUILD_STYLE/local/"`dirname $i` || exit $?
++		echo "Creating universal binary $BUILD_STYLE/local/$i"
++		lipo -create "$BUILD_STYLE_PPC/local/$i" "$BUILD_STYLE_386/local/$i" -output "$BUILD_STYLE/local/$i" || exit $?
++	done
++	exit $?
++fi
++
++#  Move to the working directory
++BUILD_DIR="$BUILD_BASE_DIR/$BUILD_STYLE/$BASE_NAME.build"
++mkdir -p "$BUILD_DIR"
++BUILD_DIR=`rel2abs "$BUILD_DIR"`
++CONFIG_OPTIONS="--prefix=$BUILD_BASE_DIR/$BUILD_STYLE/local $CONFIG_OPTIONS"
++
++#  Display all environments
++set
++
++cd $BUILD_DIR
++
++#  Clean if specified
++if test "x$ACTION" = "xclean"; then
++	# if test "x$WITH_INSTALL" != "x" -a -e "Makefile"; then
++	#	echo "Doing make uninstall"
++	#	make uninstall
++	# fi
++    echo "Removing files in $BUILD_DIR"
++	cd $BASE_DIR
++    rm -rf "$BUILD_DIR"
++    exit $?
++fi
++
++if test "x$ACTION" = "xbuild" -o "x$ACTION" = "xconfigure"; then
++	#  Copy the source files if necessary
++	if test ! -e Makefile -a ! -e configure -a ! -e Makefile.cvs; then
++		echo "Copying the source files to $BUILD_DIR"
++		for i in `abs2rel "$BASE_DIR" "$BUILD_DIR"`/*; do
++			link_recursive $i
++		done
++	fi
++	#  Make ./configure if necessary
++	if test -e Makefile.cvs -a ! -e configure; then
++		echo "Running make -f Makefile.cvs"
++		make -f Makefile.cvs || exit $?
++	fi
++	#  Run ./configure if necessary
++	if test -e configure -a ! -e Makefile; then
++		CONFIG_ARGS="$CONFIG_OPTIONS $ARCH_CONFIG_OPTIONS $CONFIG_ENVS"
++		echo "Running configure $CONFIG_ARGS"
++		./configure $CONFIG_ARGS || exit $?
++	fi
++fi
++
++if test "x$ACTION" = "xbuild" -o "x$ACTION" = "xmake"; then
++	#  make
++	echo "Running make"
++	make || exit $?
++fi
++
++#  make install if specified
++if test "x$ACTION" = "xinstall" -o "(" "x$ACTION" = "xbuild" -a "x$WITH_INSTALL" != "x" ")"; then
++    echo "Running make install"
++    make install || exit $?
++fi
+Index: libgig/osx/wrapper.sh
+diff -u /dev/null libgig/osx/wrapper.sh:1.2
+--- /dev/null	Mon Jun 11 06:25:49 2007
++++ libgig/osx/wrapper.sh	Wed May 16 20:38:55 2007
+@@ -0,0 +1,6 @@
++export BUILD_BASE_DIR=$PWD/../temp_build
++export WITH_INSTALL=1
++export CONFIG_OPTIONS="--disable-shared"
++export PKG_CONFIG_PATH="$BUILD_BASE_DIR/$BUILD_STYLE/local/lib/pkgconfig"
++export UB_PRODUCTS="bin/dlsdump bin/gigextract bin/rifftree bin/gigdump lib/libgig.a"
++source $PROJECT_DIR/autoconf_builder.sh
+Index: libgig/osx/libgig.xcodeproj/Makefile.am
+diff -u /dev/null libgig/osx/libgig.xcodeproj/Makefile.am:1.1
+--- /dev/null	Mon Jun 11 06:25:49 2007
++++ libgig/osx/libgig.xcodeproj/Makefile.am	Sun May  6 16:17:48 2007
+@@ -0,0 +1 @@
++EXTRA_DIST = project.pbxproj
+Index: libgig/osx/libgig.xcodeproj/project.pbxproj
+diff -u /dev/null libgig/osx/libgig.xcodeproj/project.pbxproj:1.2
+--- /dev/null	Mon Jun 11 06:25:49 2007
++++ libgig/osx/libgig.xcodeproj/project.pbxproj	Wed May 16 20:38:55 2007
+@@ -0,0 +1,214 @@
++// !$*UTF8*$!
++{
++	archiveVersion = 1;
++	classes = {
++	};
++	objectVersion = 42;
++	objects = {
++
++/* Begin PBXFileReference section */
++		E4019E270BED928D0094EB0E /* autoconf_builder.sh */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = text.script.sh; path = autoconf_builder.sh; sourceTree = "<group>"; };
++		E4019E280BED928D0094EB0E /* wrapper.sh */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = text.script.sh; path = wrapper.sh; sourceTree = "<group>"; };
++		E4102CA20BCBE537006B57FE /* DLS.cpp */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.cpp.cpp; path = DLS.cpp; sourceTree = "<group>"; };
++		E4102CA30BCBE537006B57FE /* DLS.h */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.c.h; path = DLS.h; sourceTree = "<group>"; };
++		E4102CA40BCBE537006B57FE /* dlsdump.cpp */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.cpp.cpp; path = dlsdump.cpp; sourceTree = "<group>"; };
++		E4102CA50BCBE537006B57FE /* gig.cpp */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.cpp.cpp; path = gig.cpp; sourceTree = "<group>"; };
++		E4102CA60BCBE537006B57FE /* gig.h */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.c.h; path = gig.h; sourceTree = "<group>"; };
++		E4102CA70BCBE537006B57FE /* gigdump.cpp */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.cpp.cpp; path = gigdump.cpp; sourceTree = "<group>"; };
++		E4102CA80BCBE537006B57FE /* gigextract.cpp */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.cpp.cpp; path = gigextract.cpp; sourceTree = "<group>"; };
++		E4102CA90BCBE537006B57FE /* helper.h */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.c.h; path = helper.h; sourceTree = "<group>"; };
++		E4102CAD0BCBE537006B57FE /* RIFF.cpp */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.cpp.cpp; path = RIFF.cpp; sourceTree = "<group>"; };
++		E4102CAE0BCBE537006B57FE /* RIFF.h */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.c.h; path = RIFF.h; sourceTree = "<group>"; };
++		E4102CAF0BCBE537006B57FE /* rifftree.cpp */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.cpp.cpp; path = rifftree.cpp; sourceTree = "<group>"; };
++		E4102CB40BCBE537006B57FE /* GigWriteTest.cpp */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.cpp.cpp; path = GigWriteTest.cpp; sourceTree = "<group>"; };
++		E4102CB50BCBE537006B57FE /* GigWriteTest.h */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.c.h; path = GigWriteTest.h; sourceTree = "<group>"; };
++		E4102CB60BCBE537006B57FE /* main.cpp */ = {isa = PBXFileReference; fileEncoding = "-2147483647"; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
++/* End PBXFileReference section */
++
++/* Begin PBXGroup section */
++		08FB7794FE84155DC02AAC07 /* LinuxSampler */ = {
++			isa = PBXGroup;
++			children = (
++				E4019E270BED928D0094EB0E /* autoconf_builder.sh */,
++				E4019E280BED928D0094EB0E /* wrapper.sh */,
++				E4102C990BCBE536006B57FE /* src */,
++			);
++			name = LinuxSampler;
++			sourceTree = "<group>";
++		};
++		E4102C990BCBE536006B57FE /* src */ = {
++			isa = PBXGroup;
++			children = (
++				E4102CA20BCBE537006B57FE /* DLS.cpp */,
++				E4102CA30BCBE537006B57FE /* DLS.h */,
++				E4102CA40BCBE537006B57FE /* dlsdump.cpp */,
++				E4102CA50BCBE537006B57FE /* gig.cpp */,
++				E4102CA60BCBE537006B57FE /* gig.h */,
++				E4102CA70BCBE537006B57FE /* gigdump.cpp */,
++				E4102CA80BCBE537006B57FE /* gigextract.cpp */,
++				E4102CA90BCBE537006B57FE /* helper.h */,
++				E4102CAD0BCBE537006B57FE /* RIFF.cpp */,
++				E4102CAE0BCBE537006B57FE /* RIFF.h */,
++				E4102CAF0BCBE537006B57FE /* rifftree.cpp */,
++				E4102CB00BCBE537006B57FE /* testcases */,
++			);
++			name = src;
++			path = ../src;
++			sourceTree = "<group>";
++		};
++		E4102CB00BCBE537006B57FE /* testcases */ = {
++			isa = PBXGroup;
++			children = (
++				E4102CB40BCBE537006B57FE /* GigWriteTest.cpp */,
++				E4102CB50BCBE537006B57FE /* GigWriteTest.h */,
++				E4102CB60BCBE537006B57FE /* main.cpp */,
++			);
++			path = testcases;
++			sourceTree = "<group>";
++		};
++/* End PBXGroup section */
++
++/* Begin PBXLegacyTarget section */
++		E4102B730BCBD832006B57FE /* libgig */ = {
++			isa = PBXLegacyTarget;
++			buildArgumentsString = "$(PROJECT_DIR)/wrapper.sh";
++			buildConfigurationList = E4102B740BCBD85E006B57FE /* Build configuration list for PBXLegacyTarget "libgig" */;
++			buildPhases = (
++			);
++			buildToolPath = /bin/sh;
++			buildWorkingDirectory = ..;
++			dependencies = (
++			);
++			name = libgig;
++			passBuildSettingsInEnvironment = 1;
++			productName = libgig;
++		};
++/* End PBXLegacyTarget section */
++
++/* Begin PBXProject section */
++		08FB7793FE84155DC02AAC07 /* Project object */ = {
++			isa = PBXProject;
++			buildConfigurationList = 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "libgig" */;
++			hasScannedForEncodings = 1;
++			mainGroup = 08FB7794FE84155DC02AAC07 /* LinuxSampler */;
++			projectDirPath = "";
++			targets = (
++				E4102B730BCBD832006B57FE /* libgig */,
++			);
++		};
++/* End PBXProject section */
++
++/* Begin XCBuildConfiguration section */
++		1DEB919408733D9F0010E9CD /* Development */ = {
++			isa = XCBuildConfiguration;
++			buildSettings = {
++				GCC_WARN_ABOUT_RETURN_TYPE = YES;
++				GCC_WARN_UNUSED_VARIABLE = YES;
++				PREBINDING = NO;
++				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
++			};
++			name = Development;
++		};
++		E4102B750BCBD85E006B57FE /* Development */ = {
++			isa = XCBuildConfiguration;
++			buildSettings = {
++				COPY_PHASE_STRIP = NO;
++				GCC_DYNAMIC_NO_PIC = NO;
++				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
++				GCC_OPTIMIZATION_LEVEL = 0;
++				PRODUCT_NAME = libgig;
++			};
++			name = Development;
++		};
++		E4102B770BCBD8A9006B57FE /* Deployment_ppc */ = {
++			isa = XCBuildConfiguration;
++			buildSettings = {
++				COPY_PHASE_STRIP = NO;
++				GCC_DYNAMIC_NO_PIC = NO;
++				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
++				GCC_OPTIMIZATION_LEVEL = 0;
++				PRODUCT_NAME = libgig;
++			};
++			name = Deployment_ppc;
++		};
++		E4102B780BCBD8A9006B57FE /* Deployment_i386 */ = {
++			isa = XCBuildConfiguration;
++			buildSettings = {
++				COPY_PHASE_STRIP = NO;
++				GCC_DYNAMIC_NO_PIC = NO;
++				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
++				GCC_OPTIMIZATION_LEVEL = 0;
++				PRODUCT_NAME = libgig;
++			};
++			name = Deployment_i386;
++		};
++		E4102B7B0BCBD8A9006B57FE /* Deployment_ppc */ = {
++			isa = XCBuildConfiguration;
++			buildSettings = {
++				GCC_WARN_ABOUT_RETURN_TYPE = YES;
++				GCC_WARN_UNUSED_VARIABLE = YES;
++				PREBINDING = NO;
++				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
++			};
++			name = Deployment_ppc;
++		};
++		E4102B7C0BCBD8A9006B57FE /* Deployment_i386 */ = {
++			isa = XCBuildConfiguration;
++			buildSettings = {
++				GCC_WARN_ABOUT_RETURN_TYPE = YES;
++				GCC_WARN_UNUSED_VARIABLE = YES;
++				PREBINDING = NO;
++				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
++			};
++			name = Deployment_i386;
++		};
++		E48A31250BEE218F009CAD72 /* Deployment_UB */ = {
++			isa = XCBuildConfiguration;
++			buildSettings = {
++				COPY_PHASE_STRIP = NO;
++				GCC_DYNAMIC_NO_PIC = NO;
++				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
++				GCC_OPTIMIZATION_LEVEL = 0;
++				PRODUCT_NAME = libgig;
++			};
++			name = Deployment_UB;
++		};
++		E48A31260BEE218F009CAD72 /* Deployment_UB */ = {
++			isa = XCBuildConfiguration;
++			buildSettings = {
++				GCC_WARN_ABOUT_RETURN_TYPE = YES;
++				GCC_WARN_UNUSED_VARIABLE = YES;
++				PREBINDING = NO;
++				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
++			};
++			name = Deployment_UB;
++		};
++/* End XCBuildConfiguration section */
++
++/* Begin XCConfigurationList section */
++		1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "libgig" */ = {
++			isa = XCConfigurationList;
++			buildConfigurations = (
++				1DEB919408733D9F0010E9CD /* Development */,
++				E4102B7B0BCBD8A9006B57FE /* Deployment_ppc */,
++				E4102B7C0BCBD8A9006B57FE /* Deployment_i386 */,
++				E48A31260BEE218F009CAD72 /* Deployment_UB */,
++			);
++			defaultConfigurationIsVisible = 0;
++			defaultConfigurationName = Development;
++		};
++		E4102B740BCBD85E006B57FE /* Build configuration list for PBXLegacyTarget "libgig" */ = {
++			isa = XCConfigurationList;
++			buildConfigurations = (
++				E4102B750BCBD85E006B57FE /* Development */,
++				E4102B770BCBD8A9006B57FE /* Deployment_ppc */,
++				E4102B780BCBD8A9006B57FE /* Deployment_i386 */,
++				E48A31250BEE218F009CAD72 /* Deployment_UB */,
++			);
++			defaultConfigurationIsVisible = 0;
++			defaultConfigurationName = Development;
++		};
++/* End XCConfigurationList section */
++	};
++	rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
++}
+Index: libgig/src/DLS.cpp
+diff -u libgig/src/DLS.cpp:1.24 libgig/src/DLS.cpp:1.33
+--- libgig/src/DLS.cpp:1.24	Sun Mar 18 19:38:47 2007
++++ libgig/src/DLS.cpp	Fri Jun  1 19:19:28 2007
+@@ -25,6 +25,12 @@
+ 
+ #include <time.h>
+ 
++#ifdef __APPLE__
++#include <CoreFoundation/CFUUID.h>
++#elif defined(HAVE_UUID_UUID_H)
++#include <uuid/uuid.h>
++#endif
++
+ #include "helper.h"
+ 
+ // macros to decode connection transforms
+@@ -142,15 +148,15 @@
+         const int iEntrySize = 12; // 12 bytes per connection block
+         pArticulationCk->Resize(HeaderSize + Connections * iEntrySize);
+         uint8_t* pData = (uint8_t*) pArticulationCk->LoadChunkData();
+-        memcpy(&pData[0], &HeaderSize, 2);
+-        memcpy(&pData[2], &Connections, 2);
++        store16(&pData[0], HeaderSize);
++        store16(&pData[2], Connections);
+         for (uint32_t i = 0; i < Connections; i++) {
+             Connection::conn_block_t c = pConnections[i].ToConnBlock();
+-            memcpy(&pData[HeaderSize + i * iEntrySize],     &c.source, 2);
+-            memcpy(&pData[HeaderSize + i * iEntrySize + 2], &c.control, 2);
+-            memcpy(&pData[HeaderSize + i * iEntrySize + 4], &c.destination, 2);
+-            memcpy(&pData[HeaderSize + i * iEntrySize + 6], &c.transform, 2);
+-            memcpy(&pData[HeaderSize + i * iEntrySize + 8], &c.scale, 4);
++            store16(&pData[HeaderSize + i * iEntrySize],     c.source);
++            store16(&pData[HeaderSize + i * iEntrySize + 2], c.control);
++            store16(&pData[HeaderSize + i * iEntrySize + 4], c.destination);
++            store16(&pData[HeaderSize + i * iEntrySize + 6], c.transform);
++            store32(&pData[HeaderSize + i * iEntrySize + 8], c.scale);
+         }
+     }
+ 
+@@ -233,7 +239,7 @@
+      * @param list - pointer to a list chunk which contains an INFO list chunk
+      */
+     Info::Info(RIFF::List* list) {
+-        UseFixedLengthStrings = false;
++        FixedStringLengths = NULL;
+         pResourceListChunk = list;
+         if (list) {
+             RIFF::List* lstINFO = list->GetSubList(LIST_TYPE_INFO);
+@@ -286,12 +292,19 @@
+      * @param lstINFO  - parent (INFO) RIFF list chunk
+      * @param s        - current value of info field
+      * @param sDefault - default value
+-     * @param bUseFixedLengthStrings - should a specific string size be forced in the chunk?
+-     * @param size     - wanted size of the INFO chunk. This is ignored if bUseFixedLengthStrings is false.
+      */
+-    void Info::SaveString(uint32_t ChunkID, RIFF::List* lstINFO, const String& s, const String& sDefault, bool bUseFixedLengthStrings, int size) {
++    void Info::SaveString(uint32_t ChunkID, RIFF::List* lstINFO, const String& s, const String& sDefault) {
++        int size = 0;
++        if (FixedStringLengths) {
++            for (int i = 0 ; FixedStringLengths[i].length ; i++) {
++                if (FixedStringLengths[i].chunkId == ChunkID) {
++                    size = FixedStringLengths[i].length;
++                    break;
++                }
++            }
++        }
+         RIFF::Chunk* ck = lstINFO->GetSubChunk(ChunkID);
+-        ::SaveString(ChunkID, ck, lstINFO, s, sDefault, bUseFixedLengthStrings, size); // function from helper.h
++        ::SaveString(ChunkID, ck, lstINFO, s, sDefault, size != 0, size); // function from helper.h
+     }
+ 
+     /** @brief Update chunks with current info values.
+@@ -336,28 +349,23 @@
+ 
+         // save values
+ 
+-        // (the string size values are for gig files; they are only
+-        // used if UseFixedLengthStrings is set to true)
+-        SaveString(CHUNK_ID_INAM, lstINFO, Name, defaultName, UseFixedLengthStrings,
+-                   resourceType == RIFF_TYPE_DLS ? 128 : 64);
+-        SaveString(CHUNK_ID_IARL, lstINFO, ArchivalLocation, String(""), UseFixedLengthStrings, 256);
+-        SaveString(CHUNK_ID_ICRD, lstINFO, CreationDate, defaultCreationDate, UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_ICMT, lstINFO, Comments, defaultComments, UseFixedLengthStrings, 1024);
+-        SaveString(CHUNK_ID_IPRD, lstINFO, Product, String(""), UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_ICOP, lstINFO, Copyright, String(""), UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_IART, lstINFO, Artists, String(""), UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_IGNR, lstINFO, Genre, String(""), UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_IKEY, lstINFO, Keywords, String(""), UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_IENG, lstINFO, Engineer, String(""), UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_ITCH, lstINFO, Technician, String(""), UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_ISFT, lstINFO, Software, defaultSoftware, UseFixedLengthStrings,
+-                   resourceType == LIST_TYPE_INS ?
+-                   (Software == "" ? defaultSoftware.length()+1 : Software.length()+1) : 128);
+-        SaveString(CHUNK_ID_IMED, lstINFO, Medium, String(""), UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_ISRC, lstINFO, Source, String(""), UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_ISRF, lstINFO, SourceForm, String(""), UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_ICMS, lstINFO, Commissioned, String(""), UseFixedLengthStrings, 128);
+-        SaveString(CHUNK_ID_ISBJ, lstINFO, Subject, String(""), UseFixedLengthStrings, 128);
++        SaveString(CHUNK_ID_IARL, lstINFO, ArchivalLocation, String(""));
++        SaveString(CHUNK_ID_IART, lstINFO, Artists, String(""));
++        SaveString(CHUNK_ID_ICMS, lstINFO, Commissioned, String(""));
++        SaveString(CHUNK_ID_ICMT, lstINFO, Comments, defaultComments);
++        SaveString(CHUNK_ID_ICOP, lstINFO, Copyright, String(""));
++        SaveString(CHUNK_ID_ICRD, lstINFO, CreationDate, defaultCreationDate);
++        SaveString(CHUNK_ID_IENG, lstINFO, Engineer, String(""));
++        SaveString(CHUNK_ID_IGNR, lstINFO, Genre, String(""));
++        SaveString(CHUNK_ID_IKEY, lstINFO, Keywords, String(""));
++        SaveString(CHUNK_ID_IMED, lstINFO, Medium, String(""));
++        SaveString(CHUNK_ID_INAM, lstINFO, Name, defaultName);
++        SaveString(CHUNK_ID_IPRD, lstINFO, Product, String(""));
++        SaveString(CHUNK_ID_ISBJ, lstINFO, Subject, String(""));
++        SaveString(CHUNK_ID_ISFT, lstINFO, Software, defaultSoftware);
++        SaveString(CHUNK_ID_ISRC, lstINFO, Source, String(""));
++        SaveString(CHUNK_ID_ISRF, lstINFO, SourceForm, String(""));
++        SaveString(CHUNK_ID_ITCH, lstINFO, Technician, String(""));
+     }
+ 
+ 
+@@ -406,9 +414,63 @@
+      */
+     void Resource::UpdateChunks() {
+         pInfo->UpdateChunks();
+-        //TODO: save DLSID
++
++        if (pDLSID) {
++            // make sure 'dlid' chunk exists
++            RIFF::Chunk* ckDLSID = pResourceList->GetSubChunk(CHUNK_ID_DLID);
++            if (!ckDLSID) ckDLSID = pResourceList->AddSubChunk(CHUNK_ID_DLID, 16);
++            uint8_t* pData = (uint8_t*)ckDLSID->LoadChunkData();
++            // update 'dlid' chunk
++            store32(&pData[0], pDLSID->ulData1);
++            store16(&pData[4], pDLSID->usData2);
++            store16(&pData[6], pDLSID->usData3);
++            memcpy(&pData[8], pDLSID->abData, 8);
++        }
+     }
+ 
++    /**
++     * Generates a new DLSID for the resource.
++     */
++    void Resource::GenerateDLSID() {
++#if defined(WIN32) || defined(__APPLE__) || defined(HAVE_UUID_GENERATE)
++
++        if (!pDLSID) pDLSID = new dlsid_t;
++
++#ifdef WIN32
++
++        UUID uuid;
++        UuidCreate(&uuid);
++        pDLSID->ulData1 = uuid.Data1;
++        pDLSID->usData1 = uuid.Data2;
++        pDLSID->usData2 = uuid.Data3;
++        memcpy(pDLSID->abData, uuid.Data4, 8);
++
++#elif defined(__APPLE__)
++
++        CFUUIDRef uuidRef = CFUUIDCreate(NULL);
++        CFUUIDBytes uuid = CFUUIDGetUUIDBytes(uuidRef);
++        CFRelease(uuidRef);
++        pDLSID->ulData1 = uuid.byte0 | uuid.byte1 << 8 | uuid.byte2 << 16 | uuid.byte3 << 24;
++        pDLSID->usData2 = uuid.byte4 | uuid.byte5 << 8;
++        pDLSID->usData3 = uuid.byte6 | uuid.byte7 << 8;
++        pDLSID->abData[0] = uuid.byte8;
++        pDLSID->abData[1] = uuid.byte9;
++        pDLSID->abData[2] = uuid.byte10;
++        pDLSID->abData[3] = uuid.byte11;
++        pDLSID->abData[4] = uuid.byte12;
++        pDLSID->abData[5] = uuid.byte13;
++        pDLSID->abData[6] = uuid.byte14;
++        pDLSID->abData[7] = uuid.byte15;
++#else
++        uuid_t uuid;
++        uuid_generate(uuid);
++        pDLSID->ulData1 = uuid[0] | uuid[1] << 8 | uuid[2] << 16 | uuid[3] << 24;
++        pDLSID->usData2 = uuid[4] | uuid[5] << 8;
++        pDLSID->usData3 = uuid[6] | uuid[7] << 8;
++        memcpy(pDLSID->abData, &uuid[8], 8);
++#endif
++#endif
++    }
+ 
+ 
+ // *************** Sampler ***************
+@@ -426,7 +488,7 @@
+             SampleLoops    = wsmp->ReadUint32();
+         } else { // 'wsmp' chunk missing
+             uiHeaderSize   = 0;
+-            UnityNote      = 64;
++            UnityNote      = 60;
+             FineTune       = 0; // +- 0 cents
+             Gain           = 0; // 0 dB
+             SamplerOptions = F_WSMP_NO_COMPRESSION;
+@@ -463,24 +525,70 @@
+         }
+         uint8_t* pData = (uint8_t*) wsmp->LoadChunkData();
+         // update headers size
+-        memcpy(&pData[0], &uiHeaderSize, 4);
++        store32(&pData[0], uiHeaderSize);
+         // update respective sampler options bits
+         SamplerOptions = (NoSampleDepthTruncation) ? SamplerOptions | F_WSMP_NO_TRUNCATION
+                                                    : SamplerOptions & (~F_WSMP_NO_TRUNCATION);
+         SamplerOptions = (NoSampleCompression) ? SamplerOptions | F_WSMP_NO_COMPRESSION
+                                                : SamplerOptions & (~F_WSMP_NO_COMPRESSION);
+-        memcpy(&pData[4], &UnityNote, 2);
+-        memcpy(&pData[6], &FineTune, 2);
+-        memcpy(&pData[8], &Gain, 4);
+-        memcpy(&pData[12], &SamplerOptions, 4);
+-        memcpy(&pData[16], &SampleLoops, 4);
++        store16(&pData[4], UnityNote);
++        store16(&pData[6], FineTune);
++        store32(&pData[8], Gain);
++        store32(&pData[12], SamplerOptions);
++        store32(&pData[16], SampleLoops);
+         // update loop definitions
+         for (uint32_t i = 0; i < SampleLoops; i++) {
+             //FIXME: this does not handle extended loop structs correctly
+-            memcpy(&pData[uiHeaderSize + i * 16], pSampleLoops + i, 4 * 4);
++            store32(&pData[uiHeaderSize + i * 16], pSampleLoops[i].Size);
++            store32(&pData[uiHeaderSize + i * 16 + 4], pSampleLoops[i].LoopType);
++            store32(&pData[uiHeaderSize + i * 16 + 8], pSampleLoops[i].LoopStart);
++            store32(&pData[uiHeaderSize + i * 16 + 12], pSampleLoops[i].LoopLength);
+         }
+     }
+ 
++    /**
++     * Adds a new sample loop with the provided loop definition.
++     *
++     * @param pLoopDef - points to a loop definition that is to be copied
++     */
++    void Sampler::AddSampleLoop(sample_loop_t* pLoopDef) {
++        sample_loop_t* pNewLoops = new sample_loop_t[SampleLoops + 1];
++        // copy old loops array
++        for (int i = 0; i < SampleLoops; i++) {
++            pNewLoops[i] = pSampleLoops[i];
++        }
++        // add the new loop
++        pNewLoops[SampleLoops] = *pLoopDef;
++        // auto correct size field
++        pNewLoops[SampleLoops].Size = sizeof(DLS::sample_loop_t);
++        // free the old array and update the member variables
++        if (SampleLoops) delete[] pSampleLoops;
++        pSampleLoops = pNewLoops;
++        SampleLoops++;
++    }
++
++    /**
++     * Deletes an existing sample loop.
++     *
++     * @param pLoopDef - pointer to existing loop definition
++     * @throws Exception - if given loop definition does not exist
++     */
++    void Sampler::DeleteSampleLoop(sample_loop_t* pLoopDef) {
++        sample_loop_t* pNewLoops = new sample_loop_t[SampleLoops - 1];
++        // copy old loops array (skipping given loop)
++        for (int i = 0, o = 0; i < SampleLoops; i++) {
++            if (&pSampleLoops[i] == pLoopDef) continue;
++            if (o == SampleLoops - 1)
++                throw Exception("Could not delete Sample Loop, because it does not exist");
++            pNewLoops[o] = pSampleLoops[i];
++            o++;
++        }
++        // free the old array and update the member variables
++        if (SampleLoops) delete[] pSampleLoops;
++        pSampleLoops = pNewLoops;
++        SampleLoops--;
++    }
++
+ 
+ 
+ // *************** Sample ***************
+@@ -716,12 +824,12 @@
+         if (!pCkFormat) pCkFormat = pWaveList->AddSubChunk(CHUNK_ID_FMT, 16); // assumes PCM format
+         uint8_t* pData = (uint8_t*) pCkFormat->LoadChunkData();
+         // update 'fmt' chunk
+-        memcpy(&pData[0], &FormatTag, 2);
+-        memcpy(&pData[2], &Channels,  2);
+-        memcpy(&pData[4], &SamplesPerSecond, 4);
+-        memcpy(&pData[8], &AverageBytesPerSecond, 4);
+-        memcpy(&pData[12], &BlockAlign, 2);
+-        memcpy(&pData[14], &BitDepth, 2); // assuming PCM format
++        store16(&pData[0], FormatTag);
++        store16(&pData[2], Channels);
++        store32(&pData[4], SamplesPerSecond);
++        store32(&pData[8], AverageBytesPerSecond);
++        store16(&pData[12], BlockAlign);
++        store16(&pData[14], BitDepth); // assuming PCM format
+     }
+ 
+ 
+@@ -819,11 +927,13 @@
+                                 ? FormatOptionFlags | F_RGN_OPTION_SELFNONEXCLUSIVE
+                                 : FormatOptionFlags & (~F_RGN_OPTION_SELFNONEXCLUSIVE);
+         // update 'rgnh' chunk
+-        memcpy(&pData[0], &KeyRange, 2 * 2);
+-        memcpy(&pData[4], &VelocityRange, 2 * 2);
+-        memcpy(&pData[8], &FormatOptionFlags, 2);
+-        memcpy(&pData[10], &KeyGroup, 2);
+-        if (rgnh->GetSize() >= 14) memcpy(&pData[12], &Layer, 2);
++        store16(&pData[0], KeyRange.low);
++        store16(&pData[2], KeyRange.high);
++        store16(&pData[4], VelocityRange.low);
++        store16(&pData[6], VelocityRange.high);
++        store16(&pData[8], FormatOptionFlags);
++        store16(&pData[10], KeyGroup);
++        if (rgnh->GetSize() >= 14) store16(&pData[12], Layer);
+ 
+         // update chunks of base classes as well (but skip Resource,
+         // as a rgn doesn't seem to have dlid and INFO chunks)
+@@ -856,10 +966,10 @@
+         if (index < 0) throw Exception("Could not save Region, could not find Region's sample");
+         WavePoolTableIndex = index;
+         // update 'wlnk' chunk
+-        memcpy(&pData[0], &WaveLinkOptionFlags, 2);
+-        memcpy(&pData[2], &PhaseGroup, 2);
+-        memcpy(&pData[4], &Channel, 4);
+-        memcpy(&pData[8], &WavePoolTableIndex, 4);
++        store16(&pData[0], WaveLinkOptionFlags);
++        store16(&pData[2], PhaseGroup);
++        store32(&pData[4], Channel);
++        store32(&pData[8], WavePoolTableIndex);
+     }
+ 
+ 
+@@ -981,8 +1091,9 @@
+         locale.bank       = MIDI_BANK_ENCODE(MIDIBankCoarse, MIDIBankFine);
+         locale.bank       = (IsDrum) ? locale.bank | DRUM_TYPE_MASK : locale.bank & (~DRUM_TYPE_MASK);
+         MIDIBank          = MIDI_BANK_MERGE(MIDIBankCoarse, MIDIBankFine); // just a sync, when we're at it
+-        memcpy(&pData[0], &Regions, 4);
+-        memcpy(&pData[4], &locale, 2 * 4);
++        store32(&pData[0], Regions);
++        store32(&pData[4], locale.bank);
++        store32(&pData[8], locale.instrument);
+         // update Region's chunks
+         if (!pRegions) return;
+         RegionList::iterator iter = pRegions->begin();
+@@ -1024,6 +1135,7 @@
+      * a DLS file.
+      */
+     File::File() : Resource(NULL, pRIFF = new RIFF::File(RIFF_TYPE_DLS)) {
++        pRIFF->SetByteOrder(RIFF::endian_little);
+         pVersion = new version_t;
+         pVersion->major   = 0;
+         pVersion->minor   = 0;
+@@ -1278,7 +1390,10 @@
+             RIFF::Chunk* ckVersion    = pRIFF->GetSubChunk(CHUNK_ID_VERS);
+             if (!ckVersion) ckVersion = pRIFF->AddSubChunk(CHUNK_ID_VERS, 8);
+             uint8_t* pData = (uint8_t*) ckVersion->LoadChunkData();
+-            memcpy(pData, pVersion, 2 * 4);
++            store16(&pData[0], pVersion->minor);
++            store16(&pData[2], pVersion->major);
++            store16(&pData[4], pVersion->build);
++            store16(&pData[6], pVersion->release);
+         }
+ 
+         // update 'colh' chunk
+@@ -1286,7 +1401,7 @@
+         RIFF::Chunk* colh = pRIFF->GetSubChunk(CHUNK_ID_COLH);
+         if (!colh)   colh = pRIFF->AddSubChunk(CHUNK_ID_COLH, 4);
+         uint8_t* pData = (uint8_t*) colh->LoadChunkData();
+-        memcpy(pData, &Instruments, 4);
++        store32(pData, Instruments);
+ 
+         // update instrument's chunks
+         if (pInstruments) {
+@@ -1306,7 +1421,7 @@
+         ptbl->Resize(iPtblSize);
+         pData = (uint8_t*) ptbl->LoadChunkData();
+         WavePoolCount = iSamples;
+-        memcpy(&pData[4], &WavePoolCount, 4);
++        store32(&pData[4], WavePoolCount);
+         // we actually update the sample offsets in the pool table when we Save()
+         memset(&pData[WavePoolHeaderSize], 0, iPtblSize - WavePoolHeaderSize);
+ 
+@@ -1395,18 +1510,24 @@
+         unsigned long ulOriginalPos = ptbl->GetPos();
+         // update headers
+         ptbl->SetPos(0);
+-        ptbl->WriteUint32(&WavePoolHeaderSize);
+-        ptbl->WriteUint32(&WavePoolCount);
++        uint32_t tmp = WavePoolHeaderSize;
++        ptbl->WriteUint32(&tmp);
++        tmp = WavePoolCount;
++        ptbl->WriteUint32(&tmp);
+         // update offsets
+         ptbl->SetPos(WavePoolHeaderSize);
+         if (b64BitWavePoolOffsets) {
+             for (int i = 0 ; i < WavePoolCount ; i++) {
+-                ptbl->WriteUint32(&pWavePoolTableHi[i]);
+-                ptbl->WriteUint32(&pWavePoolTable[i]);
++                tmp = pWavePoolTableHi[i];
++                ptbl->WriteUint32(&tmp);
++                tmp = pWavePoolTable[i];
++                ptbl->WriteUint32(&tmp);
+             }
+         } else { // conventional 32 bit offsets
+-            for (int i = 0 ; i < WavePoolCount ; i++)
+-                ptbl->WriteUint32(&pWavePoolTable[i]);
++            for (int i = 0 ; i < WavePoolCount ; i++) {
++                tmp = pWavePoolTable[i];
++                ptbl->WriteUint32(&tmp);
++            }
+         }
+         // restore 'ptbl' chunk's original read/write position
+         ptbl->SetPos(ulOriginalPos);
+Index: libgig/src/DLS.h
+diff -u libgig/src/DLS.h:1.18 libgig/src/DLS.h:1.22
+--- libgig/src/DLS.h:1.18	Sun Mar 18 07:13:06 2007
++++ libgig/src/DLS.h	Sun May 27 13:54:24 2007
+@@ -224,10 +224,10 @@
+ 
+     /** Defines Sample Loop Points. */
+     struct sample_loop_t {
+-        uint32_t Size;
+-        uint32_t LoopType;
+-        uint32_t LoopStart;
+-        uint32_t LoopLength;
++        uint32_t Size;       ///< For internal usage only: usually reflects exactly @c sizeof(sample_loop_t), otherwise if the value is larger then the DLS format was extended!
++        uint32_t LoopType;   ///< Defines how the waveform samples will be looped (appropriate loop types for the gig format are defined by gig::loop_type_t).
++        uint32_t LoopStart;  ///< The start value specifies the offset (in sample points) in the waveform data of the first sample point to be played in the loop.
++        uint32_t LoopLength; ///< Length of the looping area (in sample points).
+     };
+ 
+     // just symbol prototyping
+@@ -316,8 +316,13 @@
+             String SourceForm;       ///< <ISRF-ck>. Identifies the original form of the material that was digitized, such as record, sampling CD, TV sound track. This is not neccessarily the same as <i>Medium</i>.
+             String Commissioned;     ///< <ICMS-ck>. Lists the name of the person or organization that commissioned the subject of the file, e.g., Pope Julian II.
+             String Subject;          ///< <ISBJ-ck>. Describes the contents of the file.
+-            bool UseFixedLengthStrings; ///< Set this to true if the info strings should be stored with a fixed length format. This is used for gig files, not for ordinary DLS files.
++            bool UseFixedLengthStrings; ///< Deprecated. Use #FixedStringLengths instead.
+ 
++            struct FixedStringLength {
++                uint32_t chunkId;
++                int length;
++            };
++            const FixedStringLength* FixedStringLengths; ///< List of IDs and string lengths for strings that should be stored in a fixed length format. This is used for gig files, not for ordinary DLS files.
+             Info(RIFF::List* list);
+             virtual ~Info();
+             virtual void UpdateChunks();
+@@ -325,7 +330,7 @@
+             RIFF::List* pResourceListChunk;
+ 
+             static void LoadString(uint32_t ChunkID, RIFF::List* lstINFO, String& s);
+-            static void SaveString(uint32_t ChunkID, RIFF::List* lstINFO, const String& s, const String& sDefault, bool bUseFixedLengthStrings, int size);
++            void SaveString(uint32_t ChunkID, RIFF::List* lstINFO, const String& s, const String& sDefault);
+     };
+ 
+     /** Abstract base class which encapsulates data structures which all DLS resources are able to provide. */
+@@ -336,6 +341,7 @@
+ 
+             Resource* GetParent() { return pParent; };
+             virtual void UpdateChunks();
++            void GenerateDLSID();
+         protected:
+             Resource* pParent;
+             RIFF::List* pResourceList;
+@@ -355,6 +361,8 @@
+             uint32_t       SampleLoops;  ///< Reflects the number of sample loops.
+             sample_loop_t* pSampleLoops; ///< Points to the beginning of a sample loop array, or is NULL if there are no loops defined.
+ 
++            void AddSampleLoop(sample_loop_t* pLoopDef);
++            void DeleteSampleLoop(sample_loop_t* pLoopDef);
+             virtual void UpdateChunks();
+         protected:
+             RIFF::List*    pParentList;
+Index: libgig/src/RIFF.cpp
+diff -u libgig/src/RIFF.cpp:1.21 libgig/src/RIFF.cpp:1.24
+--- libgig/src/RIFF.cpp:1.21	Sun Mar 18 19:32:42 2007
++++ libgig/src/RIFF.cpp	Sat May 26 13:59:40 2007
+@@ -1364,8 +1364,13 @@
+      * "from scratch". Note: there must be no empty chunks or empty list
+      * chunks when trying to make the new RIFF file persistent with Save()!
+      *
++     * Note: by default, the RIFF file will be saved in native endian
++     * format; that is, as a RIFF file on little-endian machines and
++     * as a RIFX file on big-endian. To change this behaviour, call
++     * SetByteOrder() before calling Save().
++     *
+      * @param FileType - four-byte identifier of the RIFF file type
+-     * @see AddSubChunk(), AddSubList()
++     * @see AddSubChunk(), AddSubList(), SetByteOrder()
+      */
+     File::File(uint32_t FileType) : List(this) {
+         #if defined(WIN32)
+@@ -1527,6 +1532,23 @@
+         return false;
+     }
+ 
++    /** @brief Set the byte order to be used when saving.
++     *
++     * Set the byte order to be used in the file. A value of
++     * endian_little will create a RIFF file, endian_big a RIFX file
++     * and endian_native will create a RIFF file on little-endian
++     * machines and RIFX on big-endian machines.
++     *
++     * @param Endian - endianess to use when file is saved.
++     */
++    void File::SetByteOrder(endian_t Endian) {
++        #if WORDS_BIGENDIAN
++        bEndianNative = Endian != endian_little;
++        #else
++        bEndianNative = Endian != endian_big;
++        #endif
++    }
++
+     /** @brief Save changes to same file.
+      *
+      * Make all changes of all chunks persistent by writing them to the
+Index: libgig/src/RIFF.h
+diff -u libgig/src/RIFF.h:1.14 libgig/src/RIFF.h:1.17
+--- libgig/src/RIFF.h:1.14	Sun Mar 18 07:13:06 2007
++++ libgig/src/RIFF.h	Thu May 17 17:08:29 2007
+@@ -82,7 +82,25 @@
+ #define RIFF_HEADER_SIZE	12
+ 
+ 
+-/** RIFF specific classes and definitions */
++/**
++ * @brief RIFF specific classes and definitions
++ *
++ * The Resource Interchange File Format (RIFF) is a generic tree-structured
++ * meta-format which stores data in so called "chunks". It can be compared
++ * to XML, but in contrast to XML, RIFF is entirely binary encoded, that is
++ * not ASCII based. RIFF is used as basis for many file formats like AVI,
++ * WAV, DLS and of course the Gigasampler file format. ;-)
++ *
++ * RIFF chunks can be seen as containers for data. There are two distinct
++ * types of chunks:
++ *
++ * - @e ordinary @e chunks are the leafs of the data tree which encapsulate
++ *   the actual data of the file (i.e. the sample data of a .wav file)
++ *
++ * - @e list @e chunks are the nodes of the data tree which hold an
++ *   arbitrary amount of subchunks (can be both, list chunks and/or ordinary
++ *   chunks)
++ */
+ namespace RIFF {
+ 
+     /* just symbol prototyping */
+@@ -114,7 +132,18 @@
+         stream_end      = 3
+     } stream_whence_t;
+ 
+-    /** Provides convenient methods to access data of RIFF chunks in general. */
++    /** Alignment of data bytes in memory (system dependant). */
++    typedef enum {
++        endian_little = 0,
++        endian_big    = 1,
++        endian_native = 2
++    } endian_t;
++
++    /** @brief Ordinary RIFF Chunk
++     *
++     * Provides convenient methods to access data of ordinary RIFF chunks
++     * in general.
++     */
+     class Chunk {
+         public:
+             Chunk(File* pFile, unsigned long StartPos, List* Parent);
+@@ -205,7 +234,11 @@
+             friend class List;
+     };
+ 
+-    /** Provides convenient methods to access data of RIFF list chunks and their subchunks. */
++    /** @brief RIFF List Chunk
++     *
++     * Provides convenient methods to access data of RIFF list chunks and
++     * their subchunks.
++     */
+     class List : public Chunk {
+         public:
+             List(File* pFile, unsigned long StartPos, List* Parent);
+@@ -246,13 +279,19 @@
+             virtual void __resetPos(); ///< Sets List Chunk's read/write position to zero and causes all sub chunks to do the same.
+     };
+ 
+-    /** Parses arbitrary RIFF files and provides together with it's base classes convenient methods to walk through the RIFF tree. */
++    /** @brief RIFF File
++     *
++     * Handles arbitrary RIFF files and provides together with its base
++     * classes convenient methods to walk through, read and modify the
++     * file's RIFF tree.
++     */
+     class File : public List {
+         public:
+             File(uint32_t FileType);
+             File(const String& path);
+             stream_mode_t GetMode();
+             bool          SetMode(stream_mode_t NewMode);
++            void SetByteOrder(endian_t Endian);
+             String GetFileName();
+             virtual void Save();
+             virtual void Save(const String& path);
+@@ -290,7 +329,9 @@
+             #endif
+     };
+ 
+-    /** Will be thrown whenever an error occurs while parsing a RIFF file. */
++    /**
++     * Will be thrown whenever an error occurs while handling a RIFF file.
++     */
+     class Exception {
+         public:
+             String Message;
+Index: libgig/src/gig.cpp
+diff -u libgig/src/gig.cpp:1.55 libgig/src/gig.cpp:1.65
+--- libgig/src/gig.cpp:1.55	Fri Mar 23 20:05:02 2007
++++ libgig/src/gig.cpp	Fri Jun  1 19:19:28 2007
+@@ -278,6 +278,26 @@
+ 
+ 
+ 
++// *************** CRC ***************
++// *
++
++    const uint32_t* CRC::table(initTable());
++
++    uint32_t* CRC::initTable() {
++        uint32_t* res = new uint32_t[256];
++
++        for (int i = 0 ; i < 256 ; i++) {
++            uint32_t c = i;
++            for (int j = 0 ; j < 8 ; j++) {
++                c = (c & 1) ? 0xedb88320 ^ (c >> 1) : c >> 1;
++            }
++            res[i] = c;
++        }
++        return res;
++    }
++
++
++
+ // *************** Sample ***************
+ // *
+ 
+@@ -303,7 +323,11 @@
+      *                         is located, 0 otherwise
+      */
+     Sample::Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo) : DLS::Sample((DLS::File*) pFile, waveList, WavePoolOffset) {
+-        pInfo->UseFixedLengthStrings = true;
++        static const DLS::Info::FixedStringLength fixedStringLengths[] = {
++            { CHUNK_ID_INAM, 64 },
++            { 0, 0 }
++        };
++        pInfo->FixedStringLengths = fixedStringLengths;
+         Instances++;
+         FileNo = fileNo;
+ 
+@@ -338,11 +362,13 @@
+             Manufacturer  = 0;
+             Product       = 0;
+             SamplePeriod  = uint32_t(1000000000.0 / SamplesPerSecond + 0.5);
+-            MIDIUnityNote = 64;
++            MIDIUnityNote = 60;
+             FineTune      = 0;
++            SMPTEFormat   = smpte_format_no_offset;
+             SMPTEOffset   = 0;
+             Loops         = 0;
+             LoopID        = 0;
++            LoopType      = loop_type_normal;
+             LoopStart     = 0;
+             LoopEnd       = 0;
+             LoopFraction  = 0;
+@@ -398,27 +424,30 @@
+ 
+         // make sure 'smpl' chunk exists
+         pCkSmpl = pWaveList->GetSubChunk(CHUNK_ID_SMPL);
+-        if (!pCkSmpl) pCkSmpl = pWaveList->AddSubChunk(CHUNK_ID_SMPL, 60);
++        if (!pCkSmpl) {
++            pCkSmpl = pWaveList->AddSubChunk(CHUNK_ID_SMPL, 60);
++            memset(pCkSmpl->LoadChunkData(), 0, 60);
++        }
+         // update 'smpl' chunk
+         uint8_t* pData = (uint8_t*) pCkSmpl->LoadChunkData();
+         SamplePeriod = uint32_t(1000000000.0 / SamplesPerSecond + 0.5);
+-        memcpy(&pData[0], &Manufacturer, 4);
+-        memcpy(&pData[4], &Product, 4);
+-        memcpy(&pData[8], &SamplePeriod, 4);
+-        memcpy(&pData[12], &MIDIUnityNote, 4);
+-        memcpy(&pData[16], &FineTune, 4);
+-        memcpy(&pData[20], &SMPTEFormat, 4);
+-        memcpy(&pData[24], &SMPTEOffset, 4);
+-        memcpy(&pData[28], &Loops, 4);
++        store32(&pData[0], Manufacturer);
++        store32(&pData[4], Product);
++        store32(&pData[8], SamplePeriod);
++        store32(&pData[12], MIDIUnityNote);
++        store32(&pData[16], FineTune);
++        store32(&pData[20], SMPTEFormat);
++        store32(&pData[24], SMPTEOffset);
++        store32(&pData[28], Loops);
+ 
+         // we skip 'manufByt' for now (4 bytes)
+ 
+-        memcpy(&pData[36], &LoopID, 4);
+-        memcpy(&pData[40], &LoopType, 4);
+-        memcpy(&pData[44], &LoopStart, 4);
+-        memcpy(&pData[48], &LoopEnd, 4);
+-        memcpy(&pData[52], &LoopFraction, 4);
+-        memcpy(&pData[56], &LoopPlayCount, 4);
++        store32(&pData[36], LoopID);
++        store32(&pData[40], LoopType);
++        store32(&pData[44], LoopStart);
++        store32(&pData[48], LoopEnd);
++        store32(&pData[52], LoopFraction);
++        store32(&pData[56], LoopPlayCount);
+ 
+         // make sure '3gix' chunk exists
+         pCk3gix = pWaveList->GetSubChunk(CHUNK_ID_3GIX);
+@@ -438,7 +467,7 @@
+         }
+         // update '3gix' chunk
+         pData = (uint8_t*) pCk3gix->LoadChunkData();
+-        memcpy(&pData[0], &iSampleGroup, 2);
++        store16(&pData[0], iSampleGroup);
+     }
+ 
+     /// Scans compressed samples for mandatory informations (e.g. actual number of total sample points).
+@@ -1131,7 +1160,22 @@
+      */
+     unsigned long Sample::Write(void* pBuffer, unsigned long SampleCount) {
+         if (Compressed) throw gig::Exception("There is no support for writing compressed gig samples (yet)");
+-        return DLS::Sample::Write(pBuffer, SampleCount);
++
++        // if this is the first write in this sample, reset the
++        // checksum calculator
++        if (pCkData->GetPos() == 0) {
++            crc.reset();
++        }
++        unsigned long res = DLS::Sample::Write(pBuffer, SampleCount);
++        crc.update((unsigned char *)pBuffer, SampleCount * FrameSize);
++
++        // if this is the last write, update the checksum chunk in the
++        // file
++        if (pCkData->GetPos() == pCkData->GetSize()) {
++            File* pFile = static_cast<File*>(GetParent());
++            pFile->SetSampleChecksum(this, crc.getValue());
++        }
++        return res;
+     }
+ 
+     /**
+@@ -1376,9 +1420,9 @@
+             LFO1ControlDepth                = 0;
+             LFO3ControlDepth                = 0;
+             EG1Attack                       = 0.0;
+-            EG1Decay1                       = 0.0;
+-            EG1Sustain                      = 0;
+-            EG1Release                      = 0.0;
++            EG1Decay1                       = 0.005;
++            EG1Sustain                      = 1000;
++            EG1Release                      = 0.3;
+             EG1Controller.type              = eg1_ctrl_t::type_none;
+             EG1Controller.controller_number = 0;
+             EG1ControllerInvert             = false;
+@@ -1393,18 +1437,18 @@
+             EG2ControllerReleaseInfluence   = 0;
+             LFO1Frequency                   = 1.0;
+             EG2Attack                       = 0.0;
+-            EG2Decay1                       = 0.0;
+-            EG2Sustain                      = 0;
+-            EG2Release                      = 0.0;
++            EG2Decay1                       = 0.005;
++            EG2Sustain                      = 1000;
++            EG2Release                      = 0.3;
+             LFO2ControlDepth                = 0;
+             LFO2Frequency                   = 1.0;
+             LFO2InternalDepth               = 0;
+             EG1Decay2                       = 0.0;
+-            EG1InfiniteSustain              = false;
+-            EG1PreAttack                    = 1000;
++            EG1InfiniteSustain              = true;
++            EG1PreAttack                    = 0;
+             EG2Decay2                       = 0.0;
+-            EG2InfiniteSustain              = false;
+-            EG2PreAttack                    = 1000;
++            EG2InfiniteSustain              = true;
++            EG2PreAttack                    = 0;
+             VelocityResponseCurve           = curve_type_nonlinear;
+             VelocityResponseDepth           = 3;
+             ReleaseVelocityResponseCurve    = curve_type_nonlinear;
+@@ -1503,104 +1547,104 @@
+ 
+         // update '3ewa' chunk with DimensionRegion's current settings
+ 
+-        const uint32_t chunksize = _3ewa->GetSize();
+-        memcpy(&pData[0], &chunksize, 4); // unknown, always chunk size?
++        const uint32_t chunksize = _3ewa->GetNewSize();
++        store32(&pData[0], chunksize); // unknown, always chunk size?
+ 
+         const int32_t lfo3freq = (int32_t) GIG_EXP_ENCODE(LFO3Frequency);
+-        memcpy(&pData[4], &lfo3freq, 4);
++        store32(&pData[4], lfo3freq);
+ 
+         const int32_t eg3attack = (int32_t) GIG_EXP_ENCODE(EG3Attack);
+-        memcpy(&pData[8], &eg3attack, 4);
++        store32(&pData[8], eg3attack);
+ 
+         // next 2 bytes unknown
+ 
+-        memcpy(&pData[14], &LFO1InternalDepth, 2);
++        store16(&pData[14], LFO1InternalDepth);
+ 
+         // next 2 bytes unknown
+ 
+-        memcpy(&pData[18], &LFO3InternalDepth, 2);
++        store16(&pData[18], LFO3InternalDepth);
+ 
+         // next 2 bytes unknown
+ 
+-        memcpy(&pData[22], &LFO1ControlDepth, 2);
++        store16(&pData[22], LFO1ControlDepth);
+ 
+         // next 2 bytes unknown
+ 
+-        memcpy(&pData[26], &LFO3ControlDepth, 2);
++        store16(&pData[26], LFO3ControlDepth);
+ 
+         const int32_t eg1attack = (int32_t) GIG_EXP_ENCODE(EG1Attack);
+-        memcpy(&pData[28], &eg1attack, 4);
++        store32(&pData[28], eg1attack);
+ 
+         const int32_t eg1decay1 = (int32_t) GIG_EXP_ENCODE(EG1Decay1);
+-        memcpy(&pData[32], &eg1decay1, 4);
++        store32(&pData[32], eg1decay1);
+ 
+         // next 2 bytes unknown
+ 
+-        memcpy(&pData[38], &EG1Sustain, 2);
++        store16(&pData[38], EG1Sustain);
+ 
+         const int32_t eg1release = (int32_t) GIG_EXP_ENCODE(EG1Release);
+-        memcpy(&pData[40], &eg1release, 4);
++        store32(&pData[40], eg1release);
+ 
+         const uint8_t eg1ctl = (uint8_t) EncodeLeverageController(EG1Controller);
+-        memcpy(&pData[44], &eg1ctl, 1);
++        pData[44] = eg1ctl;
+ 
+         const uint8_t eg1ctrloptions =
+             (EG1ControllerInvert) ? 0x01 : 0x00 |
+             GIG_EG_CTR_ATTACK_INFLUENCE_ENCODE(EG1ControllerAttackInfluence) |
+             GIG_EG_CTR_DECAY_INFLUENCE_ENCODE(EG1ControllerDecayInfluence) |
+             GIG_EG_CTR_RELEASE_INFLUENCE_ENCODE(EG1ControllerReleaseInfluence);
+-        memcpy(&pData[45], &eg1ctrloptions, 1);
++        pData[45] = eg1ctrloptions;
+ 
+         const uint8_t eg2ctl = (uint8_t) EncodeLeverageController(EG2Controller);
+-        memcpy(&pData[46], &eg2ctl, 1);
++        pData[46] = eg2ctl;
+ 
+         const uint8_t eg2ctrloptions =
+             (EG2ControllerInvert) ? 0x01 : 0x00 |
+             GIG_EG_CTR_ATTACK_INFLUENCE_ENCODE(EG2ControllerAttackInfluence) |
+             GIG_EG_CTR_DECAY_INFLUENCE_ENCODE(EG2ControllerDecayInfluence) |
+             GIG_EG_CTR_RELEASE_INFLUENCE_ENCODE(EG2ControllerReleaseInfluence);
+-        memcpy(&pData[47], &eg2ctrloptions, 1);
++        pData[47] = eg2ctrloptions;
+ 
+         const int32_t lfo1freq = (int32_t) GIG_EXP_ENCODE(LFO1Frequency);
+-        memcpy(&pData[48], &lfo1freq, 4);
++        store32(&pData[48], lfo1freq);
+ 
+         const int32_t eg2attack = (int32_t) GIG_EXP_ENCODE(EG2Attack);
+-        memcpy(&pData[52], &eg2attack, 4);
++        store32(&pData[52], eg2attack);
+ 
+         const int32_t eg2decay1 = (int32_t) GIG_EXP_ENCODE(EG2Decay1);
+-        memcpy(&pData[56], &eg2decay1, 4);
++        store32(&pData[56], eg2decay1);
+ 
+         // next 2 bytes unknown
+ 
+-        memcpy(&pData[62], &EG2Sustain, 2);
++        store16(&pData[62], EG2Sustain);
+ 
+         const int32_t eg2release = (int32_t) GIG_EXP_ENCODE(EG2Release);
+-        memcpy(&pData[64], &eg2release, 4);
++        store32(&pData[64], eg2release);
+ 
+         // next 2 bytes unknown
+ 
+-        memcpy(&pData[70], &LFO2ControlDepth, 2);
++        store16(&pData[70], LFO2ControlDepth);
+ 
+         const int32_t lfo2freq = (int32_t) GIG_EXP_ENCODE(LFO2Frequency);
+-        memcpy(&pData[72], &lfo2freq, 4);
++        store32(&pData[72], lfo2freq);
+ 
+         // next 2 bytes unknown
+ 
+-        memcpy(&pData[78], &LFO2InternalDepth, 2);
++        store16(&pData[78], LFO2InternalDepth);
+ 
+         const int32_t eg1decay2 = (int32_t) (EG1InfiniteSustain) ? 0x7fffffff : (int32_t) GIG_EXP_ENCODE(EG1Decay2);
+-        memcpy(&pData[80], &eg1decay2, 4);
++        store32(&pData[80], eg1decay2);
+ 
+         // next 2 bytes unknown
+ 
+-        memcpy(&pData[86], &EG1PreAttack, 2);
++        store16(&pData[86], EG1PreAttack);
+ 
+         const int32_t eg2decay2 = (int32_t) (EG2InfiniteSustain) ? 0x7fffffff : (int32_t) GIG_EXP_ENCODE(EG2Decay2);
+-        memcpy(&pData[88], &eg2decay2, 4);
++        store32(&pData[88], eg2decay2);
+ 
+         // next 2 bytes unknown
+ 
+-        memcpy(&pData[94], &EG2PreAttack, 2);
++        store16(&pData[94], EG2PreAttack);
+ 
+         {
+             if (VelocityResponseDepth > 4) throw Exception("VelocityResponseDepth must be between 0 and 4");
+@@ -1618,7 +1662,7 @@
+                 default:
+                     throw Exception("Could not update DimensionRegion's chunk, unknown VelocityResponseCurve selected");
+             }
+-            memcpy(&pData[96], &velocityresponse, 1);
++            pData[96] = velocityresponse;
+         }
+ 
+         {
+@@ -1637,16 +1681,16 @@
+                 default:
+                     throw Exception("Could not update DimensionRegion's chunk, unknown ReleaseVelocityResponseCurve selected");
+             }
+-            memcpy(&pData[97], &releasevelocityresponse, 1);
++            pData[97] = releasevelocityresponse;
+         }
+ 
+-        memcpy(&pData[98], &VelocityResponseCurveScaling, 1);
++        pData[98] = VelocityResponseCurveScaling;
+ 
+-        memcpy(&pData[99], &AttenuationControllerThreshold, 1);
++        pData[99] = AttenuationControllerThreshold;
+ 
+         // next 4 bytes unknown
+ 
+-        memcpy(&pData[104], &SampleStartOffset, 2);
++        store16(&pData[104], SampleStartOffset);
+ 
+         // next 2 bytes unknown
+ 
+@@ -1665,14 +1709,14 @@
+                 default:
+                     throw Exception("Could not update DimensionRegion's chunk, unknown DimensionBypass selected");
+             }
+-            memcpy(&pData[108], &pitchTrackDimensionBypass, 1);
++            pData[108] = pitchTrackDimensionBypass;
+         }
+ 
+         const uint8_t pan = (Pan >= 0) ? Pan : ((-Pan) + 63); // signed 8 bit -> signed 7 bit
+-        memcpy(&pData[109], &pan, 1);
++        pData[109] = pan;
+ 
+         const uint8_t selfmask = (SelfMask) ? 0x01 : 0x00;
+-        memcpy(&pData[110], &selfmask, 1);
++        pData[110] = selfmask;
+ 
+         // next byte unknown
+ 
+@@ -1681,18 +1725,18 @@
+             if (LFO3Sync) lfo3ctrl |= 0x20; // bit 5
+             if (InvertAttenuationController) lfo3ctrl |= 0x80; // bit 7
+             if (VCFType == vcf_type_lowpassturbo) lfo3ctrl |= 0x40; // bit 6
+-            memcpy(&pData[112], &lfo3ctrl, 1);
++            pData[112] = lfo3ctrl;
+         }
+ 
+         const uint8_t attenctl = EncodeLeverageController(AttenuationController);
+-        memcpy(&pData[113], &attenctl, 1);
++        pData[113] = attenctl;
+ 
+         {
+             uint8_t lfo2ctrl = LFO2Controller & 0x07; // lower 3 bits
+             if (LFO2FlipPhase) lfo2ctrl |= 0x80; // bit 7
+             if (LFO2Sync)      lfo2ctrl |= 0x20; // bit 5
+             if (VCFResonanceController != vcf_res_ctrl_none) lfo2ctrl |= 0x40; // bit 6
+-            memcpy(&pData[114], &lfo2ctrl, 1);
++            pData[114] = lfo2ctrl;
+         }
+ 
+         {
+@@ -1701,64 +1745,64 @@
+             if (LFO1Sync)      lfo1ctrl |= 0x40; // bit 6
+             if (VCFResonanceController != vcf_res_ctrl_none)
+                 lfo1ctrl |= GIG_VCF_RESONANCE_CTRL_ENCODE(VCFResonanceController);
+-            memcpy(&pData[115], &lfo1ctrl, 1);
++            pData[115] = lfo1ctrl;
+         }
+ 
+         const uint16_t eg3depth = (EG3Depth >= 0) ? EG3Depth
+                                                   : uint16_t(((-EG3Depth) - 1) ^ 0xffff); /* binary complementary for negatives */
+-        memcpy(&pData[116], &eg3depth, 1);
++        pData[116] = eg3depth;
+ 
+         // next 2 bytes unknown
+ 
+         const uint8_t channeloffset = ChannelOffset * 4;
+-        memcpy(&pData[120], &channeloffset, 1);
++        pData[120] = channeloffset;
+ 
+         {
+             uint8_t regoptions = 0;
+             if (MSDecode)      regoptions |= 0x01; // bit 0
+             if (SustainDefeat) regoptions |= 0x02; // bit 1
+-            memcpy(&pData[121], &regoptions, 1);
++            pData[121] = regoptions;
+         }
+ 
+         // next 2 bytes unknown
+ 
+-        memcpy(&pData[124], &VelocityUpperLimit, 1);
++        pData[124] = VelocityUpperLimit;
+ 
+         // next 3 bytes unknown
+ 
+-        memcpy(&pData[128], &ReleaseTriggerDecay, 1);
++        pData[128] = ReleaseTriggerDecay;
+ 
+         // next 2 bytes unknown
+ 
+         const uint8_t eg1hold = (EG1Hold) ? 0x80 : 0x00; // bit 7
+-        memcpy(&pData[131], &eg1hold, 1);
++        pData[131] = eg1hold;
+ 
+         const uint8_t vcfcutoff = (VCFEnabled) ? 0x80 : 0x00 |  /* bit 7 */
+                                   (VCFCutoff & 0x7f);   /* lower 7 bits */
+-        memcpy(&pData[132], &vcfcutoff, 1);
++        pData[132] = vcfcutoff;
+ 
+-        memcpy(&pData[133], &VCFCutoffController, 1);
++        pData[133] = VCFCutoffController;
+ 
+         const uint8_t vcfvelscale = (VCFCutoffControllerInvert) ? 0x80 : 0x00 | /* bit 7 */
+                                     (VCFVelocityScale & 0x7f); /* lower 7 bits */
+-        memcpy(&pData[134], &vcfvelscale, 1);
++        pData[134] = vcfvelscale;
+ 
+         // next byte unknown
+ 
+         const uint8_t vcfresonance = (VCFResonanceDynamic) ? 0x00 : 0x80 | /* bit 7 */
+                                      (VCFResonance & 0x7f); /* lower 7 bits */
+-        memcpy(&pData[136], &vcfresonance, 1);
++        pData[136] = vcfresonance;
+ 
+         const uint8_t vcfbreakpoint = (VCFKeyboardTracking) ? 0x80 : 0x00 | /* bit 7 */
+                                       (VCFKeyboardTrackingBreakpoint & 0x7f); /* lower 7 bits */
+-        memcpy(&pData[137], &vcfbreakpoint, 1);
++        pData[137] = vcfbreakpoint;
+ 
+         const uint8_t vcfvelocity = VCFVelocityDynamicRange % 5 |
+                                     VCFVelocityCurve * 5;
+-        memcpy(&pData[138], &vcfvelocity, 1);
++        pData[138] = vcfvelocity;
+ 
+         const uint8_t vcftype = (VCFType == vcf_type_lowpassturbo) ? vcf_type_lowpass : VCFType;
+-        memcpy(&pData[139], &vcftype, 1);
++        pData[139] = vcftype;
+ 
+         if (chunksize >= 148) {
+             memcpy(&pData[140], DimensionUpperLimits, 8);
+@@ -1987,6 +2031,7 @@
+                     default:
+                         throw gig::Exception("leverage controller number is not supported by the gig format");
+                 }
++                break;
+             default:
+                 throw gig::Exception("Unknown leverage controller type.");
+         }
+@@ -2104,8 +2149,6 @@
+ // *
+ 
+     Region::Region(Instrument* pInstrument, RIFF::List* rgnList) : DLS::Region((DLS::Instrument*) pInstrument, rgnList) {
+-        pInfo->UseFixedLengthStrings = true;
+-
+         // Initialization
+         Dimensions = 0;
+         for (int i = 0; i < 256; i++) {
+@@ -2125,8 +2168,8 @@
+             for (int i = 0; i < dimensionBits; i++) {
+                 dimension_t dimension = static_cast<dimension_t>(_3lnk->ReadUint8());
+                 uint8_t     bits      = _3lnk->ReadUint8();
+-                _3lnk->ReadUint8(); // probably the position of the dimension
+-                _3lnk->ReadUint8(); // unknown
++                _3lnk->ReadUint8(); // bit position of the dimension (bits[0] + bits[1] + ... + bits[i-1])
++                _3lnk->ReadUint8(); // (1 << bit position of next dimension) - (1 << bit position of this dimension)
+                 uint8_t     zones     = _3lnk->ReadUint8(); // new for v3: number of zones doesn't have to be == pow(2,bits)
+                 if (dimension == dimension_none) { // inactive dimension
+                     pDimensionDefinitions[i].dimension  = dimension_none;
+@@ -2168,6 +2211,11 @@
+             GetSample(); // load global region sample reference
+         } else {
+             DimensionRegions = 0;
++            for (int i = 0 ; i < 8 ; i++) {
++                pDimensionDefinitions[i].dimension  = dimension_none;
++                pDimensionDefinitions[i].bits       = 0;
++                pDimensionDefinitions[i].zones      = 0;
++            }
+         }
+ 
+         // make sure there is at least one dimension region
+@@ -2213,17 +2261,25 @@
+         if (!_3lnk) {
+             const int _3lnkChunkSize = (pFile->pVersion && pFile->pVersion->major == 3) ? 1092 : 172;
+             _3lnk = pCkRegion->AddSubChunk(CHUNK_ID_3LNK, _3lnkChunkSize);
++            memset(_3lnk->LoadChunkData(), 0, _3lnkChunkSize);
++
++            // move 3prg to last position
++            pCkRegion->MoveSubChunk(pCkRegion->GetSubList(LIST_TYPE_3PRG), 0);
+         }
+ 
+         // update dimension definitions in '3lnk' chunk
+         uint8_t* pData = (uint8_t*) _3lnk->LoadChunkData();
+-        memcpy(&pData[0], &DimensionRegions, 4);
++        store32(&pData[0], DimensionRegions);
++        int shift = 0;
+         for (int i = 0; i < iMaxDimensions; i++) {
+             pData[4 + i * 8] = (uint8_t) pDimensionDefinitions[i].dimension;
+             pData[5 + i * 8] = pDimensionDefinitions[i].bits;
+-            // next 2 bytes unknown
++            pData[6 + i * 8] = shift;
++            pData[7 + i * 8] = (1 << (shift + pDimensionDefinitions[i].bits)) - (1 << shift);
+             pData[8 + i * 8] = pDimensionDefinitions[i].zones;
+-            // next 3 bytes unknown
++            // next 3 bytes unknown, always zero?
++
++            shift += pDimensionDefinitions[i].bits;
+         }
+ 
+         // update wave pool table in '3lnk' chunk
+@@ -2242,7 +2298,7 @@
+                 }
+                 if (iWaveIndex < 0) throw gig::Exception("Could not update gig::Region, could not find DimensionRegion's sample");
+             }
+-            memcpy(&pData[iWavePoolOffset + i * 4], &iWaveIndex, 4);
++            store32(&pData[iWavePoolOffset + i * 4], iWaveIndex);
+         }
+     }
+ 
+@@ -2379,7 +2435,8 @@
+         // create new dimension region(s) for this new dimension
+         for (int i = 1 << iCurrentBits; i < 1 << iNewBits; i++) {
+             //TODO: maybe we should copy existing dimension regions if possible instead of simply creating new ones with default values
+-            RIFF::List* pNewDimRgnListChunk = pCkRegion->AddSubList(LIST_TYPE_3EWL);
++            RIFF::List* _3prg = pCkRegion->GetSubList(LIST_TYPE_3PRG);
++            RIFF::List* pNewDimRgnListChunk = _3prg->AddSubList(LIST_TYPE_3EWL);
+             pDimensionRegions[i] = new DimensionRegion(pNewDimRgnListChunk);
+             DimensionRegions++;
+         }
+@@ -2592,10 +2649,22 @@
+ // *
+ 
+     Instrument::Instrument(File* pFile, RIFF::List* insList, progress_t* pProgress) : DLS::Instrument((DLS::File*)pFile, insList) {
+-        pInfo->UseFixedLengthStrings = true;
++        static const DLS::Info::FixedStringLength fixedStringLengths[] = {
++            { CHUNK_ID_INAM, 64 },
++            { CHUNK_ID_ISFT, 12 },
++            { 0, 0 }
++        };
++        pInfo->FixedStringLengths = fixedStringLengths;
+ 
+         // Initialization
+         for (int i = 0; i < 128; i++) RegionKeyTable[i] = NULL;
++        EffectSend = 0;
++        Attenuation = 0;
++        FineTune = 0;
++        PitchbendRange = 0;
++        PianoReleaseMode = false;
++        DimensionKeyRange.low = 0;
++        DimensionKeyRange.high = 0;
+ 
+         // Loading
+         RIFF::List* lart = insList->GetSubList(LIST_TYPE_LART);
+@@ -2674,14 +2743,14 @@
+         if (!_3ewg)  _3ewg = lart->AddSubChunk(CHUNK_ID_3EWG, 12);
+         // update '3ewg' RIFF chunk
+         uint8_t* pData = (uint8_t*) _3ewg->LoadChunkData();
+-        memcpy(&pData[0], &EffectSend, 2);
+-        memcpy(&pData[2], &Attenuation, 4);
+-        memcpy(&pData[6], &FineTune, 2);
+-        memcpy(&pData[8], &PitchbendRange, 2);
++        store16(&pData[0], EffectSend);
++        store32(&pData[2], Attenuation);
++        store16(&pData[6], FineTune);
++        store16(&pData[8], PitchbendRange);
+         const uint8_t dimkeystart = (PianoReleaseMode) ? 0x01 : 0x00 |
+                                     DimensionKeyRange.low << 1;
+-        memcpy(&pData[10], &dimkeystart, 1);
+-        memcpy(&pData[11], &DimensionKeyRange.high, 1);
++        pData[10] = dimkeystart;
++        pData[11] = DimensionKeyRange.high;
+     }
+ 
+     /**
+@@ -2783,9 +2852,12 @@
+     void Group::UpdateChunks() {
+         // make sure <3gri> and <3gnl> list chunks exist
+         RIFF::List* _3gri = pFile->pRIFF->GetSubList(LIST_TYPE_3GRI);
+-        if (!_3gri) _3gri = pFile->pRIFF->AddSubList(LIST_TYPE_3GRI);
++        if (!_3gri) {
++            _3gri = pFile->pRIFF->AddSubList(LIST_TYPE_3GRI);
++            pFile->pRIFF->MoveSubChunk(_3gri, pFile->pRIFF->GetSubChunk(CHUNK_ID_PTBL));
++        }
+         RIFF::List* _3gnl = _3gri->GetSubList(LIST_TYPE_3GNL);
+-        if (!_3gnl) _3gnl = pFile->pRIFF->AddSubList(LIST_TYPE_3GNL);
++        if (!_3gnl) _3gnl = _3gri->AddSubList(LIST_TYPE_3GNL);
+         // now store the name of this group as <3gnm> chunk as subchunk of the <3gnl> list chunk
+         ::SaveString(CHUNK_ID_3GNM, pNameChunk, _3gnl, Name, String("Unnamed Group"), true, 64);
+     }
+@@ -2861,14 +2933,54 @@
+ // *************** File ***************
+ // *
+ 
++    // File version 2.0, 1998-06-28
++    const DLS::version_t File::VERSION_2 = {
++        0, 2, 19980628 & 0xffff, 19980628 >> 16
++    };
++
++    // File version 3.0, 2003-03-31
++    const DLS::version_t File::VERSION_3 = {
++        0, 3, 20030331 & 0xffff, 20030331 >> 16
++    };
++
++    const DLS::Info::FixedStringLength File::FixedStringLengths[] = {
++        { CHUNK_ID_IARL, 256 },
++        { CHUNK_ID_IART, 128 },
++        { CHUNK_ID_ICMS, 128 },
++        { CHUNK_ID_ICMT, 1024 },
++        { CHUNK_ID_ICOP, 128 },
++        { CHUNK_ID_ICRD, 128 },
++        { CHUNK_ID_IENG, 128 },
++        { CHUNK_ID_IGNR, 128 },
++        { CHUNK_ID_IKEY, 128 },
++        { CHUNK_ID_IMED, 128 },
++        { CHUNK_ID_INAM, 128 },
++        { CHUNK_ID_IPRD, 128 },
++        { CHUNK_ID_ISBJ, 128 },
++        { CHUNK_ID_ISFT, 128 },
++        { CHUNK_ID_ISRC, 128 },
++        { CHUNK_ID_ISRF, 128 },
++        { CHUNK_ID_ITCH, 128 },
++        { 0, 0 }
++    };
++
+     File::File() : DLS::File() {
+         pGroups = NULL;
+-        pInfo->UseFixedLengthStrings = true;
++        pInfo->FixedStringLengths = FixedStringLengths;
++        pInfo->ArchivalLocation = String(256, ' ');
++
++        // add some mandatory chunks to get the file chunks in right
++        // order (INFO chunk will be moved to first position later)
++        pRIFF->AddSubChunk(CHUNK_ID_VERS, 8);
++        pRIFF->AddSubChunk(CHUNK_ID_COLH, 4);
++        pRIFF->AddSubChunk(CHUNK_ID_DLID, 16);
++
++        GenerateDLSID();
+     }
+ 
+     File::File(RIFF::File* pRIFF) : DLS::File(pRIFF) {
+         pGroups = NULL;
+-        pInfo->UseFixedLengthStrings = true;
++        pInfo->FixedStringLengths = FixedStringLengths;
+     }
+ 
+     File::~File() {
+@@ -2910,6 +3022,11 @@
+        // create new Sample object and its respective 'wave' list chunk
+        RIFF::List* wave = wvpl->AddSubList(LIST_TYPE_WAVE);
+        Sample* pSample = new Sample(this, wave, 0 /*arbitrary value, we update offsets when we save*/);
++
++       // add mandatory chunks to get the chunks in right order
++       wave->AddSubChunk(CHUNK_ID_FMT, 16);
++       wave->AddSubList(LIST_TYPE_INFO);
++
+        pSamples->push_back(pSample);
+        return pSample;
+     }
+@@ -2938,7 +3055,7 @@
+     void File::LoadSamples(progress_t* pProgress) {
+         // Groups must be loaded before samples, because samples will try
+         // to resolve the group they belong to
+-        LoadGroups();
++        if (!pGroups) LoadGroups();
+ 
+         if (!pSamples) pSamples = new SampleList;
+ 
+@@ -3052,7 +3169,19 @@
+        __ensureMandatoryChunksExist();
+        RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS);
+        RIFF::List* lstInstr = lstInstruments->AddSubList(LIST_TYPE_INS);
++
++       // add mandatory chunks to get the chunks in right order
++       lstInstr->AddSubList(LIST_TYPE_INFO);
++       lstInstr->AddSubChunk(CHUNK_ID_DLID, 16);
++
+        Instrument* pInstrument = new Instrument(this, lstInstr);
++       pInstrument->GenerateDLSID();
++
++       lstInstr->AddSubChunk(CHUNK_ID_INSH, 12);
++
++       // this string is needed for the gig to be loadable in GSt:
++       pInstrument->pInfo->Software = "Endless Wave";
++
+        pInstruments->push_back(pInstrument);
+        return pInstrument;
+     }
+@@ -3103,6 +3232,32 @@
+         }
+     }
+ 
++    /// Updates the 3crc chunk with the checksum of a sample. The
++    /// update is done directly to disk, as this method is called
++    /// after File::Save()
++    void File::SetSampleChecksum(Sample* pSample, uint32_t crc) {
++        RIFF::Chunk* _3crc = pRIFF->GetSubChunk(CHUNK_ID_3CRC);
++        if (!_3crc) return;
++
++        // get the index of the sample
++        int iWaveIndex = -1;
++        File::SampleList::iterator iter = pSamples->begin();
++        File::SampleList::iterator end  = pSamples->end();
++        for (int index = 0; iter != end; ++iter, ++index) {
++            if (*iter == pSample) {
++                iWaveIndex = index;
++                break;
++            }
++        }
++        if (iWaveIndex < 0) throw gig::Exception("Could not update crc, could not find sample");
++
++        // write the CRC-32 checksum to disk
++        _3crc->SetPos(iWaveIndex * 8);
++        uint32_t tmp = 1;
++        _3crc->WriteUint32(&tmp); // unknown, always 1?
++        _3crc->WriteUint32(&crc);
++    }
++
+     Group* File::GetFirstGroup() {
+         if (!pGroups) LoadGroups();
+         // there must always be at least one group
+@@ -3220,9 +3375,21 @@
+      * @throws Exception - on errors
+      */
+     void File::UpdateChunks() {
++        bool newFile = pRIFF->GetSubList(LIST_TYPE_INFO) == NULL;
++
+         // first update base class's chunks
+         DLS::File::UpdateChunks();
+ 
++        if (newFile) {
++            // INFO was added by Resource::UpdateChunks - make sure it
++            // is placed first in file
++            RIFF::Chunk* info = pRIFF->GetSubList(LIST_TYPE_INFO);
++            RIFF::Chunk* first = pRIFF->GetFirstSubChunk();
++            if (first != info) {
++                pRIFF->MoveSubChunk(info, first);
++            }
++        }
++
+         // update group's chunks
+         if (pGroups) {
+             std::list<Group*>::iterator iter = pGroups->begin();
+@@ -3231,6 +3398,125 @@
+                 (*iter)->UpdateChunks();
+             }
+         }
++
++        // update einf chunk
++
++        // The einf chunk contains statistics about the gig file, such
++        // as the number of regions and samples used by each
++        // instrument. It is divided in equally sized parts, where the
++        // first part contains information about the whole gig file,
++        // and the rest of the parts map to each instrument in the
++        // file.
++        //
++        // At the end of each part there is a bit map of each sample
++        // in the file, where a set bit means that the sample is used
++        // by the file/instrument.
++        //
++        // Note that there are several fields with unknown use. These
++        // are set to zero.
++
++        int sublen = pSamples->size() / 8 + 49;
++        int einfSize = (Instruments + 1) * sublen;
++
++        RIFF::Chunk* einf = pRIFF->GetSubChunk(CHUNK_ID_EINF);
++        if (einf) {
++            if (einf->GetSize() != einfSize) {
++                einf->Resize(einfSize);
++                memset(einf->LoadChunkData(), 0, einfSize);
++            }
++        } else if (newFile) {
++            einf = pRIFF->AddSubChunk(CHUNK_ID_EINF, einfSize);
++        }
++        if (einf) {
++            uint8_t* pData = (uint8_t*) einf->LoadChunkData();
++
++            std::map<gig::Sample*,int> sampleMap;
++            int sampleIdx = 0;
++            for (Sample* pSample = GetFirstSample(); pSample; pSample = GetNextSample()) {
++                sampleMap[pSample] = sampleIdx++;
++            }
++
++            int totnbusedsamples = 0;
++            int totnbusedchannels = 0;
++            int totnbregions = 0;
++            int totnbdimregions = 0;
++            int instrumentIdx = 0;
++
++            memset(&pData[48], 0, sublen - 48);
++
++            for (Instrument* instrument = GetFirstInstrument() ; instrument ;
++                 instrument = GetNextInstrument()) {
++                int nbusedsamples = 0;
++                int nbusedchannels = 0;
++                int nbdimregions = 0;
++
++                memset(&pData[(instrumentIdx + 1) * sublen + 48], 0, sublen - 48);
++
++                for (Region* region = instrument->GetFirstRegion() ; region ;
++                     region = instrument->GetNextRegion()) {
++                    for (int i = 0 ; i < region->DimensionRegions ; i++) {
++                        gig::DimensionRegion *d = region->pDimensionRegions[i];
++                        if (d->pSample) {
++                            int sampleIdx = sampleMap[d->pSample];
++                            int byte = 48 + sampleIdx / 8;
++                            int bit = 1 << (sampleIdx & 7);
++                            if ((pData[(instrumentIdx + 1) * sublen + byte] & bit) == 0) {
++                                pData[(instrumentIdx + 1) * sublen + byte] |= bit;
++                                nbusedsamples++;
++                                nbusedchannels += d->pSample->Channels;
++
++                                if ((pData[byte] & bit) == 0) {
++                                    pData[byte] |= bit;
++                                    totnbusedsamples++;
++                                    totnbusedchannels += d->pSample->Channels;
++                                }
++                            }
++                        }
++                    }
++                    nbdimregions += region->DimensionRegions;
++                }
++                // first 4 bytes unknown - sometimes 0, sometimes length of einf part
++                // store32(&pData[(instrumentIdx + 1) * sublen], sublen);
++                store32(&pData[(instrumentIdx + 1) * sublen + 4], nbusedchannels);
++                store32(&pData[(instrumentIdx + 1) * sublen + 8], nbusedsamples);
++                store32(&pData[(instrumentIdx + 1) * sublen + 12], 1);
++                store32(&pData[(instrumentIdx + 1) * sublen + 16], instrument->Regions);
++                store32(&pData[(instrumentIdx + 1) * sublen + 20], nbdimregions);
++                // next 12 bytes unknown
++                store32(&pData[(instrumentIdx + 1) * sublen + 36], instrumentIdx);
++                store32(&pData[(instrumentIdx + 1) * sublen + 40], pSamples->size());
++                // next 4 bytes unknown
++
++                totnbregions += instrument->Regions;
++                totnbdimregions += nbdimregions;
++                instrumentIdx++;
++            }
++            // first 4 bytes unknown - sometimes 0, sometimes length of einf part
++            // store32(&pData[0], sublen);
++            store32(&pData[4], totnbusedchannels);
++            store32(&pData[8], totnbusedsamples);
++            store32(&pData[12], Instruments);
++            store32(&pData[16], totnbregions);
++            store32(&pData[20], totnbdimregions);
++            // next 12 bytes unknown
++            // next 4 bytes unknown, always 0?
++            store32(&pData[40], pSamples->size());
++            // next 4 bytes unknown
++        }
++
++        // update 3crc chunk
++
++        // The 3crc chunk contains CRC-32 checksums for the
++        // samples. The actual checksum values will be filled in
++        // later, by Sample::Write.
++
++        RIFF::Chunk* _3crc = pRIFF->GetSubChunk(CHUNK_ID_3CRC);
++        if (_3crc) {
++            _3crc->Resize(pSamples->size() * 8);
++        } else if (newFile) {
++            _3crc = pRIFF->AddSubChunk(CHUNK_ID_3CRC, pSamples->size() * 8);
++            _3crc->LoadChunkData();
++        }
+     }
+ 
+ 
+Index: libgig/src/gig.h
+diff -u libgig/src/gig.h:1.42 libgig/src/gig.h:1.47
+--- libgig/src/gig.h:1.42	Sun Mar 18 07:13:06 2007
++++ libgig/src/gig.h	Sat May 26 13:59:40 2007
+@@ -38,6 +38,8 @@
+ # define CHUNK_ID_3EWG	0x33657767
+ # define CHUNK_ID_EWAV	0x65776176
+ # define CHUNK_ID_3GNM	0x33676E6D
++# define CHUNK_ID_EINF	0x65696E66
++# define CHUNK_ID_3CRC	0x33637263
+ #else  // little endian
+ # define LIST_TYPE_3PRG	0x67727033
+ # define LIST_TYPE_3EWL	0x6C776533
+@@ -50,6 +52,8 @@
+ # define CHUNK_ID_3EWG	0x67776533
+ # define CHUNK_ID_EWAV	0x76617765
+ # define CHUNK_ID_3GNM	0x6D6E6733
++# define CHUNK_ID_EINF	0x666E6965
++# define CHUNK_ID_3CRC	0x63726333
+ #endif // WORDS_BIGENDIAN
+ 
+ /** Gigasampler specific classes and definitions */
+@@ -319,6 +323,35 @@
+         progress_t();
+     };
+ 
++    /** @brief CRC-32 checksum implementation
++     *
++     * This class is used to calculate checksums of the sample data in
++     * a gig file. The checksums are stored in the 3crc chunk of the
++     * gig file and automatically updated when a sample is written
++     * with Sample::Write().
++     */
++    class CRC {
++    private:
++        uint32_t value;
++        static const uint32_t* table;
++        static uint32_t* initTable();
++    public:
++        CRC() {
++            reset();
++        }
++        void reset() {
++            value = 0xffffffff;
++        }
++        void update(unsigned char* buf, int len) {
++            for (int i = 0 ; i < len ; i++) {
++                value = table[(value ^ buf[i]) & 0xff] ^ (value >> 8);
++            }
++        }
++        uint32_t getValue() {
++            return value ^ 0xffffffff;
++        }
++    };
++
+     // just symbol prototyping
+     class File;
+     class Instrument;
+@@ -437,6 +470,9 @@
+             double GetVelocityAttenuation(uint8_t MIDIKeyVelocity);
+             double GetVelocityRelease(uint8_t MIDIKeyVelocity);
+             double GetVelocityCutoff(uint8_t MIDIKeyVelocity);
++            // derived methods
++            DLS::Sampler::AddSampleLoop;
++            DLS::Sampler::DeleteSampleLoop;
+             // overridden methods
+             virtual void UpdateChunks();
+         protected:
+@@ -496,6 +532,11 @@
+      * will create the mandatory RIFF chunk which will hold the sample wave
+      * data and / or resize the file so you will be able to Write() the
+      * sample data directly to disk.
++     *
++     * @e Caution: for gig synthesis, most looping relevant information are
++     * retrieved from the respective DimensionRegon instead from the Sample
++     * itself. This was made for allowing different loop definitions for the
++     * same sample under different conditions.
+      */
+     class Sample : public DLS::Sample {
+         public:
+@@ -506,14 +547,14 @@
+             uint32_t       FineTune;          ///< Specifies the fraction of a semitone up from the specified MIDI unity note field. A value of 0x80000000 means 1/2 semitone (50 cents) and a value of 0x00000000 means no fine tuning between semitones.
+             smpte_format_t SMPTEFormat;       ///< Specifies the Society of Motion Pictures and Television E time format used in the following <i>SMPTEOffset</i> field. If a value of 0 is set, <i>SMPTEOffset</i> should also be set to 0.
+             uint32_t       SMPTEOffset;       ///< The SMPTE Offset value specifies the time offset to be used for the synchronization / calibration to the first sample in the waveform. This value uses a format of 0xhhmmssff where hh is a signed value that specifies the number of hours (-23 to 23), mm is an unsigned value that specifies the number of minutes (0 to 59), ss is an unsigned value that specifies the number of seconds (0 to 59) and ff is an unsigned value that specifies the number of frames (0 to -1).
+-            uint32_t       Loops;             ///< Number of defined sample loops (so far only seen single loops in gig files - please report me if you encounter more!).
++            uint32_t       Loops;             ///< @e Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: Number of defined sample loops. So far only seen single loops in gig files - please report if you encounter more!)
+             uint32_t       LoopID;            ///< Specifies the unique ID that corresponds to one of the defined cue points in the cue point list (only if Loops > 0), as the Gigasampler format only allows one loop definition at the moment, this attribute isn't really useful for anything.
+-            loop_type_t    LoopType;          ///< The type field defines how the waveform samples will be looped (only if Loops > 0).
+-            uint32_t       LoopStart;         ///< The start value specifies the offset (in sample points) in the waveform data of the first sample to be played in the loop (only if Loops > 0).
+-            uint32_t       LoopEnd;           ///< The end value specifies the offset (in sample points) in the waveform data which represents the end of the loop (only if Loops > 0).
+-            uint32_t       LoopSize;          ///< Length of the looping area (in sample points) which is equivalent to <i>LoopEnd - LoopStart</i>.
+-            uint32_t       LoopFraction;      ///< The fractional value specifies a fraction of a sample at which to loop (only if Loops > 0). This allows a loop to be fine tuned at a resolution greater than one sample. A value of 0 means no fraction, a value of 0x80000000 means 1/2 of a sample length. 0xFFFFFFFF is the smallest fraction of a sample that can be represented.
+-            uint32_t       LoopPlayCount;     ///< Number of times the loop should be played (only if Loops > 0, a value of 0 = infinite).
++            loop_type_t    LoopType;          ///< @e Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: The type field defines how the waveform samples will be looped.)
++            uint32_t       LoopStart;         ///< @e Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: The start value specifies the offset [in sample points] in the waveform data of the first sample to be played in the loop [only if Loops > 0].)
++            uint32_t       LoopEnd;           ///< @e Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: The end value specifies the offset [in sample points] in the waveform data which represents the end of the loop [only if Loops > 0].)
++            uint32_t       LoopSize;          ///< @e Caution: Use the respective fields in the DimensionRegion instead of this one! (Intended purpose: Length of the looping area [in sample points] which is equivalent to @code LoopEnd - LoopStart @endcode.)
++            uint32_t       LoopFraction;      ///< The fractional value specifies a fraction of a sample at which to loop. This allows a loop to be fine tuned at a resolution greater than one sample. A value of 0 means no fraction, a value of 0x80000000 means 1/2 of a sample length. 0xFFFFFFFF is the smallest fraction of a sample that can be represented.
++            uint32_t       LoopPlayCount;     ///< Number of times the loop should be played (a value of 0 = infinite).
+             bool           Compressed;        ///< If the sample wave is compressed (probably just interesting for instrument and sample editors, as this library already handles the decompression in it's sample access methods anyway).
+             uint32_t       TruncatedBits;     ///< For 24-bit compressed samples only: number of bits truncated during compression (0, 4 or 6)
+             bool           Dithered;          ///< For 24-bit compressed samples only: if dithering was used during compression with bit reduction
+@@ -551,6 +592,7 @@
+             unsigned long        FileNo;                  ///< File number (> 0 when sample is stored in an extension file, 0 when it's in the gig)
+             RIFF::Chunk*         pCk3gix;
+             RIFF::Chunk*         pCkSmpl;
++            CRC                  crc;                     ///< CRC-32 checksum of the raw sample data
+ 
+             Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo = 0);
+            ~Sample();
+@@ -687,6 +729,9 @@
+     /** Parses Gigasampler files and provides abstract access to the data. */
+     class File : protected DLS::File {
+         public:
++            static const DLS::version_t VERSION_2;
++            static const DLS::version_t VERSION_3;
++
+             // derived attributes from DLS::Resource
+             DLS::Resource::pInfo;
+             DLS::Resource::pDLSID;
+@@ -726,10 +771,12 @@
+             // own protected methods
+             virtual void LoadSamples(progress_t* pProgress);
+             virtual void LoadInstruments(progress_t* pProgress);
++            void SetSampleChecksum(Sample* pSample, uint32_t crc);
+             friend class Region;
+             friend class Sample;
+             friend class Group; // so Group can access protected member pRIFF
+         private:
++            static const DLS::Info::FixedStringLength FixedStringLengths[];
+             std::list<Group*>*          pGroups;
+             std::list<Group*>::iterator GroupsIterator;
+     };
+Index: libgig/src/helper.h
+diff -u libgig/src/helper.h:1.4 libgig/src/helper.h:1.6
+--- libgig/src/helper.h:1.4	Fri Nov 24 12:50:05 2006
++++ libgig/src/helper.h	Sat May 12 12:39:25 2007
+@@ -48,6 +48,30 @@
+ }
+ 
+ /**
++ * Stores a 16 bit integer in memory using little-endian format.
++ *
++ * @param pData - memory pointer
++ * @param data  - integer to be stored
++ */
++inline void store16(uint8_t* pData, uint16_t data) {
++    pData[0] = data;
++    pData[1] = data >> 8;
++}
++
++/**
++ * Stores a 32 bit integer in memory using little-endian format.
++ *
++ * @param pData - memory pointer
++ * @param data  - integer to be stored
++ */
++inline void store32(uint8_t* pData, uint32_t data) {
++    pData[0] = data;
++    pData[1] = data >> 8;
++    pData[2] = data >> 16;
++    pData[3] = data >> 24;
++}
++
++/**
+  * Swaps the order of the data words in the given memory area
+  * with a granularity given by \a WordSize.
+  *
+@@ -144,7 +168,7 @@
+         ck->Resize(size);
+         char* pData = (char*) ck->LoadChunkData();
+         strncpy(pData, s.c_str(), size);
+-    } else if (s != "" || sDefault != "") { // create chunk
++    } else if (s != "" || sDefault != "" || bUseFixedLengthStrings) { // create chunk
+         const std::string& sToSave = (s != "") ? s : sDefault;
+         if (!bUseFixedLengthStrings) size = sToSave.size() + 1;
+         ck = lstINFO->AddSubChunk(ChunkID, size);
+Index: libgig/win32/Makefile.am
+diff -u libgig/win32/Makefile.am:1.1 libgig/win32/Makefile.am:1.2
+--- libgig/win32/Makefile.am:1.1	Sat Mar 24 18:20:09 2007
++++ libgig/win32/Makefile.am	Sun May 13 19:03:34 2007
+@@ -1,6 +1,6 @@
+ ## Process this file with automake to produce Makefile.in
+ 
+-# include debian files into distribution
++# include win32 project files into distribution
+ EXTRA_DIST = dllmain.cpp \
+              dlsdump.dev \
+              gigdump.dev \
+Index: libgig/win32/libgig.dev
+diff -u libgig/win32/libgig.dev:1.3 libgig/win32/libgig.dev:removed
+--- libgig/win32/libgig.dev:1.3	Sat Mar 24 11:55:06 2007
++++ libgig/win32/libgig.dev	Mon Jun 11 06:25:50 2007
+@@ -1,89 +0,0 @@
+-[Project]
+-FileName=libgig.dev
+-Name=gig
+-UnitCount=4
+-Type=3
+-Ver=1
+-ObjFiles=
+-Includes=
+-Libs=
+-PrivateResource=libgig_private.rc
+-ResourceIncludes=
+-MakeIncludes=
+-Compiler=-DBUILDING_DLL=1_@@_
+-CppCompiler=-DBUILDING_DLL=1_@@_
+-Linker=--export-all-symbols --add-stdcall-alias_@@_ -fpic
+-IsCpp=1
+-Icon=
+-ExeOutput=
+-ObjectOutput=
+-OverrideOutput=0
+-OverrideOutputName=libgig.dll
+-HostApplication=
+-Folders=
+-CommandLine=
+-UseCustomMakefile=0
+-CustomMakefile=
+-IncludeVersionInfo=1
+-SupportXPThemes=0
+-CompilerSet=0
+-CompilerSettings=0000000000000000000000
+-
+-[Unit1]
+-FileName=dllmain.cpp
+-CompileCpp=1
+-Folder=
+-Compile=1
+-Link=1
+-Priority=1000
+-OverrideBuildCmd=0
+-BuildCmd=
+-
+-[Unit2]
+-FileName=..\src\RIFF.cpp
+-CompileCpp=1
+-Folder=libgig
+-Compile=1
+-Link=1
+-Priority=1000
+-OverrideBuildCmd=0
+-BuildCmd=
+-
+-[Unit3]
+-FileName=..\src\DLS.cpp
+-CompileCpp=1
+-Folder=libgig
+-Compile=1
+-Link=1
+-Priority=1000
+-OverrideBuildCmd=0
+-BuildCmd=
+-
+-[Unit4]
+-FileName=..\src\gig.cpp
+-CompileCpp=1
+-Folder=libgig
+-Compile=1
+-Link=1
+-Priority=1000
+-OverrideBuildCmd=0
+-BuildCmd=
+-
+-[VersionInfo]
+-Major=3
+-Minor=1
+-Release=1
+-Build=0
+-LanguageID=1033
+-CharsetID=1252
+-CompanyName=The LinuxSampler Project
+-FileVersion=
+-FileDescription=Gigasampler format file access library
+-InternalName=
+-LegalCopyright=(c) 2003-2007 Christian Schoenebeck
+-LegalTrademarks=
+-OriginalFilename=
+-ProductName=libgig
+-ProductVersion=
+-AutoIncBuildNr=0
+-
+Index: libgig/win32/libgig.dev.in
+diff -u /dev/null libgig/win32/libgig.dev.in:1.2
+--- /dev/null	Mon Jun 11 06:25:50 2007
++++ libgig/win32/libgig.dev.in	Sun May 27 13:54:24 2007
+@@ -0,0 +1,89 @@
++[Project]
++FileName=libgig.dev
++Name=gig
++UnitCount=4
++Type=3
++Ver=1
++ObjFiles=
++Includes=
++Libs=
++PrivateResource=libgig_private.rc
++ResourceIncludes=
++MakeIncludes=
++Compiler=-DBUILDING_DLL=1_@@_
++CppCompiler=-DBUILDING_DLL=1_@@_
++Linker=--export-all-symbols --add-stdcall-alias_@@_ -fpic -lrpcrt4_@@_
++IsCpp=1
++Icon=
++ExeOutput=
++ObjectOutput=
++OverrideOutput=0
++OverrideOutputName=libgig.dll
++HostApplication=
++Folders=
++CommandLine=
++UseCustomMakefile=0
++CustomMakefile=
++IncludeVersionInfo=1
++SupportXPThemes=0
++CompilerSet=0
++CompilerSettings=0000000000000000000000
++
++[Unit1]
++FileName=dllmain.cpp
++CompileCpp=1
++Folder=
++Compile=1
++Link=1
++Priority=1000
++OverrideBuildCmd=0
++BuildCmd=
++
++[Unit2]
++FileName=..\src\RIFF.cpp
++CompileCpp=1
++Folder=libgig
++Compile=1
++Link=1
++Priority=1000
++OverrideBuildCmd=0
++BuildCmd=
++
++[Unit3]
++FileName=..\src\DLS.cpp
++CompileCpp=1
++Folder=libgig
++Compile=1
++Link=1
++Priority=1000
++OverrideBuildCmd=0
++BuildCmd=
++
++[Unit4]
++FileName=..\src\gig.cpp
++CompileCpp=1
++Folder=libgig
++Compile=1
++Link=1
++Priority=1000
++OverrideBuildCmd=0
++BuildCmd=
++
++[VersionInfo]
++Major=@LIBGIG_RELEASE_MAJOR@
++Minor=@LIBGIG_RELEASE_MINOR@
++Release=@LIBGIG_RELEASE_BUILD@
++Build=0
++LanguageID=1033
++CharsetID=1252
++CompanyName=The LinuxSampler Project
++FileVersion=
++FileDescription=Gigasampler format file access library
++InternalName=
++LegalCopyright=(c) 2003-2007 Christian Schoenebeck
++LegalTrademarks=
++OriginalFilename=
++ProductName=libgig
++ProductVersion=
++AutoIncBuildNr=0
++

Modified: libgig/trunk/debian/rules
===================================================================
--- libgig/trunk/debian/rules	2007-06-12 10:20:19 UTC (rev 1469)
+++ libgig/trunk/debian/rules	2007-06-12 10:38:50 UTC (rev 1470)
@@ -20,7 +20,7 @@
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
-CFLAGS = -Wall -g -O3 -march=athlon -mmmx -msse -ffast-math -funroll-loops -fomit-frame-pointer -fpermissive -mfpmath=sse
+CFLAGS = -Wall -g
 
 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
 	CFLAGS += -g
@@ -28,6 +28,9 @@
 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
 	INSTALL_PROGRAM += -s
 endif
+ifneq (,$(findstring athopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O3 -march=athlon -mmmx -msse -ffast-math -funroll-loops -fomit-frame-pointer -fpermissive -mfpmath=sse
+endif
 
 config.status: patch-stamp
 	dh_testdir
@@ -39,7 +42,6 @@
 endif
 	CXXFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
 
-
 build: build-stamp
 build-stamp:  config.status
 	dh_testdir




More information about the Demudi-commits mailing list