forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting volume

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Zettablade



Joined: 05 May 2006
Posts: 71

PostPosted: Mon Jul 10, 2006 12:24 pm    Post subject: Getting volume Reply with quote

what's the code snippet for getting the volume?
Back to top
View user's profile Send private message
sg57



Joined: 14 Oct 2005
Posts: 154

PostPosted: Mon Jul 10, 2006 2:26 pm    Post subject: Reply with quote

volume of?

a cup.
a sphere.
a cube.

basics for volume
Back to top
View user's profile Send private message
Zettablade



Joined: 05 May 2006
Posts: 71

PostPosted: Mon Jul 10, 2006 2:50 pm    Post subject: Reply with quote

the psp's speaker. is it even possible?
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Mon Jul 10, 2006 3:06 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
sg57



Joined: 14 Oct 2005
Posts: 154

PostPosted: Mon Jul 10, 2006 4:47 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Fanjita



Joined: 28 Sep 2005
Posts: 217

PostPosted: Mon Jul 10, 2006 9:23 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
Zettablade



Joined: 05 May 2006
Posts: 71

PostPosted: Mon Jul 10, 2006 10:49 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
MIB.42



Joined: 03 Nov 2006
Posts: 5

PostPosted: Fri Nov 03, 2006 5:35 pm    Post subject: Reply with quote

[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);
}
}
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Fri Nov 03, 2006 7:49 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
MIB.42



Joined: 03 Nov 2006
Posts: 5

PostPosted: Sat Nov 04, 2006 4:17 am    Post subject: Reply with quote

[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?
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Sat Nov 04, 2006 6:52 am    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message
MIB.42



Joined: 03 Nov 2006
Posts: 5

PostPosted: Sun Nov 05, 2006 3:32 am    Post subject: Reply with quote

[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?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group