Does anyone know if it will have a Sound API? .NET still doesn't. Neither does it have usable Direct{3D,Sound,X} binding.
WinRT demystified
21–30 of 48 posts
Re: WinRT demystified
#22Does anyone know if it will have a Sound API? .NET still doesn't. Neither does it have usable Direct{3D,Sound,X} binding.
I'm not a DirectX developer, but it looks to me like I've got huge swaths of DirectSound directly available from C#. I can check something specific, if you'd like.
- no normal RTSP support. Ok, I used libav (working hard to wrap it, cause it's a well written C library, but not trivial to use from C#)
- I get h264 frames that I need to look at before decoding. No way to give compressed h264 frames to WPF to decode. (So I use libav again). SilverLight actually does have MediaStreamSource -- but this is not a SilverLight app.
- Ok, so let's try to use the hardware decoder when it's there. libav supports it, yay! What about WPF? Well, no. You have to use Direct3D (?) to get a surface to draw on. With no way to do this from C# (Interop fails badly according to a DirectShow+Direct3D MVP I consulted). I give up, and use libav's software decoder.
- Ok, I have a bitmap, I want to blit it quickly to the screen - WTF? The only way to do it is use a Shared Memory section (interop again) to create a bitmapsource; then update the underlying memory.
- Except memory runs out after about 20 seconds (~400 frames) of .Invalidate() calls. WTF? Turns out it's a known bug introduced in v4 (wasn't there in v3.5). No fix yet. Just call GC.Collect() after every invalidate. Yay for "automatic" garbage collection!
- Ok, so now we have got a reasonable video. What about sound? Everyone with experience I know says "use NSound" (which is interop again). I opt for interopping with winmm, which I have experience from the C++ side.
- Now, to wrap it all together, I need a millisecond-precision timer. Sorry, no go in .net; Winmm's "timeBeginPeriod" to the rescue! but .net's Dispatcher still triggers my code every 15ms. WTF? I would be happier with a 100us timer, which windows doesn't even provide, but I can't get less than 15000us!
I'm so sorry we chose .NET; it seems to cater well to CRUD type applications, but it is so inadequate for everything I tried to do with it, that it's not even funny.
Re: WinRT demystified
#23Re: WinRT demystified
#24When you use C# and VB, you are using the full .NET framework. But they have chosen to expose a smaller subset of the API to developers to push the new vision for Windows 8. For me, this is a really interesting point that this article doesn't fully get. When you use WinRT you might be using the C# compiler, CLR runtime and .NET string & collection classes, but there are huge sections of the .NET BCL that now look lik…
Re: WinRT demystified
#25It's amazing to see just how much Apple is driving the industry. Microsoft is making an app store, completely rethought their UI and programming model for mobile devices...
Re: WinRT demystified
#26The following is the full source code for a component that adds 2: public sealed class AddTwo { public int Add (int a, int b) { return a + b; } public async IAsyncOperation SubAsync (int a, int b) { return a - await (CountEveryBitByHand (b)); } } Sorry for being an idiot here, but.. does this example make any sense to anyone else? There's a method that adds two numbers, but the async operation is SubAsync which subtr…
Miguel is a pretty l33t developer, so he glosses over a lot of the details. I suspect that code is contained in a class library project. Aka, generates a DLL. So no, not all sealed classes will be components. The second method is there to illustrate what asynchronous programming will look like in C# 5. Native support for async is THE big feature in C# 5. The "await" allows you to call slow blocking code without a tho…
int Add(int a, int b) { return a + b; }
int Sub(int a, int b) { return a - CountEveryBitByHand(b); }
So, I guess the example is just to show the async stuff, really.Re: WinRT demystified
#27 and Javascript uses promises and "then ()".
What is "then ()"? Have they created their own wacky fork of Javascript? Javascript already handles asynchronous programming (feel free to argue that is doesn't do it "right" or even "well"), so why extend the language?Re: WinRT demystified
#28Great explanation. Can't wait to finish downloading Windows 8 to start playing with it. Asynchronous API that will really make a difference for the end user, right? There won't be any more waiting for UI to unfreeze :)
Re: WinRT demystified
#29and Javascript uses promises and "then ()". What is "then ()"? Have they created their own wacky fork of Javascript? Javascript already handles asynchronous programming (feel free to argue that is doesn't do it "right" or even "well"), so why extend the language?
promise.then(callback)
so: var p = doSomethingAsync();
p.then(function () { alert("hello"); })Re: WinRT demystified
#30and Javascript uses promises and "then ()". What is "then ()"? Have they created their own wacky fork of Javascript? Javascript already handles asynchronous programming (feel free to argue that is doesn't do it "right" or even "well"), so why extend the language?
No changes to async programming at all, events and continuations as always.