Hi,

http://sourceforge.net/tracker/index.php?func=detail&aid=1222951&group_id=5056&atid=105056

gives u a possible solution.

I applied the patch to upstream source, and generated a patch valid for 
rezound_0.12.0beta-2 from unstable.

You can find this also in ubuntu: 
http://bugzilla.ubuntu.com/show_bug.cgi?id=10031

Another patch is applied by me, cause of missing forward class decl.

diff -ur rezound-0.12.0beta/src/backend/CrezSoundTranslator.cpp rezound-0.12.0beta.patch/src/backend/CrezSoundTranslator.cpp
--- rezound-0.12.0beta/src/backend/CrezSoundTranslator.cpp	2005-05-01 04:53:40.000000000 +0200
+++ rezound-0.12.0beta.patch/src/backend/CrezSoundTranslator.cpp	2005-07-24 13:47:38.638368856 +0200
@@ -353,7 +353,8 @@
 			{
 				// read packed version into p
 				RFormatInfo1::PackedChunk p;
-				loadFromFile.getPoolAccesser<RFormatInfo1::PackedChunk>("Format Info").read(&p,1);
+				// loadFromFile.getPoolAccesser<RFormatInfo1::PackedChunk>("Format Info").read(&p,1);
+				loadFromFile.readPoolRaw("Format Info",&p,sizeof(p));
 
 				// unpack from p into r
 				RFormatInfo1 r;
@@ -375,7 +376,8 @@
 			{
 				// read packed version into p
 				RFormatInfo2::PackedChunk p;
-				loadFromFile.getPoolAccesser<RFormatInfo2::PackedChunk>("Format Info").read(&p,1);
+				//loadFromFile.getPoolAccesser<RFormatInfo2::PackedChunk>("Format Info").read(&p,1);
+				loadFromFile.readPoolRaw("Format Info",&p,sizeof(p));
 
 				// unpack from p into r
 				RFormatInfo2 r;
@@ -397,7 +399,8 @@
 			{
 				// read packed version into p
 				RFormatInfo3::PackedChunk p;
-				loadFromFile.getPoolAccesser<RFormatInfo3::PackedChunk>("Format Info").read(&p,1);
+				// loadFromFile.getPoolAccesser<RFormatInfo3::PackedChunk>("Format Info").read(&p,1);
+				loadFromFile.readPoolRaw("Format Info",&p,sizeof(p));
 
 				// unpack values from p into r
 				RFormatInfo3 r;
@@ -450,6 +453,7 @@
 			// have to write the cues into a packed byte array because 
 			// simply reading/writing a struct on different platforms can 
 			// yield different word alignments and padding  (the easiest thing to do would have been to use gcc __attribute__ ((packed)) on the structs, but I would only do that if I knew this extension existed on all compilers (maybe ANSI C will adopted this one day) ???)
+			/* doesn't work with gcc4 anymore
 			const CPackedCueAccesser srcCues=loadFromFile.getPoolAccesser<CSound::RCue::PackedChunk>("Cues");
 			sound->cueAccesser->clear();
 			sound->cueAccesser->seek(0);
@@ -462,6 +466,16 @@
 				cue.unpack(r);
 				sound->cueAccesser->write(&cue,1,true);
 			}
+			*/
+			CSound::RCue::PackedChunk cueData;
+			for(size_t t=0;t<loadFromFile.getPoolSize("Cues");t+=sizeof(cueData))
+			{
+				loadFromFile.readPoolRaw("Cues",&cueData,sizeof(cueData),t);
+				CSound::RCue cue;
+				cue.unpack(cueData);
+				sound->cueAccesser->write(&cue,1,true);
+			}
+						
 			sound->rebuildCueIndex();
 		}
 
@@ -644,9 +658,13 @@
 
 		RFormatInfo3::PackedChunk p;
 		formatInfo3.pack(p);
-
+		/* doesn't work with gcc4 anymore
 		CFormatInfo3PoolAccesser a=saveToFile.createPool<RFormatInfo3::PackedChunk>("Format Info");
 		a.write(&p,1,true);
+		*/
+		TPoolAccesser<uint8_t,CSound::PoolFile_t> a(saveToFile.createPool<uint8_t>("Format Info"));
+		a.write((const uint8_t *)&p,sizeof(p),true);
+		
 	}
 
 	// write the output routing information
@@ -656,6 +674,7 @@
 	// write the cues
 	{
 		// unless we're converting sample rates here, the sample positions in sound's cues are valid for saving
+		/* doesn't work with gcc4 anymore
 		CPackedCueAccesser destCues=saveToFile.createPool<CSound::RCue::PackedChunk>("Cues");
 		for(size_t t=0;t<sound->getCueCount();t++)
 		{
@@ -666,6 +685,18 @@
 				destCues.write(&r,1,true);
 			}
 		}
+		*/
+		TPoolAccesser<uint8_t,CSound::PoolFile_t> destCues=saveToFile.createPool<uint8_t>("Cues");
+		for(size_t t=0;t<sound->getCueCount();t++)
+		{
+			if(sound->getCueTime(t)>=saveStart && sound->getCueTime(t)<(saveStart+saveLength))
+			{
+				CSound::RCue::PackedChunk r;
+				(*(sound->cueAccesser))[t].pack(r);
+				destCues.write((const uint8_t *)&r,sizeof(r),true);
+			}
+		}
+
 	}
 	
 
diff -ur rezound-0.12.0beta/src/backend/CSoundPlayerChannel.cpp rezound-0.12.0beta.patch/src/backend/CSoundPlayerChannel.cpp
--- rezound-0.12.0beta/src/backend/CSoundPlayerChannel.cpp	2005-07-24 13:10:53.511599080 +0200
+++ rezound-0.12.0beta.patch/src/backend/CSoundPlayerChannel.cpp	2005-07-24 13:32:03.564521688 +0200
@@ -846,8 +846,12 @@
 		{
 			// pos1 is selectStart; pos2 is selectStop
 #define min_xy(x,y) x < y ? x : y
-			pos1=min_xy((sample_pos_t)startPosition,(long)sound->getLength()-1);
-			pos2=min_xy(stopPosition,sound->getLength()-1);
+			sample_pos_t t;
+			// pos1 is selectStart; pos2 is selectStop
+			t=startPosition;
+			pos1=min(t,sound->getLength()-1);
+			t=stopPosition;
+			pos2=min(t,sound->getLength()-1);
 		}
 		else
 		{
diff -ur rezound-0.12.0beta/src/PoolFile/TPoolFile.cpp rezound-0.12.0beta.patch/src/PoolFile/TPoolFile.cpp
--- rezound-0.12.0beta/src/PoolFile/TPoolFile.cpp	2005-05-01 04:53:39.000000000 +0200
+++ rezound-0.12.0beta.patch/src/PoolFile/TPoolFile.cpp	2005-07-24 13:28:55.326138272 +0200
@@ -494,26 +494,50 @@
 
 
 template<class l_addr_t,class p_addr_t>
-	l_addr_t TPoolFile<l_addr_t,p_addr_t>::readPoolRaw(const poolId_t poolId,void *buffer,l_addr_t readSize)
+	l_addr_t TPoolFile<l_addr_t,p_addr_t>::readPoolRaw(const poolId_t poolId,void *buffer,l_addr_t readSize,l_addr_t pos)
 {
 	if(!opened)
 		throw runtime_error(string(__func__)+" -- no file is open");
 	if(!isValidPoolId(poolId))
 		throw runtime_error(string(__func__)+" -- invalid poolId parameter: "+istring(poolId));
 
-	const TStaticPoolAccesser<uint8_t,TPoolFile<l_addr_t,p_addr_t> > accesser(const_cast<TPoolFile<l_addr_t,p_addr_t> *>(this),poolId);
-	readSize=min(readSize,accesser.getSize());
+	
+	TStaticPoolAccesser<uint8_t,TPoolFile<l_addr_t,p_addr_t> > accesser(const_cast<TPoolFile<l_addr_t,p_addr_t> *>(this),poolId);
+	accesser.seek(pos);
+	readSize=min(readSize,accesser.getSize()-pos);
 	accesser.read((uint8_t *)buffer,readSize);
 	return readSize;
 }
 
 template<class l_addr_t,class p_addr_t>
-	l_addr_t TPoolFile<l_addr_t,p_addr_t>::readPoolRaw(const string poolName,void *buffer,l_addr_t readSize)
+	l_addr_t TPoolFile<l_addr_t,p_addr_t>::readPoolRaw(const string poolName,void *buffer,l_addr_t readSize,l_addr_t pos)
 {
-	return readPoolRaw(getPoolIdByName(poolName),buffer,readSize);
+	return readPoolRaw(getPoolIdByName(poolName),buffer,readSize,pos);
 }
 
 template<class l_addr_t,class p_addr_t>
+	l_addr_t TPoolFile<l_addr_t,p_addr_t>::writePoolRaw(const poolId_t poolId,void *buffer,l_addr_t writeSize,l_addr_t pos)
+{
+	if(!opened)
+               throw runtime_error(string(__func__)+" -- no file is open");
+       if(!isValidPoolId(poolId))
+               throw runtime_error(string(__func__)+" -- invalid poolId parameter: "+istring(poolId));
+
+       TStaticPoolAccesser<uint8_t,TPoolFile<l_addr_t,p_addr_t> > accesser(const_cast<TPoolFile<l_addr_t,p_addr_t> *>(this),poolId);
+       accesser.seek(pos);
+       writeSize=min(writeSize,accesser.getSize()-pos);
+       accesser.write((uint8_t *)buffer,writeSize);
+       return writeSize;
+ }
+
+ template<class l_addr_t,class p_addr_t>
+       l_addr_t TPoolFile<l_addr_t,p_addr_t>::writePoolRaw(const string poolName,void *buffer,l_addr_t writeSize,l_addr_t pos)
+ {
+       return writePoolRaw(getPoolIdByName(poolName),buffer,writeSize,pos);
+ }
+
+
+template<class l_addr_t,class p_addr_t>
 	template<class pool_element_t> TStaticPoolAccesser<pool_element_t,TPoolFile<l_addr_t,p_addr_t> > TPoolFile<l_addr_t,p_addr_t>::createPool(const string poolName,const bool throwOnExistance)
 {
 	if(!opened)
diff -ur rezound-0.12.0beta/src/PoolFile/TPoolFile.h rezound-0.12.0beta.patch/src/PoolFile/TPoolFile.h
--- rezound-0.12.0beta/src/PoolFile/TPoolFile.h	2005-05-01 04:53:39.000000000 +0200
+++ rezound-0.12.0beta.patch/src/PoolFile/TPoolFile.h	2005-07-24 13:28:33.033527264 +0200
@@ -119,8 +119,13 @@
 	template<class pool_element_t> const TStaticPoolAccesser<pool_element_t,TPoolFile<l_addr_t,p_addr_t> > getPoolAccesser(const string poolName) const;
 
 	// these methods can be used to read raw data from a pool disregarding the alignment of the pool
-	l_addr_t readPoolRaw(const poolId_t poolId,void *buffer,l_addr_t readSize);
-	l_addr_t readPoolRaw(const string poolName,void *buffer,l_addr_t readSize);
+	l_addr_t readPoolRaw(const poolId_t poolId,void *buffer,l_addr_t readSize,l_addr_t pos=0);
+	l_addr_t readPoolRaw(const string poolName,void *buffer,l_addr_t readSize,l_addr_t pos=0);
+
+	// these methods can be used to write raw data to a pool disregarding the alignment of the pool (the pool must already be the correct size before writing)
+	l_addr_t writePoolRaw(const poolId_t poolId,void *buffer,l_addr_t writeSize,l_addr_t pos=0);
+	l_addr_t writePoolRaw(const string poolName,void *buffer,l_addr_t writeSize,l_addr_t pos=0);
+
 
 
 	// pool information/managment methods
diff -ur rezound-0.12.0beta/src/frontend_fox/FXGraphParamValue.h rezound-0.12.0beta.patch/src/frontend_fox/FXGraphParamValue.h
--- rezound-0.12.0beta/src/frontend_fox/FXGraphParamValue.h	2005-05-01 04:54:05.000000000 +0200
+++ rezound-0.12.0beta.patch/src/frontend_fox/FXGraphParamValue.h	2005-07-24 13:59:51.702926104 +0200
@@ -33,6 +33,8 @@
 
 class FXGraphParamNode;
 class CNestedDataFile;
+class CHorzRuler;
+class CVertRuler;
 
 /*
  * This can be constructed to be a widget for drawing a curve as a parameter

Attachment: pgp9vHxitB6ZX.pgp
Description: PGP signature

Reply via email to