#tyndur · 2009-10-06

122 Nachrichten · Seite 1 von 1 · Original-CSV herunterladen

  1. kwolfHi pcmattman ;-)
  2. pcmattmanHello kwolf
  3. kwolfThe audio thing was posted on cdi-devel yesterday, you should have received the mail
  4. kwolfOr do you filter all of our mails directly into the spam folder? ;-)
  5. pcmattmanAh, I have them
  6. pcmattmanNah, they got lost in the flood of QEMU emails :)
  7. kwolfAh, you don't filter at all, it seems?
  8. pcmattmanI don't
  9. pcmattmanI have decent full-text search on my email though, so it's ok
  10. pcmattmanSo the CDI sound layer is an interface between the OS and the sound hardware?
  11. kwolfRight
  12. pcmattmanIf I understand right from looking at this, there's no mixer or anything like that?
  13. kwolfI think it would live outside the driver
  14. kwolfIt's the same for all devices anyway, right?
  15. pcmattmanI agree with that, I just wanted to be sure
  16. 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
  17. 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
  18. kwolfUnless there is a hardware mixer. But I think we can keep it simple for now.
  19. pcmattmankwolf: One thing I did want to mention, related to the CDI network code
  20. 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
  21. kwolfI think you're right
  22. kwolfWould you like to propose an interface?
  23. pcmattmanIt's a little tricky, but I'm going to be implementing it for our native driver interface in the next couple of days
  24. pcmattmanOnce I've got that sorted I'll get a patch together for CDI, to see what I can put together
  25. kwolfYou probably need to poll the state?
  26. 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
  27. 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
  28. pcmattmanI know some can fire an IRQ when the link state changes, which backs up storing as a variable
  29. pcmattmanI guess it's driver-dependent, as long as the cdi_net_link_state function is implemented and returns valid data :)
  30. kwolfIt would be more convenient for the OS to have a callback interface then
  31. pcmattmanPossibly, but that only works if the device can fire an IRQ to tell the driver that the link state has changed
  32. kwolfRight. But if it can, polling would be wasted work.
  33. pcmattmanI was thinking that the host would initiate the communication, requesting the link state from the driver
  34. kwolfWe can start with the polling interface, adding a callback later is still possible
  35. pcmattmanYou would mainly be doing something like "if(cdi_new_link_state(device) != connected) { some_sort_of_error; }"
  36. 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
  37. kwolfHm, there could be more information that just connected or not, like link speed etc. Maybe make cdi_link_state_t a struct?
  38. kwolfpcmattman: Right, that makes sense
  39. pcmattmanHm, good point
  40. pcmattmanSo the link state is more or less a structure, containing information about whether there's a connection or not and link speed
  41. kwolfAnd anything else we still forgot ;-)
  42. pcmattman:)
  43. pcmattmanI'll be back in a couple of hours
  44. kwolfOk, maybe Max will be here then, too
  45. DerHartmutre and hello @ all
  46. kwolfhirsc
  47. pcmattmanBack
  48. kwolfwb
  49. kwolfHi XanClic
  50. XanClicGood afternoon
  51. XanClicShould I translate all the comments to English?
  52. kwolfI think a while ago we decided to have them bilingual
  53. kwolfWith some doxygen config option to switch the language
  54. XanClicOh, so how do you do it with doxygen comments?
  55. kwolfSomething like bluecode did for the liblightc++ beginnings
  56. kwolfBasically it was the doxygen version of #ifdef GERMAN
  57. 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.
  58. XanClicI thought, the operating system has one buffer which is refreshed all the time.
  59. XanClicIf calls one time act() with this buffer as a parameter and CDI_AUDIO_LOOP
  60. XanClic-If +It
  61. kwolfHm, ok... I didn't even understand that changing the buffer was allowed while it's being played ;-)
  62. XanClicNo, it would not be
  63. kwolfBut I still need to keep in sync what the card is playing right now and where I'm inserting new data
  64. XanClicYeah, that's a problem
  65. kwolfXanClic: It wouldn't be allowed? Then how is looping going to help?
  66. XanClicIf you call act() when there's stuff being played, then this old operation would be canceled
  67. XanClic-1 is returned, if you gave act() bad parameters or something like this
  68. XanClicOr just if the hardware fails
  69. kwolfRight, but obviously I don't want to skip the old buffer. I usually just want to add some more data at the end
  70. XanClicThen you have to loop ;-)
  71. XanClicAnd insert it at the beginning
  72. XanClicBut that's right, there must be a function that returns the position in the current buffer or something like this
  73. kwolfWould definitely be helpful
  74. 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?
  75. XanClicThat's right.
  76. kwolfpcmattman: How do you feel about this?
  77. 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
  78. XanClic*CDI driver
  79. kwolfWell, which data is copied when is a basic part of the driver interface
  80. 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
  81. kwolfI'm not arguing that it's insane, but I wasn't clear to me that it works this way
  82. pcmattmanAh, I understand
  83. kwolfHowever, I'm not sure if it's really easy to use this way
  84. kwolfBecause you would need to provide a new buffer that starts exactly at the point where the sound card is when you call act()
  85. pcmattmanPerhaps act() should push onto a queue then?
  86. kwolfDon't think that helps. We need some way to replace data that is already sent
  87. kwolfSay I send 5 seconds to the card and after one second another sound needs to be played
  88. pcmattmanHmm, true
  89. kwolfNot sure how the best interface for such a replacement would look like
  90. pcmattmanI unfortunately don't know enough about sound devices to be able to talk intelligently about how to do that specific example
  91. kwolfNeither do I ;-)
  92. kwolfI just know that I want the first sound to be played without a short pause or skipping a small part
  93. kwolfXanClic: Did you have plans how to implement this?
  94. pcmattmanIt all depends on whether sound data is sent to the card in full or if it's sent in blocks every <n> ticks
  95. kwolfHow do you send an internet radio stream to the card in full?
  96. 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
  97. kwolfUnless you want to wait for sounds for a second (or how long one block will be)
  98. pcmattmanWhat I meant is a block being a tiny frame of a sound
  99. pcmattmanIn my naive understanding of how this works, it'd be something like sending data to the card many times each second
  100. pcmattmanNo, that can't be right, it'd be horribly slow in practice
  101. kwolfWon't making the sound blocks tiny increase the CPU usage?
  102. kwolfI think XanClic mentioned something like with ac97 he could submit like 30 seconds at once
  103. pcmattmanSo if that buffer is DMA'd, you're saying make it possible to modify that buffer live?
  104. kwolfNot sure if you would just modify the buffer or stop the soundcard, point to the new buffer and start again
  105. kwolfShouldn't make a big difference for the interface, though
  106. XanClicIt should be no problem to modify the buffer given to the card via act() after calling this function
  107. 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
  108. pcmattmanSounds good to me
  109. XanClicThat was my idea when I wrote "#define CDI_AUDIO_LOOP 1" ;-)
  110. kwolfOk
  111. XanClicThe blocks really sent to an AC97 card have a duration of... 0,37 seconds.
  112. kwolfI guess we need to implement it to see if it works out, but it sounds reasonable at least
  113. kwolfXanClic: I'm afraid this means implementing a mixer ;-)
  114. XanClicOf course it does ;-)
  115. kwolfWell then, have fun ;-)
  116. XanClicYou also could enqueue all request, so you don't actually need to "mix" something, but the sound driver card won't do that
  117. XanClicxD
  118. XanClic*sound card driver
  119. XanClic"sound driver card", also interesting. A card designed for a sound driver *g*
  120. kwolfNo, a card producing sound drivers. We definitely need to buy one.
  121. XanClic*g*
  122. pcmattmanNight