PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

PocketFrogPlus 0.2.0 released!

I have released a new version of my pocketfrog extensions. It include my sound engine (mod + sfx) and a little bitmapped font similar to gapidraw's font class.
A lot of changes in this version:

* restructured sound lib, more object oriented
* incresed sound mixing speed (all division removed!)
* fixed a stupid finetune bug (now all mods sounds perfectly)
* you can now play more than one mod at the same time (userful for jingle)
* decreased latency and mixer memory
* other that I don't remember... :)

You can download it at http://www.shlzero.com

Have fun!
Conan · 07 Feb 2003, 16:23 UTC — Which PF version is this based on ?
just checking, are your extensions working with the latest version of PocketFrog?

I really must try your sound engine. I'm looking for one where it's easy to get it working with VC6 & eVC
Yes, the package include pocketfrog 0.6.0 too and my extensions is integrated in the application framework. So you can recompile a pocketfrog 0.6.0 game based without changes and you are ready to add sound!
I've been toying with replacing my own sound library with yours (mainly because yours handles 8-bit waveforms whereas mine does not and I figure why bother rewriting mine if yours does it already).

One question: what license are your extensions released under? I'm guessing it's the same as PF itself (i.e., use it however you want, no fees, no strings, no nothing) but I wanted to make sure.

One other thing... In the previous version it was possible to change the volume of a sound FX while it was playing (specifically, one that is looping), but now that doesn't seem to be the case. Can you verify whether that should still be possible or not?

Thanks for the great work!
Yes the license is the same as PF so you can use it however you want.
Only one thing, if you use it in your project please tell me so I can know that my work is used by someone...


Yes it's possible to change the volume of a SoundFX while it's playing... In this version I have introduced the concept of channel, when you play somenthing (a mod or a sfx) the lib assign it to a channel and you can modify its state "on the fly"

Some code:
Code:


SoundFX sfx; // our sfx obj
uint32_t sfxChannelId; // our sfx channel id

// load a .wav sfx
sfx.load(_Module.GetModuleInstance(), IDR_SOUNDFX1);
// set initial volume
sfx.setVolume(48);
// set looping flag to true
sfx.setLoop(true);

// get our Sound obj
Sound *sound = GetSound();

// play sfx and get the channel id
sfxChannelId = sound->playSfX(&sfx;);

// ...

// ok, now we want to change the sfx volume...

// get the channel attached to our sfx obj
Channel *channel = sound->getChannel(sfxChannelId);
if (channel != NULL) {
channel->setVolume(30);

// you can also change the looping flag or stop a channel
// channel->setLoop(false);
// channel->stop();
}


// Oh, you can stop a sfx also using the Sound::stopSFX(uint_32 channel)
// as in previous version



Ok, with the channel object you can change the volume, the looping flag or you can stop it. This works with mods as well. You get a channel id when you play a mod too.
Ah, I see. Just a little bit different, not too much. I should be able to modify my code easy enough, thank you!

It looks like I will be using your extensions in my upcoming game (should be released some time next month). At this point I am only using it for WAV playing since I already have my own extensions for fonts, but I may wind up tracking a MOD for the game as well.

One other question: does this version also still have the limitiation on the number of channels? I think it was eight? That would translate to eight simultaneous WAVs, correct? And I assume that if eight are playing and you try and play a ninth it will override the WAV that first started playing?

This isn't an issue for my project, I just want to be sure I understand the limitations, if any, for the future.

Thanks againa!
You can play up to eight simultaneous WAVs, if you try to play a ninth and all eight sfx channel are playing the ninth wave will not be played. This because the lib was initially developed for the GameBoyAdvance where only two sfx channel were available (for speed reason) and the result was crappy if you override a wave that was playing.

But you can increase the number of channel wavs, go in the file sound.h and repleace the line
#define SFX_MAX 8 with the number of sfx that you need!

Bye
I've just discovered a problem with this version. I just verified that this does NOT occur in the previous version...

When played on my stock Casio E-125, all MODs and WAVs output choppy. I've recorded what plays for you (ignore the occasional distortions, they are a result of my moving the PPC closer and further from the microphone so I could tap the images on the screen), here's the link:

http://www.omnytex.com/choppy.wav

I thought it might have been my code, but then I realized the same thing was happening with the blit sample.

Any ideas about this? I don't think it's a device-specific issue since as I said, the previous version worked just fine.

Thanks for your help, let me know what I can do to help...
The new version works fine on my ipaq 3950. Some other pda my need more mixing memory, I've listened the file that you have recorded and I think this is the problem. Edit the file sound.h and modify the row
#define MOD_PPC_WHDR 3
with
#define MOD_PPC_WHDR 4
and rebuild your app. This should fix the problem. Let me know so I can update the library.

Thanks for the bug report :)
The library works perfectly on my 300 MHz Axim, which is one of the slowest ARM PPCs out there...

By the way, I noticed that it takes much longer to exit an app compiled with PocketFrogPlus than with PocketFrog. In PF, the exit is almost instantaneous; in PFP, it takes like 3-5 seconds. Why is that?
That did indeed fix the problem! However, set to 4 I was hearing a VERY slight little click throughtout a WAV playing... So, obviously enough, I bumped it up to 5, and everything sounds perfect now.

