Jump to content

ATI AC 97 Sounds (SB400) effort


  • This topic is locked This topic is locked
695 replies to this topic

#201
chrs2021

chrs2021

    InsanelyMac Protégé

  • Members
  • PipPip
  • 69 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

#202
thedopefishlives

thedopefishlives

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 205 posts
Mess all you want, if you find something, great :blink: Although I wouldn't recommend kernel code for someone still exploring C++ syntax and coding practices, perhaps you might magically stumble upon something that the rest of us have overlooked.

#203
EdFlyer

EdFlyer

    Computer Lackey

  • Members
  • PipPipPip
  • 159 posts
alright, its time for to dive in to this tonight and update my codebase to the (almost) working code.

looks like its gonna be an exciting night.

#204
thedopefishlives

thedopefishlives

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 205 posts
Between my discovery earlier today and the work everyone here is putting in tonight, we could ostensibly have a halfway decent driver by the weekend :blink:

#205
EdFlyer

EdFlyer

    Computer Lackey

  • Members
  • PipPipPip
  • 159 posts
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.

#206
thedopefishlives

thedopefishlives

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 205 posts
It *should* do some looping, since it is a ring buffer.

#207
EdFlyer

EdFlyer

    Computer Lackey

  • Members
  • PipPipPip
  • 159 posts
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.

#208
thedopefishlives

thedopefishlives

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 205 posts
Heh, mine went to speakers and didn't have any problem. *shrugs* I may try to figure your fix into my code, see what that does to the DMA.

#209
zelda

zelda

    InsanelyMac Protégé

  • Members
  • PipPip
  • 57 posts
Dope, I was just looking at your code, it is awesome ... I haven't seen such good code in years (well gotta give it a try once I reach home)

Tariq

#210
Roxas

Roxas

    InsanelyMac Protégé

  • Members
  • Pip
  • 11 posts
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)).

#211
thedopefishlives

thedopefishlives

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 205 posts

Dope, I was just looking at your code, it is awesome ... I haven't seen such good code in years (well gotta give it a try once I reach home)

Tariq

Wow, dude, that made my day. All those years of careful coding practices must've really paid off.

#212
zelda

zelda

    InsanelyMac Protégé

  • Members
  • PipPip
  • 57 posts
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

#213
thedopefishlives

thedopefishlives

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 205 posts
Hey all,
I found this page for documentation on the ATI IXP chipset and how it works: http://www.jp.netbsd...I/ixp-audio.txt

I'm going to try to use some of the information from it to modify the interrupt handler and see if it helps anything.

#214
zelda

zelda

    InsanelyMac Protégé

  • Members
  • PipPip
  • 57 posts
< xcodebuild > should build the packages ? is it not ?
do we need some environment setting or do we need to put package in /Users/noah ?

Tariq

#215
zelda

zelda

    InsanelyMac Protégé

  • Members
  • PipPip
  • 57 posts
awesome, sweet music ...
(basically combined ed's package and Dope's .cpp .h files) ;-)
Let me see how long it continues ...

Tariq

#216
zelda

zelda

    InsanelyMac Protégé

  • Members
  • PipPip
  • 57 posts
Nope, only about 5 mins

Tariq

#217
stugihair

stugihair

    InsanelyMac Protégé

  • Just Joined
  • Pip
  • 4 posts
Could you post your compiled kext???

#218
thedopefishlives

thedopefishlives

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 205 posts
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.

#219
zelda

zelda

    InsanelyMac Protégé

  • Members
  • PipPip
  • 57 posts
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

Attached Files



#220
thedopefishlives

thedopefishlives

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 205 posts
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.

Attached Files







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2017 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy