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 

GetVolume function?

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



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Tue Jan 24, 2006 10:43 pm    Post subject: GetVolume function? Reply with quote

Hello there,
I searched for a function to get the currently set volume level on psp with the +/- buttons, but couldn't find anything like that in the sdk. Maybe I have overseen it, or maybe this function just hasn't been found yet.
Would be happy if anyone here could tell me the answer.

EDIT:
And another question regarding the sceKernelLibcGettimeofday function.
What is the int it returns? And why doesn't my code return the correct timezone settings?
Code:

struct timeval t;
struct timezone tz;
sceKernelLibcGettimeofday(&t, &tz);

After this, tz.tz_minuteswest and tz.tz_dsttime are both 0? If I set GMT+1 in PSP Settings, shouldn't minuteswest be 60 (or -60?)?


Thanks a lot :)
Back to top
View user's profile Send private message Visit poster's website
sandberg



Joined: 05 Oct 2005
Posts: 90
Location: Denmark

PostPosted: Thu Jan 26, 2006 5:50 am    Post subject: Re: GetVolume function? Reply with quote

Raphael wrote:
Hello there,
I searched for a function to get the currently set volume level on psp with the +/- buttons, but couldn't find anything like that in the sdk. Maybe I have overseen it, or maybe this function just hasn't been found yet.
Would be happy if anyone here could tell me the answer.


Sadly, there isn't such function. See my earlier post.

http://forums.ps2dev.org/viewtopic.php?t=4394&highlight=

I've found a way how to do it, but I have some questions about that, which I haven't got any answer to, so I haven't tried it yet.

http://forums.ps2dev.org/viewtopic.php?t=4645&highlight=
_________________
Br, Sandberg
Back to top
View user's profile Send private message
Shazz



Joined: 31 Aug 2004
Posts: 244
Location: Somewhere over the rainbow

PostPosted: Sat Jan 28, 2006 5:33 am    Post subject: Reply with quote

Look in pspaudiolib

Code:
static psp_audio_channelinfo AudioStatus[PSP_NUM_AUDIO_CHANNELS];

typedef struct {
  int threadhandle;
  int handle;
  int volumeleft;
  int volumeright;
  pspAudioCallback_t callback;
  void *pdata;
} psp_audio_channelinfo;


At least if your app is using pspaudiolib
_________________
- TiTAN Art Division -
http://www.titandemo.org
Back to top
View user's profile Send private message Visit poster's website
sandberg



Joined: 05 Oct 2005
Posts: 90
Location: Denmark

PostPosted: Sat Jan 28, 2006 6:17 am    Post subject: Reply with quote

Shazz wrote:
Look in pspaudiolib

Code:
static psp_audio_channelinfo AudioStatus[PSP_NUM_AUDIO_CHANNELS];

typedef struct {
  int threadhandle;
  int handle;
  int volumeleft;
  int volumeright;
  pspAudioCallback_t callback;
  void *pdata;
} psp_audio_channelinfo;


At least if your app is using pspaudiolib


Thanks, but that doesn't work. pspaudiolib only reports back what you have set with the pspAudioSetVolume function, as it can be seen from the code below. It cannot report the global volume, since there is no API to get this value.

Code:


void pspAudioSetVolume(int channel, int left, int right)
{
  AudioStatus[channel].volumeright = right;
  AudioStatus[channel].volumeleft  = left;
}


_________________
Br, Sandberg
Back to top
View user's profile Send private message
Shazz



Joined: 31 Aug 2004
Posts: 244
Location: Somewhere over the rainbow

PostPosted: Sun Jan 29, 2006 1:33 am    Post subject: Reply with quote

I agree :D That was why I mentioned "At least if your app is using pspaudiolib" as at init, the volume is init'd to the max. So that's a little virtual :D but enough ?

Else.. you can use
Code:
int sceAudioChangeChannelVolume(int channel, int leftvol, int rightvol);


Set it then you know the value and you can handle it. Not really different but....
_________________
- TiTAN Art Division -
http://www.titandemo.org
Back to top
View user's profile Send private message Visit poster's website
sandberg



Joined: 05 Oct 2005
Posts: 90
Location: Denmark

PostPosted: Sun Jan 29, 2006 2:59 am    Post subject: Reply with quote

Shazz wrote:
I agree :D That was why I mentioned "At least if your app is using pspaudiolib" as at init, the volume is init'd to the max. So that's a little virtual :D but enough ?

