GP2X Gp32 To Gp2x Sound....?


Akuma no Houkon

Certified Guru
Joined
Mar 4, 2004
Messages
1,194
Age
43
Location
USA > Washington > Everett
Website
akuma.gp32news.com
Ok, somewhere along the lines I lost the actual WAV files for the SFX in one of my GP32 games.

When developing for the GP32 I had to use a special tool to dump the WAV into a header file like:
QUOTE
const unsigned char SFX_Gameover[54144] = {
0x80, 0x80, 0x7F, 0x7F, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80...


I still have these headers, but that is all, is there any way I can use them to make a wav again so I can use them in the GP2x port?

I would try hooking up the GP32 to an audio recorder but I dont have a GP32 anymore and GeePee32 doesnt support sound.

Anyone?
 
I'm rubbish with sound - but you may be able to use the data as is.

CODE
extern Uint8 SFX_Gameover[];

Mix_Chunk *SFX_GameoverMix = NULL;
int iChannel;

SFX_GameoverMix = Mix_QuickLoad_WAV(SFX_Gameover);
iChannel = Mix_PlayChannel(-1, SFX_GameoverMix, 0);
 
Easy..

1) Its hopefully in .c and not .h :)
2) Its an array representation of the binary file; no special tool is needed. Myself, I whipped up a 30 line C program to spit out arrays of my bins.. (mostly print statements for pretty formatting of the output :)
3) So you can fopen(), fwrite, fclose to spit the array out to a file again


Should be a piece of cake. Theres no magic going on, so don't scare yourself into a corner.

jeff

Wait, you've stil got the wav represented in array form?

Why notjust use that right in your gp2x? You don't need to dump it out to .wav again..

jeff
 
QUOTE
1) Its hopefully in .c and not .h smile.gif

No, I put all of my arrayed resources in a header file, so its a .h

Well first, I had the same arrays with my BMP files (for gfx on the GP32) and SDL will not load them. I had to redump them with a different tool for SDL to load, so I assume I would have to with these.

Also I am not sure if they are arrays of the pure WAV file or some weird converted file, I dont remember what was needed to get WAVs to play on the GP32....

I will try and dump one of them back to a real file and play it in Amorak to see if its a real wav dump...

UPDATE:

I dumped the array to a file, and as I thought, Amorak says that its an unsupported format. So as I thought, it was modified somehow by the tool that converted it.

Now I have some files in my sounds folder that have the extension ".sfk" and ".sef" and in my notes for PerfectFit I say "They must be in ".sef" format (mono 11,025 Hz)". I think that I had to use a tool to convert it to this format and then another to dump it as an array, does any of that ring a bell with anyone?

UPDATE 2
I found this: http://edorul.ifrance.com/gp32/ which is what I think I used for conversion, how can I undo that?
 
I can record the sounds you need off my GP32 to a line in and give them to you in any quality you want, all you have to do is tell me what sounds of what games you want and I will happily do them for you Akuma :)
 
Maybe the wav data that the program you used made from the wav file is now HEADERLESS (if it's that way, it's explained why amarok can't identify it)

if you know the original format correctly (stereo? mono? 8/16 bits? endianness? rate?) you may be able to convert it to a normal .wav using 'SOX'
 
No tiem to read too much (baby is fussing) but an FYI .. it is better to put such thing sin C files; .H files are for declarations, not implementations. Its all the same to a compiler, but structurally.. a header woudl declare the array and name, and therefore other C files could consume it. But putting the actual array into the H isn't really what headers are for.

jeff
 
But if you declare a const array, that needs to be used by multiple source files as a sort of global array, for example a list of filetypes as in:

CODE
const char snd_patterns[]=
"All Audio (*.ogg,*.mp3,*.mp2,*.raw,*.wav,*.mod,*.s3m,*.xm,*.it,*.mid,*.midi,*.wma,*.asf)"
"\nOgg Vorbis (*.ogg)"
"\nMPEG Layer 3 (*.mp3)"
"\nMPEG Layer 2 (*.mp2)"
"\nRaw Audio (*.raw)"
"\nMicrosoft WAV (*.wav)"
"\nGeneric module (*.mod)"
"\nStreamTracker3 (*.s3m)"
"\nFastTracker2 (*.xm)"
"\nImpulse Tracker (*.it)"
"\nMidi (*.mid, *.midi)"
//Macintosh AIFF
"\nWindows Media Audio (*.wma)"
"\nAdvanced Streaming Format (*.asf)"
;


If you placed this in a source file it would have to be placed before everything, at the top of you main source file so that it can be accessed by all calling functions. The same thing that a header is used for...

In my experience a header is used to separate declarations, macros, or minimal code that needs to be known by many separate source files from a general collection of functions. :)
 
You could declare extern const char snd_patterns[]; in the header file, then you can access the data from the .c file from any other .c file.

As for loading sound effects from arrays, try Mix_LoadWAV_RW(SDL_RWops file, int freesrc). Here's a tutorial on SDL_RWops
 
Back
Top