Previous Thread
Next Thread
Print Thread
Page 1 of 55 1 2 3 54 55
#35061 - 10/28/07 04:16 AM AO SDK release 1.0 available  
Joined: Mar 2001
Posts: 15,752
R. Belmont Online content
R. Belmont  Online Content

Very Senior Member

Joined: Mar 2001
Posts: 15,752
USA
At my new page.

This release 1.0 includes:
- The actual QSF and SSF engines from Audio Overload
- A small commandline test app which demonstrates how to drive the engines
- A makefile for Linux and MinGW (it autodetects which)

More formats can be made available in future SDKs, please request which ones and I'll do what I can, licenses permitting.

#35062 - 10/28/07 05:37 AM Re: AO SDK release 1.0 available [Re: R. Belmont]  
Joined: Sep 2007
Posts: 56
kingshriek Offline
Member
kingshriek  Offline
Member

Joined: Sep 2007
Posts: 56
Excellent! I know I'll have a lot of fun tinkering around with the SSF engine.

Here's a patch I came up with to handle the 16-bit PCM problem I mentioned in another thread:

Code:
diff -Nru aosdk/eng_ssf/scsp.c aosdk_new/eng_ssf/scsp.c
--- aosdk/eng_ssf/scsp.c	2007-10-26 19:43:32.000000000 -0700
+++ aosdk_new/eng_ssf/scsp.c	2007-10-27 22:23:38.000000000 -0700
@@ -400,7 +400,8 @@
 {
 	slot->active=1;
 	slot->Backwards=0;
-	slot->base=SCSP->SCSPRAM+SA(slot);
+	UINT32 start_offset = PCM8B(slot) ? SA(slot) : SA(slot) & 0x7FFFE;
+	slot->base=SCSP->SCSPRAM + start_offset;
 	slot->cur_addr=0;
 	slot->step=SCSP_Step(slot);
 	Compute_EG(SCSP,slot);



Example ssf which the patch affects ---> http://h1.ripway.com/kingshriek/sakutai2_47.zip

#35063 - 10/28/07 05:42 AM Re: AO SDK release 1.0 available [Re: kingshriek]  
Joined: Mar 2001
Posts: 15,752
R. Belmont Online content
R. Belmont  Online Content

Very Senior Member

Joined: Mar 2001
Posts: 15,752
USA
Fantastic. I was hoping you'd have some fun with that smile

#35068 - 10/28/07 09:59 AM Re: AO SDK release 1.0 available [Re: R. Belmont]  
Joined: Sep 2007
Posts: 56
kingshriek Offline
Member
kingshriek  Offline
Member

Joined: Sep 2007
Posts: 56
And here's a patch for ssf_gen.c for loading multiple ssflibs (necessary for Shining the Holy Ark):

Code:
diff -Nru aosdk/eng_ssf/eng_ssf.c aosdk_new/eng_ssf/eng_ssf.c
--- aosdk/eng_ssf/eng_ssf.c	2007-10-27 16:24:22.000000000 -0700
+++ aosdk_new/eng_ssf/eng_ssf.c	2007-10-28 02:53:01.000000000 -0700
@@ -48,6 +48,7 @@
 	uint32 offset, plength;
 	uint64 file_len, lib_len, lib_raw_length;
 	corlett_t *lib;
+	char *libfile;
 	int i;
 
 	// clear Saturn work RAM before we start scribbling in it
@@ -64,34 +65,37 @@
 	#endif
 
 	// Get the library file, if any
-	if (c->lib[0] != 0)
-	{
-		uint64 tmp_length;
-	
-		#if DEBUG_LOADER	
-		printf("Loading library: %s\n", c->lib);
-		#endif
-		if (ao_get_lib(c->lib, &lib_raw_file, &tmp_length) != AO_SUCCESS)
+	for (i=0; i<9; i++) {
+		libfile = i ? c->libaux[i-1] : c->lib;
+		if (libfile[0] != 0)
 		{
-			return AO_FAIL;
-		}
-		lib_raw_length = tmp_length;
+			uint64 tmp_length;
+	
+			#if DEBUG_LOADER	
+			printf("Loading library: %s\n", c->lib);
+			#endif
+			if (ao_get_lib(libfile, &lib_raw_file, &tmp_length) != AO_SUCCESS)
+			{
+				return AO_FAIL;
+			}
+			lib_raw_length = tmp_length;
 		
-		if (corlett_decode(lib_raw_file, lib_raw_length, &lib_decoded, &lib_len, &lib) != AO_SUCCESS)
-		{
-			free(lib_raw_file);
-			return AO_FAIL;
-		}
+			if (corlett_decode(lib_raw_file, lib_raw_length, &lib_decoded, &lib_len, &lib) != AO_SUCCESS)
+			{
+				free(lib_raw_file);
+				return AO_FAIL;
+			}
 				
-		// Free up raw file
-		free(lib_raw_file);
+			// Free up raw file
+			free(lib_raw_file);
 
-		// patch the file into ram
-		offset = lib_decoded[0] | lib_decoded[1]<<8 | lib_decoded[2]<<16 | lib_decoded[3]<<24;
-		memcpy(&sat_ram[offset], lib_decoded+4, lib_len-4);
+			// patch the file into ram
+			offset = lib_decoded[0] | lib_decoded[1]<<8 | lib_decoded[2]<<16 | lib_decoded[3]<<24;
+			memcpy(&sat_ram[offset], lib_decoded+4, lib_len-4);
 
-		// Dispose the corlett structure for the lib - we don't use it
-		free(lib);
+			// Dispose the corlett structure for the lib - we don't use it
+			free(lib);
+		}
 	}
 
 	// now patch the file into RAM over the libraries
@@ -104,7 +108,6 @@
 	strcpy(psfby, "n/a");
 	if (c)
 	{
-		int i;
 		for (i = 0; i < MAX_UNKNOWN_TAGS; i++)
 		{
 			if (!strcasecmp(c->tag_name[i], "psfby"))

#35112 - 10/29/07 04:14 AM Re: AO SDK release 1.0 available [Re: kingshriek]  
Joined: Mar 2001
Posts: 15,752
R. Belmont Online content
R. Belmont  Online Content

Very Senior Member

Joined: Mar 2001
Posts: 15,752
USA
Thanks, I've applied both patches.

#35465 - 11/06/07 04:59 AM Re: AO SDK release 1.1 available [Re: R. Belmont]  
Joined: Mar 2001
Posts: 15,752
R. Belmont Online content
R. Belmont  Online Content

Very Senior Member

Joined: Mar 2001
Posts: 15,752
USA
Release 1.1 is now available.

This includes the 2 SSF patches above and 3 new engines: .PSF, .PSF2, and .SPU. Plus known good sample songs are now included.

Last edited by R. Belmont; 11/06/07 04:59 AM.
#35512 - 11/07/07 08:06 AM Re: AO SDK release 1.1 available [Re: R. Belmont]  
Joined: Oct 2007
Posts: 13
KBeazley Offline
Member
KBeazley  Offline
Member

Joined: Oct 2007
Posts: 13
Interesting.. So this is the source code (or part of it) for the current version of AO ?..

#35743 - 11/15/07 04:59 AM Re: AO SDK release 1.1 available [Re: KBeazley]  
Joined: Sep 2007
Posts: 56
kingshriek Offline
Member
kingshriek  Offline
Member

Joined: Sep 2007
Posts: 56
Well, I investigated the SCSP envelope processing a bit, and I found a bug in the SCSP emulation that's causing the envelope state machine to immediately exit the DECAY1 state upon entering - the comparison operator in the ATTACK-->DECAY1 step is backwards!

I have another patch that incorporates this fix as well as some others. I added (or at least attempted to add) support for LPSLNK and SBCTL. I also fixed a minor panning bug (now both left- and right- stereo channels are fully attenuated when the four least significant bits are set) and put in something more reasonable when key-rate scaling isn't used (it only makes sense to add in bit 9 of FNS when OCT is there as well).

Here's the patch (against AOSDK 1.1):

Code:
--- aosdk_base\eng_ssf\scsp.c	2007-11-05 23:43:58.000000000 -0800
+++ aosdk\eng_ssf\scsp.c	2007-11-14 20:57:03.000000000 -0800
@@ -316,7 +316,7 @@
 	if(KRS(slot)!=0xf)
 		rate=2*(octave+KRS(slot))+((FNS(slot)>>9)&1);
 	else
-		rate=((FNS(slot)>>9)&1);
+		rate=0; //rate=((FNS(slot)>>9)&1);
 
 	slot->EG.volume=0;
 	slot->EG.AR=Get_AR(SCSP,rate,AR(slot));
@@ -337,9 +337,12 @@
 			slot->EG.volume+=slot->EG.AR;
 			if(slot->EG.volume>=(0x3ff<<EG_SHIFT))
 			{
-				slot->EG.state=DECAY1;
-				if(slot->EG.D1R>=(1024<<EG_SHIFT)) //Skip DECAY1, go directly to DECAY2
-					slot->EG.state=DECAY2;
+				if (!LPSLNK(slot)) 
+				{
+					slot->EG.state=DECAY1;
+					if(slot->EG.D1R>=(1024<<EG_SHIFT)) //Skip DECAY1, go directly to DECAY2
+						slot->EG.state=DECAY2;
+				}
 				slot->EG.volume=0x3ff<<EG_SHIFT;
 			}
 			if(slot->EG.EGHOLD)
@@ -347,7 +350,7 @@
 			break;
 		case DECAY1:
 			slot->EG.volume-=slot->EG.D1R;
-			if(slot->EG.volume>>(EG_SHIFT+5)>=slot->EG.DL)
+			if(slot->EG.volume>>(EG_SHIFT+5)<=slot->EG.DL)
 				slot->EG.state=DECAY2;
 			break;
 		case DECAY2:
@@ -412,6 +415,7 @@
 	Compute_LFO(slot);
 
 //	printf("StartSlot: SA %x PCM8B %x LPCTL %x ALFOS %x STWINH %x TL %x EFSDL %x\n", SA(slot), PCM8B(slot), LPCTL(slot), ALFOS(slot), STWINH(slot), TL(slot), EFSDL(slot));
+//	printf("           AR %x D1R %x D2R %x RR %x DL %x KRS %x EGHOLD %x LPSLNK %x\n", AR(slot), D1R(slot), D2R(slot), RR(slot), DL(slot), KRS(slot), EGHOLD(slot), LPSLNK(slot));
 }
 
 static void SCSP_StopSlot(struct _SLOT *slot,int keyoff)
@@ -498,7 +502,7 @@
 		if(iPAN&0x4) SegaDB-=12;
 		if(iPAN&0x8) SegaDB-=24;
 
-		if(iPAN==0xf) PAN=0.0;
+		if(iPAN&0xf==0xf) PAN=0.0;
 		else PAN=pow(10.0,SegaDB/20.0);
 
 		if(iPAN<0x10)
@@ -1104,6 +1108,12 @@
 			addr&=0x7ffff;
 	}
 
+	if(addr==LSA(slot))
+	{
+		if(LPSLNK(slot) && slot->EG.state==ATTACK)
+			slot->EG.state = DECAY1;
+	}
+
 	if(PCM8B(slot))	//8 bit signed
 	{
 		INT8 *p=(signed char *) (slot->base+(addr));
@@ -1115,6 +1125,11 @@
 		sample=LE16(p[0]);
 	}
 
+	if(SBCTL(slot)&0x1)
+		sample ^= 0x7FFF;
+	if(SBCTL(slot)&0x2)
+		sample = (INT16)(sample^0x8000);
+
 	if(slot->Backwards)
 		slot->cur_addr-=step;
 	else


#35744 - 11/15/07 05:06 AM Re: AO SDK release 1.1 available [Re: kingshriek]  
Joined: Mar 2001
Posts: 15,752
R. Belmont Online content
R. Belmont  Online Content

Very Senior Member

Joined: Mar 2001
Posts: 15,752
USA
KB: Yes, this is the actual file-format engine code from AO with a stripped down frontend I wrote from scratch.

kingshriek: thank you very much!

#36122 - 12/01/07 02:21 PM Re: AO SDK release 1.1.1 available [Re: R. Belmont]  
Joined: Mar 2001
Posts: 15,752
R. Belmont Online content
R. Belmont  Online Content

Very Senior Member

Joined: Mar 2001
Posts: 15,752
USA
Version 1.1.1 of the SDK has been posted. This includes the latest SCSP and SSF fixes from kingshriek.

Page 1 of 55 1 2 3 54 55

Moderated by  R. Belmont, Richard Bannister 

Who's Online Now
4 registered members (R. Belmont, Dam0, ssj, AJR), 14 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,436
Posts109,394
Members4,764
Most Online225
May 26th, 2014
Powered by UBB.threads™ PHP Forum Software 7.6.0
Page Time: 0.028s Queries: 14 (0.008s) Memory: 5.0280 MB (Peak: 5.2572 MB) Zlib enabled. Server Time: 2017-11-20 03:51:50 UTC