Closed GoogleCodeExporter closed 9 years ago
Ah, right. I know a potential fix to this, but it had been the possible cause
of a
crash, so I kind of ignored it while we were working towards release.
Basically, it
seems like the audio volume is only read on the engine's audio
initialization... so
to change the volume you have to restart the engine.
I wanted to look into the code of the init stuff to see if there was something
specific I could use, but never got around to it.
Anyways, since I know a fix, I'll work on getting this one done today.
Original comment by wagic.jeck@gmail.com
on 30 Oct 2009 at 9:36
Oh, and the PC side of things is an even easier fix. So, yeah. starting work
now :)
Original comment by wagic.jeck@gmail.com
on 30 Oct 2009 at 9:38
Volume alteast on the PSP doesn't even look implemented...
Original comment by AgentBap...@gmail.com
on 6 Dec 2009 at 9:08
Yup, I've been pretty busy with work issues, which is why this is marked started
rather than "Fixed". I don't know when I'll have time to finish this, so I'll
probably revert it back to "Accepted" if I don't get it done soon.
Original comment by wagic.jeck@gmail.com
on 6 Dec 2009 at 10:49
If you could tell why we are having this issue, I could implement it. I have
alot of
time...
Original comment by AgentBap...@gmail.com
on 7 Dec 2009 at 4:02
The problem has to do with how the audio system is initialized, etc. I don't
have the
code in front of me, but if I remember correctly... there's a difference
between how
we ordered our volume init stuff and how the PSPSDK examples do it, and this
difference is significant (though no one seems to mention it). Also, I think
the mp3
thread has to be paused and reset, or something, to update to the new volume...
I
don't recall the details.
Somewhere on my other computer is some halfwritten sloppy code, which linked
volume
into the option menu, but did it only for music, or sfx, or something, but not
the
other. I'm afraid I never got around to finishing it, as the solution I had
wasn't
really safe enough. I understood what to do to make it work, but not /why/ to do
that... which is never a good place to be.
Original comment by wagic.jeck@gmail.com
on 7 Dec 2009 at 5:15
why doesn't this work?
if (card->isCreature()){
JSample * sample = resources.RetrieveSample("graveyard.wav");
JSoundSystem::GetInstance()->SetVolume((options[Options::SFXVOLUME].number
* .01) * 0x8000 );
if (sample) JSoundSystem::GetInstance()->PlaySample(sample);
JSoundSystem::GetInstance()->SetVolume((options
[Options::MUSICVOLUME].number * .01) * 0x8000 );
Original comment by AgentBap...@gmail.com
on 8 Dec 2009 at 7:17
Because the JGE setvolume stuff doesn't work properly, if I recall correctly.
I'm
pretty sure that SetVolume() is an empty function.
Original comment by wagic.jeck@gmail.com
on 8 Dec 2009 at 7:26
nah works on music
Original comment by AgentBap...@gmail.com
on 8 Dec 2009 at 8:40
void JSoundSystem::SetVolume(int volume)
{
JMP3 * mp3 = JMP3::mInstance;
if (mp3) mp3->setVolume(volume);
}
Yup. The source above only touches JMP3, which handles music. The SFX deals
with the
WaveData functions in JAudio. From what I recall, there's something that has to
be
done around the point of
pspAudioInit();
that sets the volume.
Original comment by wagic.jeck@gmail.com
on 8 Dec 2009 at 8:47
Alright, you've refreshed my memory enough to make it worth opening the old
files. I
set these aside when something in JGE was changed and volume felt like a low
priority.
The trick is to call
pspAudioSetVolume(0, mVol, mVol); //and for 1, and 2. All channels
after pspAudioInit. I hadn't done any testing for safety, etc. That's only a
half-fix, though, as (if I remember right) pspAudioSetVolume wasn't doing
anything
after the callbacks were set... so you'd maybe have to move it into those, or
something.
Original comment by wagic.jeck@gmail.com
on 8 Dec 2009 at 8:51
Doesn't seem to work like that... Callbacks or after init, still stays at max...
Original comment by AgentBap...@gmail.com
on 8 Dec 2009 at 6:48
Eh, if you're still having trouble with it I'll fiddle with it tonight. It
seems to
work fine on my end, and I thought that was the only major change... I'll give
it
another look. I was also doing some really messy destruction / recreation of the
audio stuff, as a proof of concept, so maybe there's a step there I missed.
Original comment by wagic.jeck@gmail.com
on 8 Dec 2009 at 6:56
[deleted comment]
[deleted comment]
I give up. This one yours...
Original comment by AgentBap...@gmail.com
on 8 Dec 2009 at 10:29
theres more to it than you said. I can only change sfx volume
JSoundSystemInit()
when it does audioinit. WHICH ONLY HAPPENS ONCE and God knows when... So how
the
hell do I implement a sfx volume change?
Original comment by AgentBap...@gmail.com
on 8 Dec 2009 at 10:40
As I said above, with "some really messy destruction / recreation of the
audio stuff".
Original comment by wagic.jeck@gmail.com
on 8 Dec 2009 at 11:03
Ok. Its fixed on the psp. Now we just need a windows version...
Original comment by AgentBap...@gmail.com
on 9 Dec 2009 at 5:06
Oh, if you're still having issues, look into FSOUND_SetSFXMasterVolume(volume);
The same code will work on both PC and Linux.
Original comment by wagic.jeck@gmail.com
on 11 Dec 2009 at 12:38
The fix for the PSP is now in the SVN. Yeshua provided the initial fix, but I
reworked it a lot because it was sub-optimal (the volume was set every time a
sound
was played) and contained some PSP specific code inside Wagic.
@AgentBaphomet: I'm doing my code review here since it's probably where you
have the
more chances to read it:
keep in mind that Wagic aims at being multiplatform, so multiplying our values
by PSP
specific values (0.01 x 0x8000) is forbidden. Or rather, you can of course have
such
PSP specific code, but it HAS to be in JGE, not in projects/mtg
Also one very important thing is that we want to have as little lines of code as
possible. The less lines of code, the less bugs. So setting the volume for each
played sample is not only suboptimal, it improves the code size, which we don't
want.
That being said, thanks a lot for the patch :)
Anybody with enough motivation to do it for Linux and/or windows? Yeshua create
the
skeletons for the methods, so it's just a matter of understanding FMOD and
filling
them...
Original comment by wagic.the.homebrew@gmail.com
on 12 Dec 2009 at 3:18
Sorry I used psp specific code man. I'll make sure my code is cleaned up next
time
Original comment by AgentBap...@gmail.com
on 12 Dec 2009 at 4:50
Fixed on linux and windows in r1696.
Please verify on linux
Original comment by wagic.the.homebrew@gmail.com
on 7 Jan 2010 at 1:57
Checked on linux : works
Original comment by jean.cha...@gmail.com
on 10 Oct 2010 at 6:12
Original issue reported on code.google.com by
Psyyri...@gmail.com
on 30 Oct 2009 at 8:54