How to programmatically set volume in Windows, Mac and Ubuntu? - c++

I'd like to programmatically set volume in Windows, Mac and Ubuntu using C/C++. Command line also can but C/C++ preferred. Thank you in advance!

Just a hint, In windows the 'philosophy' around volume adjustment has changed between XP and Vista/7. Code that would change the master volume on XP will only change the application specific volume setting in the mixer on Vista and 7.
Here is a good blog post by one of the MS audio dev team regarding this: Larry Osterman's Blog
Here are some codeproject pages that might prove useful:
For XP
For Vista +
Also, there are a few powerpoint presentations regarding the new api's here:
AMP Summit ppts. The Audio Endpoints in Windows Vista presentation has some good info.
As for OsX and Ubuntu, i have no idea.

For Linux using ALSA sound system, you can use following command:
amixer set Master 50%

For completeness sake, here is the OSX cli version:
osascript -e "set volume output volume (output volume of (get volume settings)+2)"
And on the C side it's more difficult. From everything I found researching this, the easiest way is using one of the readily available objective C answers and wrapping them into a function in an extra object you can call from C/C++.

Related

No FS0 in EFI Shell

I want to try programming for EFI so I created a VM using virtualbox, checked "enable efi" option and left CD empty.
The efi shell boots how it should but instead of FS0 i only see BLK0, BLK1 etc. Is there any way to have FS without inserting USB disk (which is displayed as FS)?
Edit:
Thanks for your replies. For people who still want to use VB - formatting VB disk with DISKPART using Windows CD solves the problem.
#unixsmurf answer in comments is correct. Your image need file system supported by UEFI. If you can't see fsX in output of map command then it means that non of attached block devices (blkX) contain supported file system. Please create FAT32 partition on your disk, then you will be able to see fsX in map output. To switch between file systems use DOS like syntax command ie. fs0: switch to FS0 file system.
According to UEFI specification 2.5 section 12.3:
EFI encompasses the use of FAT32 for a system partition, and FAT12 or FAT16 for removable
media.
I would suggest to use OVMF (Open Virtual Machine Firmware) directly with QEMU not through VirtualBox. Why ?
Because you can hack OVMF and learn how it works internally, this give you better understanding, VirtualBox hide internals and I'm not sure if it allow firmware replacement
OVMF was developed initially for QEMU and it is adapted by various other virtual machines, because of that there is much more support for OVMF on QEMU then OVMF on VirtualBox
using QEMU also give you ability to emulate your hardware and write drivers/applications in UEFI that use it
I wrote beginners tutorial that help setting up development environment needed for UEFI application development using OVMF.
More about OVMF.

Windows MTP/WPD communication with Android device

I'm developing a PC c++ application running on windows. The application shall communicate with an android phone connected thru USB, using MTP. The idée is to not mount the Storage Card. What I have found is that Windows have something they call WPD (Windows Portable Device ) which supports MTP. It looks pretty ok but it demands WMP11 to be installed. What I wondering:
Is there are any other alternatives libraries you can use?
Do any one have any tips or experience about using WPD?
Are there any "leaner" dependencies you can install instead of WMP11 for xp?
Any help would be greatly appreciated.
I here provide some answers to my question for the hope that it will help some one else.
Is there any alternatives/leaner libraries?
You can use WIA but that is only used for images. but a part from that I have not found any.
Any tips?
Check out the sample code provided by Microsoft, it is a good start point. I found it be searching for Portable Devices COM API Sample on MSDN
For Services you can check out this sample code. Which I found by googling for WpdServicesApiSample
The WPD api is pretty ok to use.
Not all devices support MTP and some only support part of it. This caused me some problem but the device we used released an update which supported more of MTP
I found the answer about XP-problems from this StackOverflow by pcbbc really helpful. I can also add that we mailed the supplier and asked for a custom .INF file to support XP and they were really helpful and provided us with it. But it took some time before we got it.

cuda program on VMware

i wrote a cuda program and i am testing it on ubuntu as a virtual machine. the reason for this is i have windows 7, i don't want to install ubuntu as a secondary operating system, and i need to use a linux operating system for testing.
my question is: will the virtual machine limit the gpu resources? So will my cuda code be faster if i run it under my primary operating system than running it on a virtual machine?
I faced a similar task once. What I ended up doing was installing Ubuntu on a 8GB thumb drive with persistent mode enabled.
That gave me 4GB to install CUDA and everything else I needed.
Having a bootable USB stick around can be very useful. I recommend reading this.
Also, this link has some very interesting material if you're looking for other distros.
Unfortunately the virtual machine simulates a graphics device and as such you won't have access to the real GPU. This is because of the way the virtualisation handles multiple VMs accessing the same device - it provides a layer in between to share the real device.
It is possible to get true access to the hardware, but only if you have the right combination of software and hardware, see the SLI Multi-OS site for details.
So you're probably out of luck with the virtualisation route - if you really can't run your app in Windows then you're limited to the following:
Unrealistic: Install Linux instead
Unrealistic: Install Linux alongside (not an option)
Boot into a live CD, you could prepare a disk image with CUDA and mount the image each time
Setup (or beg/borrow) a separate box with Linux and access it remotely
I just heard a talk at NVIDIA's GPU technology conference by a researcher named Xiaohui Cui (Oak Ridge National Laboratory). Among other things, he described accessing GPUs from Virtual machines using something called gVirtuS. He did not create gVirtuS, but described it as an opensource "virtual cuda" driver. See following link:
http://osl.uniparthenope.it/projects/gvirtus/
I have not tried gVirtuS, but sounds like it might do what you want.
As of CUDA 3.1 it's virtualization capabilities are not vivid, so the only usable approach is to run CUDA programs directly on the target HW+SW
Use rCUDA to add a virtual GPU to your VM.

