thanks for that... looks like he does an IOCTL on the mixer device and then tells qtopia of the change! so, I am guessing the proper way doesn't work... using google I only found a few places where the official way was discussed, and one comment said that TrollTech changed the interface from the proprietary/closed versions and the public GPL one.
I shall copy this technique, although as a programmer I'd prefer to learn the proper method so as to achieve device independence!
~/build/zplayer-0.1.1/tkmix> more qtopia_volume.cpp
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "qtopia_volume.h"
bool QtopiaVolume::setLevel(int level)
{
int iDevice, isetlv = (level + (level << 8));
// Set value
if ((iDevice = open("/dev/mixer", O_RDONLY)) == -1) {
qDebug("Syntax error in open device\n");
return false;
}
if (ioctl(iDevice, MIXER_WRITE(0), &isetlv) == -1) {
qDebug("Syntax error in set volume\n");
return false;
}
// Update applet
QCopEnvelope("QPE/System", "volumeChange(bool)") << FALSE;
close(iDevice);
return true;
}
int QtopiaVolume::getCurrentLevel()
{
Config cfg("qpe");
cfg.setGroup("Volume");
return cfg.readNumEntry("VolumePercent", 0);
}