GetVolume function?

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

GetVolume function?

Post by Raphael »

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: Select all

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 :)
sandberg
Posts: 90
Joined: Wed Oct 05, 2005 1:25 am
Location: Denmark

Re: GetVolume function?

Post by sandberg »

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? ... 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? ... highlight=
Br, Sandberg
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

Look in pspaudiolib

Code: Select all

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
sandberg
Posts: 90
Joined: Wed Oct 05, 2005 1:25 am
Location: Denmark

Post by sandberg »

Shazz wrote:Look in pspaudiolib

Code: Select all

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: Select all


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

Br, Sandberg
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

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: Select all

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
sandberg
Posts: 90
Joined: Wed Oct 05, 2005 1:25 am
Location: Denmark

Post by sandberg »

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: Select all

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
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

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
Last edited by Shazz on Mon Jan 30, 2006 4:34 am, edited 1 time in total.
- TiTAN Art Division -
http://www.titandemo.org
sandberg
Posts: 90
Joined: Wed Oct 05, 2005 1:25 am
Location: Denmark

Post by sandberg »

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
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

Even in kernel mode ?
- TiTAN Art Division -
http://www.titandemo.org
sandberg
Posts: 90
Joined: Wed Oct 05, 2005 1:25 am
Location: Denmark

Post by sandberg »

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
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

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: Select all

-------------------------------------------------------------
-------------------------------------------------------------
-  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.

Image

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
Fanjita
Posts: 217
Joined: Wed Sep 28, 2005 9:31 am

Post by Fanjita »

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!
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

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