Getting volume
-
- Posts: 71
- Joined: Fri May 05, 2006 5:59 pm
Getting volume
what's the code snippet for getting the volume?
IMO you should think of it like the volume of a TV -- you shouldn't really care if it's at 50% or 100%... the user is kinda responsible for putting it where they want it, and you shouldn't go screwing with their volume level.
That being said, if there was really a use for it, I'm sure there is some way of doing it..
That being said, if there was really a use for it, I'm sure there is some way of doing it..
Shoot Pixels Not People!
Makeshift Development
Makeshift Development
I seem to recall this being discussed before, and the basic conclusion being that there doesn't seem to be an API call that can retrieve the volume setting, but that if you happen to be running in kernel mode, you could monitor the Vol+ / Vol- buttons to at least receive notifications of changes.
Of course the kernel does seem to track volume settings, as it displays the volume when pressing those buttons - so maybe if you poked around in sceImpose you might find something.
Of course the kernel does seem to track volume settings, as it displays the volume when pressing those buttons - so maybe if you poked around in sceImpose you might find something.
Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you!
The PSP Homebrew Database needs you!
-
- Posts: 71
- Joined: Fri May 05, 2006 5:59 pm
That's all I'm really gonna do. I just wanna display the volume level. I don't wanna mess around with it. I'll look for it, but not right now, since I have to go somewhere. I'll post back if I find anything.Fanjita wrote:I seem to recall this being discussed before, and the basic conclusion being that there doesn't seem to be an API call that can retrieve the volume setting, but that if you happen to be running in kernel mode, you could monitor the Vol+ / Vol- buttons to at least receive notifications of changes.
Of course the kernel does seem to track volume settings, as it displays the volume when pressing those buttons - so maybe if you poked around in sceImpose you might find something.
Wait, where is the sceImpose?
[quote="Zettablade"][quote="Fanjita"]I seem to recall this being discussed before, and the basic conclusion being that there doesn't seem to be an API call that can retrieve the volume setting, but that if you happen to be running in kernel mode, you could monitor the Vol+ / Vol- buttons to at least receive notifications of changes.
Of course the kernel does seem to track volume settings, as it displays the volume when pressing those buttons - so maybe if you poked around in sceImpose you might find something.[/quote]
That's all I'm really gonna do. I just wanna display the volume level. I don't wanna mess around with it. I'll look for it, but not right now, since I have to go somewhere. I'll post back if I find anything.
Wait, where is the sceImpose?[/quote]
The following seems to work only at launch time. Any idea on how to "re-read" it? If I read it again while running, it will stay the same even when the volume was changed...
#define SNDCNF "/CONFIG/SYSTEM/SOUND"
#define MANVLM "main_volume"
void GetVolume(void)
{
int ret=0;
struct RegParam reg;
REGHANDLE h;
memset(®, 0, sizeof(reg));
reg.unk1 = 1;
reg.namelen = strlen("/system");
reg.unk2 = 1;
reg.unk3 = 1;
strcpy(reg.name, "/system");
if(sceRegOpenRegistry(®, 2, &h) == 0)
{
REGHANDLE hd;
if(!sceRegOpenDir(h, SNDCNF, 2, &hd))
{
REGHANDLE hk;
unsigned int type, size;
if(!sceRegGetKeyInfo(hd, MANVLM, &hk, &type, &size))
{
if(!sceRegGetKeyValue(hd, hk, &MainVolume, 4))
{
sceRegFlushDir(hd);
}
}
}
sceRegCloseDir(hd);
sceRegFlushRegistry(h);
sceRegCloseRegistry(h);
}
}
Of course the kernel does seem to track volume settings, as it displays the volume when pressing those buttons - so maybe if you poked around in sceImpose you might find something.[/quote]
That's all I'm really gonna do. I just wanna display the volume level. I don't wanna mess around with it. I'll look for it, but not right now, since I have to go somewhere. I'll post back if I find anything.
Wait, where is the sceImpose?[/quote]
The following seems to work only at launch time. Any idea on how to "re-read" it? If I read it again while running, it will stay the same even when the volume was changed...
#define SNDCNF "/CONFIG/SYSTEM/SOUND"
#define MANVLM "main_volume"
void GetVolume(void)
{
int ret=0;
struct RegParam reg;
REGHANDLE h;
memset(®, 0, sizeof(reg));
reg.unk1 = 1;
reg.namelen = strlen("/system");
reg.unk2 = 1;
reg.unk3 = 1;
strcpy(reg.name, "/system");
if(sceRegOpenRegistry(®, 2, &h) == 0)
{
REGHANDLE hd;
if(!sceRegOpenDir(h, SNDCNF, 2, &hd))
{
REGHANDLE hk;
unsigned int type, size;
if(!sceRegGetKeyInfo(hd, MANVLM, &hk, &type, &size))
{
if(!sceRegGetKeyValue(hd, hk, &MainVolume, 4))
{
sceRegFlushDir(hd);
}
}
}
sceRegCloseDir(hd);
sceRegFlushRegistry(h);
sceRegCloseRegistry(h);
}
}
huh... this isn't because you change your volume that it would also change your register value. I would expect for it to do so at crucial moment (exiting an application for instance). It would be crazy to change this register value whenever you modify your volume as I suppose it touches flash0/1 which are very slow devices.
[quote="hlide"]huh... this isn't because you change your volume that it would also change your register value. I would expect for it to do so at crucial moment (exiting an application for instance). It would be crazy to change this register value whenever you modify your volume as I suppose it touches flash0/1 which are very slow devices.[/quote]
Indeed. Do you happen to know the solution?
Indeed. Do you happen to know the solution?
the solution may be somewhere in the undocumented functions of sceImpose : http://moonlight.lan.st/1.50/kd/impose.htmlMIB.42 wrote:Indeed. Do you happen to know the solution?hlide wrote:huh... this isn't because you change your volume that it would also change your register value. I would expect for it to do so at crucial moment (exiting an application for instance). It would be crazy to change this register value whenever you modify your volume as I suppose it touches flash0/1 which are very slow devices.
sceImposeChanges() ?
Or maybe there is a special kernel thread for volume as there is one for exit thread (by means of callback).
[quote="hlide"]
the solution may be somewhere in the undocumented functions of sceImpose : [url]http://moonlight.lan.st/1.50/kd/impose.html[/url]
sceImposeChanges() ?
Or maybe there is a special kernel thread for volume as there is one for exit thread (by means of callback).[/quote]
There definitely is a kernel thread for the remote ( 'SceHpRemote' with 0x6F priority ), the rest is power,battery,umd,wlan only.
About ImposeChanges, yes, ImposeGetParam and GetStatus sounds promising, do you know if anybody has some experience with these or has deciphered the call structs?
the solution may be somewhere in the undocumented functions of sceImpose : [url]http://moonlight.lan.st/1.50/kd/impose.html[/url]
sceImposeChanges() ?
Or maybe there is a special kernel thread for volume as there is one for exit thread (by means of callback).[/quote]
There definitely is a kernel thread for the remote ( 'SceHpRemote' with 0x6F priority ), the rest is power,battery,umd,wlan only.
About ImposeChanges, yes, ImposeGetParam and GetStatus sounds promising, do you know if anybody has some experience with these or has deciphered the call structs?