Detect if default soundcard has changed via VB.NET - vb.net

I have been trying to detect changes of the default audio playback device in my VB.NET application.
Unfortunately, most examples I could find were based on C#.
So I tried to translate it to VB.NET, but I seem to do something wrong.
The most simple example I could find was this one:
https://stackoverflow.com/a/33945287/9399239
Despite its simplicity I was not able to to make it work in VB.NET, so that I had to give up.
Could someone perhaps have a very simple example like the one linked, to notify changes of the default sourd device, but in a working VB.NET variant?
Thanks for your kind help.

Related

Media Foundation - Custom Media Source & Sensor Profile

I am writing an application for previewing, capturing and snapshotting camera input. To this end I am using Media Foundation for the input. One of the requirements is that this works with a Black Magic Intensive Pro 4K capture card, which behaves similar to a normal camera.
Media Foundation is unfortunately unable to create an IMFMediaSource object from this device. Some research lead me to believe that I could implement my own MediaSource.
Then I started looking at samples, and tried to unravel the documentation.
At that point I encountered some questions:
Does anyone know if what I am trying to do is possible?
A Windows example shows a basic implementation of a source, but uses IMFSensorProfile. What is a Sensor Profile, and what should I use it for? There is almost no documentation about this.
Can somebody explain how implementing a custom media source works in terms of: what actually happens on the inside? Am I simply creating my own format, or does it allow me to pull my own frames from the camera and process them myself? I tried following the msdn guide, but no luck so far.
Specifics:
Using WPF with C# but I can write C++ and use it in C#.
Rendering to screen uses Direct3D9.
The capture card specs can be found on their site (BlackMagic Intensity Pro 4K).
The specific problem that occurs is that I can acquire the IMFActivator for the device, but I am not able to activate it. On activation, an MF_E_INVALIDMEDIATYPE error occurs.
The IMFActivator can tell me that the device should output a UYVY format.
My last resort is using the DeckLinkAPI, but since I am working with several different types of cameras, I do not want to be stuck with another dependency.
Any pointers or help would be appreciated. Let me know if anything is unclear or needs more detail.

Developing a virtual drive for windows (.net C#)

My requirement.
Develop a ntfs/fat formatable raw virtual drive in windows - something like truecrypt. I want to know if there is C# implementation for this somewhere.
dokan, callbackfs etc dont exactly fit since the file system itself has to be implemented. filedisk, imdisk etc are in kernel space and the code appears to be complex.
Something like callbackdisk or the one provided by eterlogic is perfect, but unfortunately they are expensive, and I don't want to buy them just for a small project.
Is there any other freely available alternative like the above two. Preferably a simple C# wrapper that provide read()/write() callback functions in userland that I can code.
There is a solution, but you need a folder for that :/
Just look here and see if it fits your desires:
http://dotnet-snippets.de/snippet/erstellung-eines-virtuellen-laufwerks/712
It's in german, but you should see the div w/ the code.
The comments aren't that important.
Hope I helped you. :)

How can I change the audio output device in Objective-C?

I'm building a simple Cocoa app and I want to direct the audio output to a specific device, instead of the system selected one. I know some apps, like Skype, let you select where to send the output to. How do they do this?
I tried the MTCoreAudio framework but I can't even compile my app (or their AudioMonitor demo) with it included and the errors aren't helpful (_objc_fatal). Are there any complete examples that I can learn from? So far my searches haven't turned anything up.
Thanks!
The CAPlayThrough example on the Mac Dev Center Sample Code library shows how to list all of the available input and output devices, and select a default device from a menu.
Have you looked through the sample code on http://developer.apple.com ?
Look at these projects http://developer.apple.com/mac/library/navigation/index.html?section=Resource+Types&topic=Sample+Code
Namely the DefaultAudioUnit project.
I should say that working with Core Audio is more challenging than Cocoa. Most of the API's are C-based (I find that harder). You should read the Core Audio programming guide as well to get a sense of how the audio system is put together.

Create wmv-file from code?

I have a project where the requirements is that a end user will select a template, enter some information and then my program should create a wmv movie file that has the information entered encoded in the movie.
So from my perspective I would like to have a framework that allows me to add graphics and text to a movie. Something like this:
movie.addframes(framecount, templateimage)
movie.frame(x).drawtext(x,y,text,font,size,color)
movie.frame(x).drawRectangle(rect,color,bordersize)
movie.frame(x).drawImage(rect,borderstyle,bordersize, image,sizemode)
movie.save(filename,filetype)
Does this exists?
I have searched and only found information about ffmpeg that doesn't seem to do what I want.
I don't need it to be real-time encoding.
I don't care if the framework/library is expensive.
If there are information of how to do this with for example DirectX or DirectShow and pointing to real working vb.net examples, then ill be happy too. ;) (Believe me, I have tried to search and haven't found anything.)
I have not found any good information about how to use Windows Media Encoder for this, but It seems like Windows Media Encoder is the way to go if doing it myself..
you can use DirectShow, check Samples\Capture\CapWMV here

3d files in vb.net

I know this will be a difficult question, so I am not necessarily looking for a direct answer but maybe a tutorial or a point in the right direction.
What I am doing is programing a robot that will be controlled by a remote operator. We have a 3D rendering of the robot in SolidWorks. What I am looking to do is get the 3D file into VB (probably using DX9) and be able to manipulate it using code so that the remote operator will have a better idea of what the robot is doing. The operator will also have live video to look at, but that doesn't really matter for this question.
Any help would be greatly appreciated. Thanks!
Sounds like a tough idea to implement. Well, for VB you are stuck with MDX 1.1(Comes with DirectX SDK) or SlimDX (or other 3rd party Managed DirectX wrapper). The latest XNA (replacement for MDX 1.1/2.0b) is only available for C# coder. You can try some workaround but it's not recommended and you won't get much community support. These are the least you need to get your VB to display some 3d stuffs.
If you want to save some trouble, you could use ready made game engine to simplified you job. Try Ogre, and it's managed wrapper MOgre. It was one of the candidate for my project. But I ended up with SlimDX due to Ogre not supporting video very well. But since video is not your requirement, you can really consider it. Most sample would be in C# also, so you need to convert to VB.Net to use. It won't be hard.
Here comes the harder part, you need to export your model exported from SolidWorks to DirectX Format (*.x). I did a quick search in google and only found a few paid tools to do that. You might need to spend a bit on that or spend more time looking for free converter tools.
That's about it. If you have more question, post again. Good Luck
I'm not sure what the real question is but what I suspect that you are trying to do is to be able to manipulate a SW model of a robot with some sort of a manual input. Assuming that this is the correct question, there are two aspects that need to be dwelt with:
1) The Solidworks module: Once the model of the robot is working properly in SW, a program can be written in VB.Net that can manipulate the positional mates for each of the joints. Also using VB, a window can be programmed with slide bars etc. that will allow the operator to be able to "remotely" control the robot. Once this is done, there is a great opportunity to setup a table that could store the sequencial steps. When completed, the VB program could be further developed to allow the robot to "cycle" through a sequence of moves. If any obstacles are also added to the model, this would be a great tool for collission detection and training off line.
2) If the question also includes the incorporation of a physical operator pendent there are a number of potential solutions for this. It would be hoped that the robot software would provide a VB library for communicating and commanding the Robot programatically. If this is the case, then the VB code could then be developed with a "run" mode where the SW robot is controlled by the operator pendent, instead of the controls in the VB window, (as mentioned above). This would then allow the opertor to work "offline" with a virtual robot.
Hope this helps.