#tyndur · 2009-10-06
122 Nachrichten · Seite 1 von 1 · Original-CSV herunterladen
- kwolfHi pcmattman ;-)
- pcmattmanHello kwolf
- kwolfThe audio thing was posted on cdi-devel yesterday, you should have received the mail
- kwolfOr do you filter all of our mails directly into the spam folder? ;-)
- pcmattmanAh, I have them
- pcmattmanNah, they got lost in the flood of QEMU emails :)
- kwolfAh, you don't filter at all, it seems?
- pcmattmanI don't
- pcmattmanI have decent full-text search on my email though, so it's ok
- pcmattmanSo the CDI sound layer is an interface between the OS and the sound hardware?
- kwolfRight
- pcmattmanIf I understand right from looking at this, there's no mixer or anything like that?
- kwolfI think it would live outside the driver
- kwolfIt's the same for all devices anyway, right?
- pcmattmanI agree with that, I just wanted to be sure
- kwolfI mean if you want to have some shared mixer code I'm all for it, but it doesn't belong into the driver interface
- pcmattmanYup, that's why I was checking. I'd think the mixer et al would be quite host-specific, so they shouldn't be done via CDI
- kwolfUnless there is a hardware mixer. But I think we can keep it simple for now.
- pcmattmankwolf: One thing I did want to mention, related to the CDI network code
- pcmattmanAs far as I can tell there's no way to tell if the NIC is actually connected to a network in the current interface
- kwolfI think you're right
- kwolfWould you like to propose an interface?
- pcmattmanIt's a little tricky, but I'm going to be implementing it for our native driver interface in the next couple of days
- pcmattmanOnce I've got that sorted I'll get a patch together for CDI, to see what I can put together
- kwolfYou probably need to poll the state?
- pcmattmanProbably end up being something like "link_state_t cdi_net_link_state(device)" where link_state_t is an enum of different link states
- pcmattmanSome NICs will be able to store it as a variable, others will just return a "connected" value (no method to find out link state), and others will have to read registers
- pcmattmanI know some can fire an IRQ when the link state changes, which backs up storing as a variable
- pcmattmanI guess it's driver-dependent, as long as the cdi_net_link_state function is implemented and returns valid data :)
- kwolfIt would be more convenient for the OS to have a callback interface then
- pcmattmanPossibly, but that only works if the device can fire an IRQ to tell the driver that the link state has changed
- kwolfRight. But if it can, polling would be wasted work.
- pcmattmanI was thinking that the host would initiate the communication, requesting the link state from the driver
- kwolfWe can start with the polling interface, adding a callback later is still possible
- pcmattmanYou would mainly be doing something like "if(cdi_new_link_state(device) != connected) { some_sort_of_error; }"
- pcmattmanNICs which can use an IRQ will store link state in a variable and simply return that variable, others will have to talk to the NIC
- kwolfHm, there could be more information that just connected or not, like link speed etc. Maybe make cdi_link_state_t a struct?
- kwolfpcmattman: Right, that makes sense
- pcmattmanHm, good point
- pcmattmanSo the link state is more or less a structure, containing information about whether there's a connection or not and link speed
- kwolfAnd anything else we still forgot ;-)
- pcmattman:)
- pcmattmanI'll be back in a couple of hours
- kwolfOk, maybe Max will be here then, too
- DerHartmutre and hello @ all
- kwolfhirsc
- pcmattmanBack
- kwolfwb
- kwolfHi XanClic
- XanClicGood afternoon
- XanClicShould I translate all the comments to English?
- kwolfI think a while ago we decided to have them bilingual
- kwolfWith some doxygen config option to switch the language
- XanClicOh, so how do you do it with doxygen comments?
- kwolfSomething like bluecode did for the liblightc++ beginnings
- kwolfBasically it was the doxygen version of #ifdef GERMAN
- kwolfAnyway, let's get the audio interface right first. I think the most important point is if cdi_audio_driver.act is what we want.
- XanClicI thought, the operating system has one buffer which is refreshed all the time.
- XanClicIf calls one time act() with this buffer as a parameter and CDI_AUDIO_LOOP
- XanClic-If +It
- kwolfHm, ok... I didn't even understand that changing the buffer was allowed while it's being played ;-)
- XanClicNo, it would not be
- kwolfBut I still need to keep in sync what the card is playing right now and where I'm inserting new data
- XanClicYeah, that's a problem
- kwolfXanClic: It wouldn't be allowed? Then how is looping going to help?
- XanClicIf you call act() when there's stuff being played, then this old operation would be canceled
- XanClic-1 is returned, if you gave act() bad parameters or something like this
- XanClicOr just if the hardware fails
- kwolfRight, but obviously I don't want to skip the old buffer. I usually just want to add some more data at the end
- XanClicThen you have to loop ;-)
- XanClicAnd insert it at the beginning
- XanClicBut that's right, there must be a function that returns the position in the current buffer or something like this
- kwolfWould definitely be helpful
- kwolfAnd act and that looping thing is underdocumented. I still don't understand what really happens. It copies the data into some hardware buffers and only when everything played and we're looping it'll re-read the user buffer?
- XanClicThat's right.
- kwolfpcmattman: How do you feel about this?
- XanClicI didn't write how I thought this should be used, because that's not the problem of the interface CDI - OS, but of the interface OS - User
- XanClic*CDI driver
- kwolfWell, which data is copied when is a basic part of the driver interface
- pcmattmankwolf: " If you call act() when there's stuff being played, then this old operation would be canceled" <-- That's logical, the OS itself would control the operations and when to send
- kwolfI'm not arguing that it's insane, but I wasn't clear to me that it works this way
- pcmattmanAh, I understand
- kwolfHowever, I'm not sure if it's really easy to use this way
- kwolfBecause you would need to provide a new buffer that starts exactly at the point where the sound card is when you call act()
- pcmattmanPerhaps act() should push onto a queue then?
- kwolfDon't think that helps. We need some way to replace data that is already sent
- kwolfSay I send 5 seconds to the card and after one second another sound needs to be played
- pcmattmanHmm, true
- kwolfNot sure how the best interface for such a replacement would look like
- pcmattmanI unfortunately don't know enough about sound devices to be able to talk intelligently about how to do that specific example
- kwolfNeither do I ;-)
- kwolfI just know that I want the first sound to be played without a short pause or skipping a small part
- kwolfXanClic: Did you have plans how to implement this?
- pcmattmanIt all depends on whether sound data is sent to the card in full or if it's sent in blocks every <n> ticks
- kwolfHow do you send an internet radio stream to the card in full?
- kwolfThe question is how large the blocks are, but chances are that you still need to replace them when they are already sent to the card
- kwolfUnless you want to wait for sounds for a second (or how long one block will be)
- pcmattmanWhat I meant is a block being a tiny frame of a sound
- pcmattmanIn my naive understanding of how this works, it'd be something like sending data to the card many times each second
- pcmattmanNo, that can't be right, it'd be horribly slow in practice
- kwolfWon't making the sound blocks tiny increase the CPU usage?
- kwolfI think XanClic mentioned something like with ac97 he could submit like 30 seconds at once
- pcmattmanSo if that buffer is DMA'd, you're saying make it possible to modify that buffer live?
- kwolfNot sure if you would just modify the buffer or stop the soundcard, point to the new buffer and start again
- kwolfShouldn't make a big difference for the interface, though
- XanClicIt should be no problem to modify the buffer given to the card via act() after calling this function
- XanClicSo you could give the buffer to the card driver and if you want to play other stuff after a second, you could replace the content of the buffer at this point
- pcmattmanSounds good to me
- XanClicThat was my idea when I wrote "#define CDI_AUDIO_LOOP 1" ;-)
- kwolfOk
- XanClicThe blocks really sent to an AC97 card have a duration of... 0,37 seconds.
- kwolfI guess we need to implement it to see if it works out, but it sounds reasonable at least
- kwolfXanClic: I'm afraid this means implementing a mixer ;-)
- XanClicOf course it does ;-)
- kwolfWell then, have fun ;-)
- XanClicYou also could enqueue all request, so you don't actually need to "mix" something, but the sound driver card won't do that
- XanClicxD
- XanClic*sound card driver
- XanClic"sound driver card", also interesting. A card designed for a sound driver *g*
- kwolfNo, a card producing sound drivers. We definitely need to buy one.
- XanClic*g*
- pcmattmanNight