I'd like to create a simple program on Linux in order to adjust and fix the microphone level setting.
I'd like my program to, whenever my Mic level drops below 0.5, automatically revert it to 0.7 (for example).
Problem is: I don't know how to access these configurations on Ubuntu Linux with C++. I thought about using bash commands within my C++ code, but still need to read the mic level setting. How can my C++ program access these microphone audio settings, read and change them?
In college I just learn algoritms, but never how to make the programming language work with the system.
Thank You!
Related
I'm new to Arduino, and one thing I came across is this cool tool called Embedxcode, which basically allows you to compile and run sketches on the Arduino from Xcode instead of from the normal Arduino compiler.
The reason I'm using this is because I want the user to be able to do something on the Arduino (i.e. push a button) and the computer responds (i.e. call some function in Objective-C). Since as far as I know you can't do that from the Arduino compiler, I've decided to use Xcode because it can compile Objective-C and use the OSX SDK.
I got Embedxcode to work (the Arduino code compiles and uploads to the board fine), but I can't get Objective-C working. As in, I cannot create a new Objective-C class to pass data to without Xcode giving me errors (and no, renaming the C++ files to .mm did not work).
Does anybody know how to solve this? Or is there a better way to get Arduino to directly interact with OSX events?
embedXcode allows the use of the Xcode IDE for embedded development, but this doesn't include the OS X SDK or the OS X build toolchain. You are still using the AVR toolchain, but with Xcode in front to manage the project. That being said, you are limited to avr-gcc and avr-g++, no Objective-C. It is possible to pass data between C++ and Objective-C classes, but not in the context to which you are referring.
EDIT: If you really want to use Objective-C and Arduino, I suggest researching avr-gcc and Objective-C. According to the avr-gcc man page, Objective-C is supported. Although, getting this work will require meandering away from the cozy Arduino workspace.
It seems like you are misunderstanding the Arduino, and the microcontroller <-> PC relationship. The Arduino (and any microcontroller) is a small standalone computer running its own tiny operating system. So your question in light of that is: how do I get one computer to talk to another computer.
The IDE (XCode, the Arduino environment, etc.) has nothing to do with this. Those are just tools for writing and compiling code, and uploading it to the Arduino processor.
To connect any two computers, you have two options: through wires or through radio waves. The wired option is the easiest to implement and understand. You have two options here, direct USB connection and Ethernet. USB is the easiest to implement and understand and the barebones Arduino is capable of this. Ethernet would require addition hardware.
The wireless options would include Bluetooth, WiFi, XBee radio. These work well but are complicated to implement and require additional hardware.
So... I'd suggest you start with USB. There are many tutorials out there. On the OSX side you will need to write some software to communicate with the Arduino. This could be an app written in ObjectiveC or Java (e.g. using Processing) or Python, or any number of other programming languages. I'd suggest Processing as there are many Arduino <-> Processing tutorials on the web.
Key search terms for finding tutorials: Arduino serial port Processing
I am finding a Ubuntu OS command, which lets the program to read the data from keyboard even if the program is in background. I tried to search it a lot but got no success. If any Ubuntu/Linux programmer knows the OS command which lets the program to do so, Please share it with me.
I am a beginner of Ubuntu programming.
You can use the Linux input subsystem to read events from mice and keyboards. It will only work if your application has the necessary privileges. Basically, you have to run the application as root for this to work.
If you cannot run as root, you should not be attempting to monitor the keyboard anyway.
You can create an X11 application to monitor keyboard events in the current session. It only works for the current user, and in the current graphical environment, and may not be able to observe privileged dialogs, for example password inputs. For details, look at the application shortcut launcher for your desktop environment; all Linux DEs I've ever heard of have one.
I think the old Linux Journal articles, The Linux USB Input Subsystem and Using the Input Subsystem, are still one of the best introductions to the Linux input subsystem. Most Linux distributions nowadays also support uinput, a similar device that allows injecting input events back to the kernel subsystem, designed to allow user-space input device drivers. Their interfaces are described in /usr/include/linux/input.h and /usr/include/linux/uinput.h. I recommend you start at the above articles, and then look at some input and uinput examples.
If you are comfortable using a program, have a look at Logkeys project
. It directly takes input from /dev/input/event*.
I want to create a C++ application that is to run on some Linux platform on a specific laptop computer. I do however not want the users of this laptop to use any other applications/system features than this program - much like the kiosk modes you would find on computers in a typical internet café.
One issue is that the laptop will be booted by the user, and such has to start my software automatically - leaving as little room as possible for the user to intervene with the process. It does not have to be completely secure, but it should be as close as possible.
What would be the best way to accomplish such a thing? Does there exist (free) Linux distributions specifically made for this (if not, I will probably use Arch Linux)? Are there any steps I could/should take in my program, or can I leave it all to the OS? Would creating my own little Linux distribution specifically for this be worth it?
This shouldn't be on stackoverflow but anyway:
Run a plain X session with no window manager, into this plain X session start your program in fullscreen. Done.
I run a small XUL application this way:
X :10 &
sleep 10
DISPLAY=:10 xulrunner ~/zkfoxtemp/application.ini
I would use a minimal live linux distribution - I prefer tinycorelinux but most will do.
using a minimal distribution ensures that the system doesn't have almost any features or programs you didn't plant there, and will make it easy to modify according to your needs
use a window manager as many programs don't behave properly if ran in plain X session (especially if they use pop up windows), but remove all it's menus and shortcuts
prefer booting from a read only media - this will minimize the chances of corruption (accidentally or intentionally)
remove unneeded services and features from the boot and login scripts
I'm having problems opening directly TurboC++ compiler(dos version) on Windows X.
if I click on the TurboC++ icon through windows GUI it opens for a sec(a blank dos screen)
and shuts down.
so i have to access it through the command line i.e.,
cmd (enter)
c:\tc\bin (enter)
tc.exe
This way TurboC++ opens and I'm able to program and everything..
Why do I have to always start tc.exe through the command line? Why can't I start it through Windows XP?
Also, after starting tc.exe through the command line, I am unable to execute any graphics program through it.
I write a simple code for creating a circle using predefined functions..
when i compile and run the program tc.exe exits and returns back to the command prompt.
Why does this happen?Is there a solution?
I have also tried using DosBox to run TurboC++. it closes on executing the graphics program.
ps: this problem has occurred to only me and my friend.....
all PCs in our college have Windows XP or Vista installed and they have no problems.
im using initgraph(); function for initialising graphics drivers(using autodetect) and graphic mode.i have given the proper address for bgi files. and the folder contains the file required (EGAVGA.bgi). this program works fine in our college.does this have something to do about my graphics card(nvidia 9400 1gb)?
Graphics in the 80s were a completely different world than today - directly accessing hardware, often using undocumented features to optimize performance. Drivers didn't exist in DOS. Each program had to write their own hardware layer (hence why under DOS, you had to configure the video and soundcard for every single game separately. The fact that we can run any software from the 80s is a testament to the backwards compatibility work done by Microsoft.
You might have some luck running it on VirtualPC, VMWare or VirtualBox. All of them offer a free version, and if you can find and old copy of DOS 6.22 lying around, you might be good to go. Otherwise, you'll likely be stuck finding a physical 486 running Windows 3.11, and working on that. Depending on what deals your college has with Microsoft, they should be able to get a copy of DOS 6.22 for free - it's still offered for download on MSDN. Although, if you're still using TurboC++, they have not likely signed up for anything with MS. You can also try FreeDOS.
Right click on the TC icon and pick Properties. Go to the Compatibility tab. Play with the settings found there. If that doesn't help, ask your teacher how to use a 25 year old program on a modern computer.
How are you doing graphics? If you're using int 10h (or equivalent) to change the mode, that should work fine as it stands. If you're using BGI, make sure the program's working folder contains the BGI files that come with Turbo C++ -- for more details on initializing BGI, look up initgraph in the help.
Even modern PCs with modern graphics cards seem to have enough legacy support for the BGI code to work, though it seems like the program always runs fullscreen once in graphics mode, rather than in a window.
I don't know why Turbo C++ might not start from the GUI unfortunately. I've used Borland C++ just now to refresh my memory about the BGI stuff, and it worked OK.
Use visualc++ express instead. Its free and equipped with c++11.
for opening problem you can use a .bat file for opening Turbo C++
as follows:
open notepad and type the address of TC.exe and name of exe file like
D:\bhanu\TurboC++\TC.exe
and save it as TC.bat instead of TC.txt
and now double click it to run TC.
For graphics you first copy EGAVGA.BGI file from bgi folder to bin and then in the Turbo c++ open options->linker->library
and mark 'X' on bottom two libraries and un-mark all other libraries.
I'd like to capture the input from a TV remote control and detect which buttons are pressed in my application. The operating system is Linux (Windows answers won't be much use to me, but may be to others). I'm using C++ but C code would work for me also.
I'd like to use the code in a fashion similar to this:
if (remoteControl.buttonPressed(PLAY_BUTTON))
{
fooBar.doSomethingFun();
}
Also, I was thinking there may be a generic library I can use, which would with all remotes, or would I have to do some really low level coding?
First off you are going to need some hardware to detect the IR emissions, for example a USB-UIRT
On Linux, the USB-UIRT is support by LIRC which deals with the low level end of things for you.
There are a number of open source packages that work with this to provide control, so you can look at their code for examples, eg. Myth TV