Prev Previous Post   Next Post Next
Old 6th June 2014, 06:11 PM
RPGMaster's Avatar
RPGMaster RPGMaster is offline
Alpha Tester
Project Supporter
Super Moderator
Join Date: Dec 2013
Posts: 2,008
Default Sound Plugin Development

Hello, I'm trying to develop a sound plugin and would like some advice . So far I've looked at Zilmar's Basic Audio and 1964 Audio. I've tried changing things around to see what happens. I'm understanding more and more of it.

One thing I need help with is buffers. I tried adding more buffers, but the sound was kinda weird. I probably messed up with the algorithm somewhere. Strange thing is, adding an extra buffer to Zilmar's audio, made SSB64's intro more in sync, but that didn't work for 1964 Audio.

I also tried seeing how to reduce crackling. 1964 Audio's sync audio does the job well, but at the price of fps. Lowering the sleep time from 10ms to 8 sorta helped, but it's not a perfect solution. I thought about implementing SSE for the ucode stuff. Problem is, the main part I need to optimize has too many if statements ;/ . If I were to get the cpu usage of the audio plugin down, I might be able to get stable 60fps with sync audio.

Here's a macro that is a bottleneck.
VMULF_operation(index, dest, s1, s2, wrElement, wrHiAccum, wrLoAccum, wrFlag0) {
	if (wrElement || wrHiAccum || wrLoAccum) {									
		_s32	result = ((_s32)(_s16)(s1) * (_s32)(_s16)(s2));					
		if (wrLoAccum) accumulator[index] = (((_u16)(result << 1)) ^ 0x8000);	
		if (wrElement || wrHiAccum) {											
			_s32	hiValue = (result >> 15);									
			if (result & 0x4000) hiValue++;										
			if (wrHiAccum) accumulator_hi[index].S32 = hiValue;					
			if (wrElement) {													
				(*(_u16*)&(dest)) = (_u16)hiValue;								
In the meantime, I'll try learning the API for DSound and XAudio2.

Also, which do you guys think is more accurate for your typical commercial game, using 1964 HLE audio, or LLE using PJ64's RSP recompiler? I know the HLE one doesn't support every game yet.

Last edited by RPGMaster; 5th July 2014 at 02:47 AM.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT. The time now is 11:45 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.