Getting volume

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Zettablade
Posts: 71
Joined: Fri May 05, 2006 5:59 pm

Getting volume

Post by Zettablade »

what's the code snippet for getting the volume?
sg57
Posts: 144
Joined: Fri Oct 14, 2005 2:26 pm

Post by sg57 »

volume of?

a cup.
a sphere.
a cube.

basics for volume
Zettablade
Posts: 71
Joined: Fri May 05, 2006 5:59 pm

Post by Zettablade »

the psp's speaker. is it even possible?
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

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..
Shoot Pixels Not People!
Makeshift Development
sg57
Posts: 144
Joined: Fri Oct 14, 2005 2:26 pm

Post by sg57 »

There is. Look at IrShell.

Check out the Doxygen on the sceAudio junk.

Its probably

sceAudioSetChnlAudiolLevel(int channel#, int vol)

Im guessing what to look for, but im positive ive seen it somewhere.
Fanjita
Posts: 217
Joined: Wed Sep 28, 2005 9:31 am

Post by 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.
Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you!
Zettablade
Posts: 71
Joined: Fri May 05, 2006 5:59 pm

Post by Zettablade »

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.
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?
MIB.42
Posts: 5
Joined: Fri Nov 03, 2006 5:29 pm

Post by MIB.42 »

[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(&reg, 0, sizeof(reg));
reg.unk1 = 1;
reg.namelen = strlen("/system");
reg.unk2 = 1;
reg.unk3 = 1;
strcpy(reg.name, "/system");
if(sceRegOpenRegistry(&reg, 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);
}
}
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by 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.
MIB.42
Posts: 5
Joined: Fri Nov 03, 2006 5:29 pm

Post by MIB.42 »

[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?
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

MIB.42 wrote:
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.
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.html

sceImposeChanges() ?

Or maybe there is a special kernel thread for volume as there is one for exit thread (by means of callback).
MIB.42
Posts: 5
Joined: Fri Nov 03, 2006 5:29 pm

Post by MIB.42 »

[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?
Post Reply