I've been working on an audio streaming utility for WP mango, which features a custom audio format and custom audio compressor which I have managed to successfully implement in C#. However; the drawbacks seem to be increased memory usage, delays in streaming, and strange echoing. These bugs are not present in the native implementation on the computer. The purpose of this stream is for a remote desktop application, which uses UDP for peer discovery, and relies heavily on sockets. It seems that it would make more sense to use native code for something like this than managed code. With the improved video APIs, sensors, and sockets, the necessity for native code seems to increase even more. Why is native code still not supported? Most other smartphones support this; so why not Windows Phone?
-
-
We can only speculate on the causes, but the consensus seems to be:
- If all applications are managed code (and exposed via an abstract interface), then Microsoft and the OEMs can change any aspect of the implementation (such as CPU architecture, device capabilities, etc) without causing any programs to break. Think of this as taking the concept of ensuring future backwards compatibility to the extreme. Innovative and high-perf applications be damned.
- Pure/managed code can be verified at runtime. This has the benefit of proving that a program does (or does not) use an undocumented API feature, which is something Apple had a problem with recently in trying to prevent developers from writing tethering programs.
Anyway, back to your program problem:
Most C++ code is directly portable to C# (with major modifications, I'll grant you), so the problems you're experiencing with different behaviour (such as echoing) means that your C# program is not correct. This cannot be a bug in the CLR, unless the echoing is introduced by the Managed sound API.
-
Native support has never been promised for Mango. Be patient

C
-
1 hour ago,W3bbo wrote
Most C++ code is directly portable to C# (with major modifications, I'll grant you), so the problems you're experiencing with different behaviour (such as echoing) means that your C# program is not correct.
Bit harsh. If you're excessively creating/deleting objects rather than strategically reusing them it's plausible that at least some of the problems like stuttering audio might be the result of GC kicking in.
-
@AndyC: W3bbo? Harsh? Noooooo.
You're right, Andy. He's not quite right... I stopped taking it seriously after "Most C++ is directly portable to C#". That's just not true. Sure, it's possible to some degree, depending on the features needing to be ported, the associated libraries used, etc... In this case, it seems to me that IDWMaster needs to....go native. 
C
-
W3bbo has a point, porting computation intensive native code into managed code MIGHT introduce 'increased memory usage', 'delays in streaming' or 'stuttering audio as the result of GC' etc, that is true, but 'strange echoing' ? that is very unlikely, 'different behaviour' and 'performance issues' are different here.
Does your audio codec have an official test suite/ test vector ? does your native version enable some additional 'echo-cancelling' mechanism ?
I have used NSpeex and iLBC.NET before, without major problems, except slight performance degrading though.
And, native code on Windows Phones might be an Apollo thing I guess. and I have a feeling that you wont get it with a CE kernel,
-
Carefull spilling the beans

I just hope current devices will support it.
-
12 hours ago,Charles wrote
@AndyC: W3bbo? Harsh? Noooooo.
You're right, Andy. He's not quite right... I stopped taking it seriously after "Most C++ is directly portable to C#". That's just not true. Sure, it's possible to some degree, depending on the features needing to be ported, the associated libraries used, etc... In this case, it seems to me that IDWMaster needs to....go native.I said "most" code, which you contradict, but then re-affirm with " Sure, it's possible to some degree, depending on the features needing to be ported" which is the very same point I was making.
Remember, so long as a language is Turing complete (with the necessary bindings for IO and system functionality) thenanything in one language is portable to another, it just doesn't necessarily have to be fast.
Pops and stuttering are most likely caused by bad performance, that might be unavoidable under the CLR. However echoing isn't, and suggests the behaviour (and so,correctness) of the C# and C++ implementations is different.
-
lol, real subtle, Charles
I think we all have figured out by now that Mango is the end-of-the-line for the Windows Phone OS. Windows 8 for all. -
@spivonious: You draw too many conclusions from my words, folks... I simply said "be patient". The most important thing I said was "nativesupport was never promised for Mango". That could mean anything...
Obviously, the WP7 team listens to requests from customers (Mango makes it clear that they act on feedback, as well) and this one has been requested since the first release. It's not a simple problem to solve, technically... There is no conspiracy against native devs.
So, to be really clear: Like many of you, I hope they're listening about native support. That's all.
Not sure what makes you think Mango is the last of a line... That's just unfounded. Don't associate my comments with this notion please. Being patient has nothing to do with this....C
-
@W3bbo: "Most" is the wrong word to use, W3bbo. That's my point and I'm not talking about programming language portability theory - it's about the practice.
C
-
If I'm patient until BUILD will all be revealed then? Or does this require post-BUILD patience?

-
@Charles: The way the WP team has been going, if they allow native support, then it won't be in the way we expect. I take the background agents as an example of this. People asked for multitasking and background applications, perhaps expecting something like we got in the wild west days of Windows Mobile. What we got is IMO, a better thought out solution to the problem.
Just allowing entire applications to be written in native code to make it easier on developers who can't be bothered to port isn't the solution. Looking at what people have been asking for, a better solution might be allowing something like highly sandboxed libraries that can be used for calculation intensive operations such as codecs or simulation. I wouldn't allow any access to data, sensors, UI or more than the most basic of APIs, only things that are explicitely passed in by the hosting application. As long as the sandbox is secure, the worse somebody can do is crash their own application...hopefully.
-
3 hours ago,spivonious wrote
lol, real subtle, Charles
I think we all have figured out by now that Mango is the end-of-the-line for the Windows Phone OS. Windows 8 for all.Well, there may be a Tango before Apollo, some rumors said. and I guess Tango might be the reason for the 7.5/7.1 versioning disaster.
-
as a side note, echoing might be caused by a feedback loop between the mic input and the output. It may be as simple as making sure that you turn the mic off during playback.
-
@felix9: How is it a disaster?
-
@kettch: http://www.zdnet.com/blog/microsoft/microsoft-gives-windows-phone-developers-a-refreshed-non-rtm-mango-build/10201
"Although we will be marketing the 'Mango' release as 'Windows Phone 7.5′, the 7.5 phones (will be running) 'Windows Phone OS 7.1′. While not an ideal pairing, it's similar to how Windows 7 is actually Windows OS version 6.1."so 7.5 is the version for consumers/marketing and 7.1 is the version for developers/technical ?
If its really like 'Windows 7' and 'NT 6.1', even developers/MSDN docs should refer to it as 'Windows 7', while '6.1' is only used in code when you want to check the version, but 'Windows Phone 7.1' is in the SDK and docs, huh.
even ms guys use them interchangably. do you use 'Windows 6.1' so often ?
http://blogs.msdn.com/search/searchresults.aspx?q=phone+7.1
http://blogs.msdn.com/search/searchresults.aspx?q=phone+7.5and Wikipedia is confused http://en.wikipedia.org/wiki/Talk:Windows_Phone_7.5
-
@felix9:Hmmm....Somehow I can't summon enough nerd rage to care.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.