Sorry Ive didnt see these posts, my response emails stopped. So I didnt know anyone replied.
hmm, i forgot what I was really coming to this thread to post..the volume argument made me forget. I have a version that puts the status bar in the blank bar at the bottom. It works pretty good, expect that when you the in the menu you get whatever was in that area from a previous blit. In other words, if you start a game and it draws the menu down there and you go back to the menu you still see the status bar. It deosnt effect gameplay or the game, its just a graphical impurity. If anyone really wants it I can provide it.
To Thunor:
I didnt test the shareware version. I might have to compile a different version. Ill look into it
To Rivroner:
Which version are you trying to run? If you can give me a telnet like Thunor if might help. Basically I need more info if you want help.
To A_SN:
ok, ok. I didnt really you to take this that seriously. Insults/joking aside...you seem to want to help with the problem, so here you go:
CODE
void GP2X_AdjustVolume( int direction )
{
if( volume <= 10 )
{
if( direction == VOLUME_UP ) volume += VOLUME_CHANGE_RATE/2;
if( direction == VOLUME_DOWN ) volume -= VOLUME_CHANGE_RATE/2;
}
else
{
if( direction == VOLUME_UP ) volume += VOLUME_CHANGE_RATE;
if( direction == VOLUME_DOWN ) volume -= VOLUME_CHANGE_RATE;
}
if( volume < VOLUME_MIN ) volume = VOLUME_MIN;
if( volume > VOLUME_MAX ) volume = VOLUME_MAX;
printf( "Volume Change: %i\n", volume );
unsigned long soundDev = open("/dev/mixer", O_RDWR);
if(soundDev)
{
int vol = ((volume << 8) | volume);
ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
close(soundDev);
}
}
The original problem was that there was loud sound using headphones, (note if you dont use headphones the gp2x speaker volume isnt too loud.)
The volume is an integer value, it could be 0-255. Capping it at 100 is irrevelant to the problem.
The important lines are these:
CODE
int vol = ((volume << 8) | volume);
ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
So say I send the number 10 in hex its 0A. Shift it right you get 0A00 then OR it with 0A gives you a final answer of 0A0A.
That tells me that the upper 8 bits is for one channel and the lower 8 is for the other channel.
Then you just write it to the device.
The lowest volume possible would be , but its still too loud using headphones. Thats the problem.
Using 100 all I did was limit how loud the volume can get, if I use 255 all i will do is make it possible to make the sound louder. It has no effect on the how low/quiet I can make the volume go.
And your logarithmic stuff, doesnt have anything to do with the problem, all it would do is make it quicker to get from a low volume to a high volume.
Let me know if you can give me any insight in how /dev/mixer really works.
Edited by Pickle, 18 February 2008 - 05:36 PM.