OpenCV on Embedded Platform

Can some suggest a test/development embedded platform to use with OpenCV.
I would like to develop an embedded video analytics solution, but I don't know where to start.
Some suggestion/ideas/hw starter kits?
Maybe some Pc-104 solutions with Intel Atom? Has someone made some test about performances on this platform or any other embedded platform?
Thanks
A Pentium/PC built OpenCV application will run on any Atom platform with the same OS unmodified. This is because Atoms natively run Pentium executables.
If you are looking for a more embedded solution, there are OpenCV ports for the BeagleBoard. SInce OpenCV is portable code, it can be compiled to most systems that provide a C/C++ compiler. I have successfully used OpenCV on ARM, MIPS and XScale processors.
As for mobile platforms, there are ports to the iPhone, Android and various Windows CE/Mobile/Embdeed versions.
If you're looking for a very small option, I strongly recommend the Gumstix Overo series. I use them for my Computer Vision research, and they work really well. There are a couple of options for processors, I'd recommend the Overo Tide module, which has 512 MB of RAM, and an onboard DSP for offloading some CV operations. Combine this with a Tobi expansion board and a few cables, and you've got a full embedded computer vision research platform for ~$350. They also sell a small camera, which I'm still getting around to trying out. What's nice about the Gumstix is you can just build OpenCV onboard, which saves you some of the headaches with BitBake type solutions.
I'd personally recommend TI OMAP platforms - Beagleboard xM and PandaBoard.
Those boards have embedded video input, run Linux, and have more than enough performance to run OpenCV. They are also extremely portable and have good community support.
Do you mean OpenCV the computer vision library originally developed by Intel? I would be inclined to start with Moblin, Intel's embedded Linux, at moblin.org and for hw use a netbook or any PC that Moblin supports. Hook up a supported webcam from the list at www.qbik.ch/usb/devices/search_res.php?pattern=webcam .
There is a Wikipedia entry that might help. Your project sounds like fun!
cheers -- Rick
You can use the Blackfin kit from Analog Devices. Analog Devices have created a library similar to opencv for the blackfin DSP processor.
you can use Symbian Simulator for this they Nokia have there Open CV for Symbian for hardware testing you have to drop the mail to them they will provide u the hardware through the telnet for given time of time
OpenCV does not need any "special" hardware to function. You can use it fully using images from normal files (e.g. JPG)
Have you looked at some of the tutorials/code? Do they require something specific that you do not have?
Vision Components seem to support the OpenCV in their Smart Cameras (see this article).
I guess I am late to answer.
I have recently used opencv3.4.6 with PC-104 boards (PCM3365) for an INDUSTRIAL Application.
Only thing to note is that when i start webcamera using cv::Videocapture, it takes a long time to open (around 30-40secs), otherwise everything is fine.
Good Luck

Entrek CodeSnitch with Windows Mobile 5/6

I have emailed Entrek and they seem to be asleep.
Does anyone else here use Entrek CodeSnitch? If so, have you found a way to use it with Windows Mobile 5, 6, or 6.1 ?
I really need to verify my application doesn't have any memory leaks, etc. And CodeSnitch does a great job of it. But only with Windows Mobile 2003. :/
Thanks.
What's not working? Is it a client connectivity issue?
The older version used PlatMan for a communications layer, which is problematic from a Visual Studio standpoint (which ships with CoreCon), but if you have any tool installed that has Platman (eVC, Platform Builder) then that should still work fine since WinMo 5.x and 6.x are still based on CE 5.0.
I do know that Entrek has a newer version in beta (I have it) so you might try pinging them again. They tend to be pretty busy, but I've always gotten responses (though I know them well and personally, so that might not be any indicator for you).
I also see that they have their phone number posted on their web page. I'd give them a call. I do recall them saying the new version is supposed to address WinMo issues (I rarely use WinMo proper) so it's definitely worth a try.
I've not used CodeSnitch. But I have had success using the Application Verifier Tool to identify my leaks in WM5 and 6.
Getting it up and running can be a bit of a pain. But I find it to be a good tool and the price is right.
Here's a tutorial to get you started.
I've used CodeSnitch on windows mobile 5, 6 and 6.1 devices with no problems.
Make sure you have the v1.4 installed and applied the v1.4 patch which is referenced here.
Like ctackle says, you need an older communications layer called CoreCon. I've also found CETK has CoreCon in it as well and it's not as big as eVC or Platform builder.
You need to setup the device connection settings to use ActiveSync (both transport and startup server), it does not seem to matter what the connection is called so something like Pocket PC will work fine.
The other gotcha I found is that you need to edit the codesnitch and procman shortcuts and add "/targetcpu:armv4i" to the command line arguments for them to work on WM devices.
I have also found them recently to be non-responsive to support emails as well :(