Else.. you can use
Code:
int sceAudioChangeChannelVolume(int channel, int leftvol, int rightvol);


Set it then you know the value and you can handle it. Not really different but....


Thanks again, but that won't work either :) You still wouldn't know the volume level. You can set it to some initial level, but when the user presses the + or - volume button or uses the head remote, you have no clue what the volume is anymore.
_________________
Br, Sandberg
Back to top
View user's profile Send private message
Shazz



Joined: 31 Aug 2004
Posts: 244
Location: Somewhere over the rainbow

PostPosted: Sun Jan 29, 2006 6:56 am    Post subject: Reply with quote

Ok I did not catch the goal was to get the volume set by the +/- buttons...

It seems (or I'm wrong) that there is physical volume (speakers) and logical volume (audio).... I did not try to catch +/- pad events to modifiy the "soft" volume instead...should be feasible, not ? Else.... dunno :D
_________________
- TiTAN Art Division -
http://www.titandemo.org


Last edited by Shazz on Mon Jan 30, 2006 4:34 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
sandberg



Joined: 05 Oct 2005
Posts: 90
Location: Denmark

PostPosted: Sun Jan 29, 2006 6:23 pm    Post subject: Reply with quote

It'll all the same volume. You just don't have normal access to read the volume set by the system.
I've also tried to figure out how to notify presses on + and -, but that doesn't seem possible either. So it seems like I'm stuck here :)
_________________
Br, Sandberg
Back to top
View user's profile Send private message
Shazz



Joined: 31 Aug 2004
Posts: 244
Location: Somewhere over the rainbow

PostPosted: Mon Jan 30, 2006 4:34 am    Post subject: Reply with quote

Even in kernel mode ?
_________________
- TiTAN Art Division -
http://www.titandemo.org
Back to top
View user's profile Send private message Visit poster's website
sandberg



Joined: 05 Oct 2005
Posts: 90
Location: Denmark

PostPosted: Mon Jan 30, 2006 5:03 am    Post subject: Reply with quote

Yep. At least no values are defined for those buttons, and nothing seems to change in the latch registers, even in kernel mode.
_________________
Br, Sandberg
Back to top
View user's profile Send private message
Shazz



Joined: 31 Aug 2004
Posts: 244
Location: Somewhere over the rainbow

PostPosted: Sat Feb 04, 2006 4:18 am    Post subject: Reply with quote

That's weird... what makes you think that the voume controlled by those two ghost buttons and the volume controlled by soft are the same (and not as I was wondering speaker vs chip volumes) ?

That's so strange how they seem both decoupled...

Do we have some hardware audio registers ? Time to look at groepaz's doc ;D

And mybe try to look what we have there :
Code:
-------------------------------------------------------------
-------------------------------------------------------------
-  audio.prx
-------------------------------------------------------------
-------------------------------------------------------------
0xbe000000
0xbe000004
0xbe000008
0xbe00000c
0xbe000010
0xbe000014
0xbe000018
0xbe00001c
0xbe000020
0xbe000024
0xbe000028
0xbe00002c
0xbe000038
0xbe00003c
0xbe000040
0xbe000044
0xbe000050
0xbe000060
0xbe000070
0xbe000080


And if the PSP audio chip is similar to the WM8750L, we should find the volume ;-)
Note : I hope this doc is public, found on Groepaz's website. Else I'll get it out.



It could be interesting to monitor those registers (at least memory blocks) to see if something move while pushing the buttons... I'll test if I'll find some time.
_________________
- TiTAN Art Division -
http://www.titandemo.org
Back to top
View user's profile Send private message Visit poster's website
Fanjita



Joined: 28 Sep 2005
Posts: 217

PostPosted: Sun Feb 05, 2006 10:08 am    Post subject: Reply with quote

BTW, you should be able to read the volume buttons.

In VSH mode, you can use vshCtrlReadBufferPositive to read the buttons, and the following values register for Vol+ and Vol- :

00200000 : vol -
00100000 : vol +

As far as I know, sceCtrlReadBufferPositive, and similar functions, should read the same values in kernel mode, but I haven't tested it.
_________________
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
weltall



Joined: 20 Feb 2004
Posts: 310

PostPosted: Sun Feb 05, 2006 4:45 pm    Post subject: Reply with quote

but in this way you don't know what was the starting volume you know only that it's more or less than before... or am i wrong?
Back to top
View user's profile Send private message Visit poster's website
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