I had the same kind of thing in my own sound library, but this leads to a question: does this setting effect the delay from the time you tell a WAV to start playing and the time it actually DOES start playing? That's the way my library worked, I assume this would have the same effect?

Thanks for the quick help. Oh yeah, almost forgot... I see the same shutdown delay as Damian pointed out (never got around to asking you about it). I also hear a clicking when loading sounds, is this anything that can be avoided? Not a big deal to be sure, just figured I'd ask.
fzammetti wrote:
I had the same kind of thing in my own sound library, but this leads to a question: does this setting effect the delay from the time you tell a WAV to start playing and the time it actually DOES start playing? That's the way my library worked, I assume this would have the same effect?


MOD_PPC_WHDR is the number of data block that my engine can send to the sound driver queue. Every data block are a peace of memory that the mixer fill with the sound data that have to be played. When the sound driver have finished to play a data block it begin to play the next in the queue and ask the app to fill another block. If the blocks aren't enought or are too small some chip may have problem and there can be some pause before a new block can be process. So you must use larger data block or more data block to avoid the problem. MOD_PPC_WHDR * MOD_MIXBUF_22050 (or MOD_MIXBUF_11025) give you the total amount of mixing memory that the engine use... more it is and more delay you have from the time you tell a WAV to start playing and the time the wave start to sound.


fzammetti wrote:
Thanks for the quick help. Oh yeah, almost forgot... I see the same shutdown delay as Damian pointed out (never got around to asking you about it).


Oh nothing :)... I fixed the "shutdown delay" a few days ago, I'll add this and the sound croppy bugfixs on the next release that I may put on my website this weekend.

fzammetti wrote:
I also hear a clicking when loading sounds, is this anything that can be avoided? Not a big deal to be sure, just figured I'd ask.


You hear this click when you use the load(...) function?
Well, I've done no work to verify that's the point the click is heard, but I don't think there is anything else that could be causing it. I'll try and verify it tonight and let you know. I do hear the click when the blit sample is loading up too, but of course since my game is loading a lot more, it's more pronounced.

I look forward to the next release. I have to take into account the greater delay to start a sound playing now since a large part of what I'm doing is cut scenes where I'm trying to sync up lip movements. I'm not trying to get them perfect to begin with, the nature of the game is that it will actually look BETTER if they're not synced too perfectly, but after I put your fix in, my test scene of course has lip movements after the sound ends! Certainly not a big deal, and to be expected, but I have to take it into account none the less.
fzammetti wrote:
I do hear the click when the blit sample is loading up too, but of course since my game is loading a lot more, it's more pronounced.


ok because on my ppc I don't hear any click while loading...

fzammetti wrote:
I look forward to the next release. I have to take into account the greater delay to start a sound playing now since a large part of what I'm doing is cut scenes where I'm trying to sync up lip movements.


But are the dalay greater than the previous version?

Thanks
It may NOT be the sound loading... I did some very quick and dirty testing and commenting them out doesn't seem to have made any difference. As time allows I'll explore this further and let you know whatever I might find.

About the delay, it's funny but bumping that value up to 5 doesn't seem to have increased the day noticeably. My scripts that weren't synchronizing as expected were due to something else, and if there was any change in the delay it doesn't seem to have affected anything, which means it hasn't changed much more than 33ms (the scripts are designed to run at 30FPS, so 33ms/frame, and since the syncing still looks like it did before as near as I can tell, it couldn't be off more than a single frame I think). So, I guess the difference in the buffer size doesn't translate to a noticeable delay is the bottom line, which is very good!
I was wondering if it would be possible to use your sound library outside of pocketfrog. I have been searching for a decent free library, and this would be great. Is it possible to take it out and use it as a stand alone library?
Yes, it's possible to take it out and use it as a stand alone library.

As far as I've seen (but then again I havn't looked that hard) the only reason Sound is tied to PF is to get hold of the WM_ACTIVATE (and WM_SETFOCUS/WM_KILLFOCUS) window messages to Suspend and Resume the sound. And ofcourse, to init and destroy the Sound.
Yes feel free to use my sound library on your project. I have used it with gapidraw without problems and now I'm using it on my ppc graph/sound library... But if you use it send me a mail with the name of your game... :)

Oh, if you use gapidraw I can send you the latest version of my sound engine and an updated version of GapiDrawApplication.h that support my sound lib. Send me a mail if you want it.

Bye
Gersen,
I sent you an email regarding your GapiDraw implementation. Will you make it available on your website? I'm new to C++ and am trying to get sound into a gapidraw app. I'm using code from the PlayWav example off MSDN. Having problems with app locking up. I can open, play wave, close wave. But things lock up if I try to keep the wave open and play it again before closing. I played with your engine under frog, very nice, easy to implement. I'd like to use it under gapidraw.

Thanks,
Brian
I've just zipped a new version of my sound lib that anyone can use on their winCE/win32 projects. I should write some class and function documentation but I'm a bit lazy... :roll:
Tomorrow I'll send this version to anyone that have asked it with a little sample that show how to use it on a GapiDraw project.
I'll add all on my website when I have finished the documentation.