Hi all,
I want to change my Arm9 DVEVM 's sound level via Qt is it possible? There is Montavista linux on it. TI DM355 MCU and Montavista linux
Hi all,
I want to change my Arm9 DVEVM 's sound level via Qt is it possible? There is Montavista linux on it. TI DM355 MCU and Montavista linux
Hi,
There is no direct way using the QSound class. You have to open the mixer and do an IOCTL on it. I did it as such.
Qt Code:
bool setLevel(int level) { int iDevice,isetlv = (level + (level << 8)); isetlv &= 0x00ff; // Set value if ((iDevice = open("/dev/mixer", O_RDONLY)) == -1) { return false; } if (ioctl(iDevice, MIXER_WRITE(0), &isetlv) == -1) { return false; } close(iDevice); return true; }To copy to clipboard, switch view to plain text mode
Dear QbelcorT;
I tried that but when i do that , the sound is cutting off , and QSound doesn't work any more.
Please post your code. Are you using alsa? Did you try different values? Is this the correct /dev/mixer for your device?
I am very newbie at embedded linux , i am not sure my T.I DVEVM soard support or not the ALSA, but my QSound works, I have added my codes below.
Qt Code:
#include <QSound> #include <linux/soundcard.h> #define MIXER_DEVICE "/dev/mixer" . . . .. .... ..... ...... ....... int myThread::setAudioLevel(int audioLevel) { int vol = audioLevel | (audioLevel << 8); int mixerFd; /* Set the output volume */ mixerFd = open(MIXER_DEVICE, O_RDONLY); if (mixerFd == -1) { // ERR_A("Failed to open %s\n", MIXER_DEVICE); return -1; } if (ioctl(mixerFd, SOUND_MIXER_WRITE_VOLUME, &vol) == -1) { // ERR_A("Failed to set the volume of line in.\n"); close(mixerFd); return -1; } close(mixerFd); return 0; }To copy to clipboard, switch view to plain text mode
Hi,
It is difficult to debug from this point. I don't know the details of your eval kit. You must use this method I gave you to set the volume though. This should point you in the right direction. You'll have to google a few things about sound in linux or check the documents that came with your kit.
You need to know a few things.
1) Which mixer your sound card is using /dev/mixer0,1,2
2) In the bash prompt , can you type 'amixer'? This is the basis of setting the audio details (sound level, bass, treble or any details for your particular card). 'amixer -h' will give you a list options.
3) Without even using qtopia in bash prompt can you type 'aplay "soundname", where soundname is the name of the wav file.
PS. Did you try different values in setLevel?
Dear QbelcorT,
I tried to do what you said, but it didnt help me . I think, i have to find an other way except QSound . I can't use together QSound and "/dev/mixer" together. I wonder that, Are there any other way except QSound for playing sounds on Linux? Does the Linux device like "/dev/dsp" do that function?
Last edited by anafor2004; 24th November 2008 at 08:06.
want to control windows volume control.Is there any way to control using qslider??
advance thanks
Bookmarks