Jump to content

ATI AC 97 Sounds (SB400) effort


Andras Kenez
 Share

696 posts in this topic

Recommended Posts

Latency issues, I assume, are due to something about the DMA engine, which all goes back to the hardware pointer. If we can figure out this one function, I think we'll have working sound.

should i still mess around with my code or do you think it is futile for some like me who has no C++ coding experience

Link to comment
Share on other sites

I copied in this code from the intel driver

 

IOByteCount CLASS::getDMAEngineHardwarePointer( IOAC97DMAEngineID engine )
{
UInt32	  remain;	// number of samples left in current buffer
UInt8	   civ;	   // current descriptor index value
UInt8	   civ_last;  // cached version of prior
IOByteCount position;
DMAEngineState * dma;
AppleAC97AudioIntelHWReg * dmaReg;

CHECK_DMA_ENGINE_ID(engine, 0);
dma = &fDMAState[engine];
dmaReg = dma->hwReg;

// Determine which descriptor within the list of 32 descriptors is
// currently being processed.

civ = dmaReg->read8( kBMCurrentIndex );

do {
	// Get the number of samples left to be processed in the
	// current descriptor.

	civ_last = civ;
	remain = dmaReg->read16( kBMPositionInBuffer );
}
while ((civ = dmaReg->read8( kBMCurrentIndex )) != civ_last);

position = (((civ + 1) * dma->bdBufferSize) - (remain * kBytesPerSample));

DebugLog("%s::%s[%lx] = %lx\n", getName(), __FUNCTION__,
		 engine, position);

return position;
}

 

And it works, but I have still yet to hear sound (maybe i missed something in the code that i downloaded. It's the last zip that dopefish uploaded.)

 

I'm gonna do some tracing to see what's going on. I see all sorts of information being outputted indicating the hardware pointer is being found. But something doesn't look quite right because it seems to get to something like 3ffff and loops back to 0. and keeps doing that. So i'm not sure.

 

Alright. back to the code.

Link to comment
Share on other sites

I still have yet to hear sound.

 

I'm still getting the popping. It says that the output is going to line out, but I don't have line out, that's probably why I don't hear sound.

 

i'm gonna see if I can figure out why it only has line out and not headphones.

Link to comment
Share on other sites

it would be fricking awesome, if we could get sound work...

BYE BYE WINDOWS

Have to thank the guys in charge fantastic job.....

(Any help on designing the new web site, be my guest(multimedia design student)).

Link to comment
Share on other sites

really dope, very nice code.

 

On another note... I am getting this error while loading ATI...kext (Jas DVD 10.4.6 ..)

 

sudo kextload -t /System/Library/Extensions/AppleAC97Audio.kext

Password:

kextload: extension /System/Library/Extensions/AppleAC97Audio.kext appears to be valid

20AppleAC97AudioEngine is not compatible with its superclass, 13IOAudioEngine superclass changed?

kextload: a link/load error occured for kernel extension /System/Library/Extensions/AppleAC97Audio.kext

load failed for extension /System/Library/Extensions/AppleAC97Audio.kext

(run kextload with -t for diagnostic output)

 

Could someone help

 

Tariq

Link to comment
Share on other sites

Hang on, guys, I'm having breakthroughs right and left, we might get this licked yet. :idea:

 

Ed, I found out the purpose of the whole IOC mechanism, such as is found in the Intel driver. The OS registers a callback to our driver (dma->interruptAction) which is to be called when the driver has finished playing/recording the buffer. I believe that it is this callback which eventually calls stopDMAEngine(). Normally, we would call this on an XRUN interrupt, which (according to the documentation I dug up earlier) signifies the end of the DMA descriptor chain. Our chain doesn't have an end, since it's set up as a ring buffer. I'm going to try hacking up a method to keep track of the "first" DMA descriptor pointer, and calling the IOC callback when the DMA engine advances to that point. I don't know if it's entirely accurate, but perhaps it will be progress.

Link to comment
Share on other sites

This kext was compiled on JAS DVD with 10.4.6 update.

 

Backup your /System/Library/Extensions/AppleAC97Audio.kext

use

tar -xjvf atisound.tar.bz2 -C /System/Library/Extensions

change permissions

Add you device ID to ATI kext inside AppleAC97Audio.kext plugin directory (mine was 4341)

 

Good luck.

 

Tariq

 

sorry couldn't upload bz2 file, renames it to zip, but it is essentially the same.

 

Tariq

atisound.tar.bz2.zip

Link to comment
Share on other sites

The version I'm uploading right now proves what I just said is right. I have seen calls to performAudioEngineStop() in the debug logs. All that remains now is to determine how long the audio sample is, and stop playback when the sample is complete. Strictly, this release doesn't "work" in the sense that it doesn't always play sound, but it is a proof-of-concept of the IOC mechanism.

ATIAppleAC97Audio.zip

Link to comment
Share on other sites

With this release sound stop's working after 5 min's but then it starts again... good work dope, i guess we are almost there.

 

 

 

forgot to mention there is latency problem, could be because of debug logs .. will try to turn them off..

Link to comment
Share on other sites

ok, great step, the driver try to load, but i get this:

 

AppleAC97Audio :

 

Version : 1.0.0

Dernière modification : 06-06-22 11:39

Chaîne des informations : 1.0.0, Copyright Apple Computer, Inc. 2004

Emplacement : /System/Library/Extensions/AppleAC97Audio.kext

Version de kext : 1.0.0

Adresse de chargement : 0x2215b000

Valide : Oui

Authentique : Oui

Dépendances : Incomplètes

Erreurs de dépendance :

com.apple.iokit.IOAudioFamily : Aucune version valide de cette dépendance n'a été trouvée

Intégrité : Cette kext n’a pas de reçu

 

EDIT: NVM, i got it to work, but the voice is ugly, but it work!!!!!!!

thanks! now i have 3 fully working os on my laptop

 

EDIT2: Ok, it took 9:52 min to become too much ugly to understand, it is better than 5 minute, the sound dont stop for me, but it lagg a lot ofter this amount of time

Link to comment
Share on other sites

good work dope....hopefully you can get it 100%, and then I can figure out how to get it to map to the right audio port on my laptop.

I think the latency is caused because the DMA engine runs through all 256 DMA descriptors, and the sound doesn't play until the DMA engine is finished. If I can figure out how to cut off the DMA engine at the right point, I think the latency will improve drastically.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...