|
bit odd innit? |
killocan
Member #1,556
October 2001
|
I have a megaman clone¹ that I do some work on every year or so The thing is, and I'm in peace with it, if it's running "on the metal" the sound works fine, both windows and linux (it uses AllegroMP3²), but if I run it on a VMbox, the sounds get corrupted. It's not a VM problem because other sounds are fine. I tryed to give the VM more cpus and memory, but the problem remains, so I guess it is some deep weird magical stuff. I gave up on it years ago, but those times I decide to work on the game (because some cosmic event is playing out) I need to mute the game to avoid listening to the anoying clicks, and then I wonder (this is odd...) 1 https://github.com/killocan/mm1/ |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Hi kilocan! You said VMbox, did you mean VirtualBox or VMWare or just virtual machines in general. Bad audio is probably related to the vm sound driver. Have you mentioned this to anyone in the VBox community? I have VBox installed, I could try your megaman clone and see if I get the same results. What OS are you running for your guest machine? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
killocan
Member #1,556
October 2001
|
Hi Edgar! I'm using VirtualBox, never tried on VMWare, but I never bother to go all the way and open an issue related to that, because I'm mostly sure it's my fault Here is the game running on Windows, bare matal: https://www.youtube.com/watch?v=JAyUJrnCXMk At first I too thought it could be a driver problem, but mp3 files plays(VLC) fine on the virtualized system, it's only my game that gets the buggy sound. Now my VM is running Ubuntu 16.04.7 LTS, but I had it on 14.X and had the same issue. I suspected the almp3.a lib might be to blame, but why? I don't know... If i compile using the exact same file, under Ubuntu 16.04.7 running outside a VM, I get perfect sound. Since we are here hehehe other than mp3(ogg and like), what file format would be able to hold NES tracks like the ones from Megaman? I guess MOD? But I never found Megaman 1 music in MOD(mod like) file formats that sounded the same, so I defaulted to mp3 each many times bigger than the original game \o |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I don't have an Allegro 4 reference on this computer. I can't remember what Allegro 4 can do in terms of audio. Are you loading them as samples or streams? Can allegro adjust the audio buffer size? You might try that if possible. mp3 is the best compression you can get I believe, unless you're using MIDI. I'll check back in a bit once I'm home and I can look at the A4 manual. Edgar EDIT My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
killocan
Member #1,556
October 2001
|
Hey \o Sorry for the delay, I was having troubles accessing allegro.cc. Edgar Reynaldo said: Are you loading them as samples or streams? I use AllegroMp3 to decode the mp3 file on memory as a "SAMPLE": 1PACKFILE * mp3_file = pack_fopen(fileName.c_str(), F_READ);
2...
3if ((data_len = pack_fread(mp3_data, data_len, mp3_file)) > 0)
4{
5 mp3_handle = almp3_create_mp3(mp3_data, data_len);
6}
7...
8music = almp3_create_sample_from_mp3(mp3_handle);
And when I need to play it: I do this because I need the song to loop to a different offset other than 0, allegromp3 should do it, but it didn't work for me, so I transform it into a SAMPLE and set the sample loop position: 1music->loop_start = loop_ini;
So, in the end, what I'm playing is a regular allegro SAMPLE, a BIG one, but a memory sample nevertheless. So I'm guessing the decode process gets corrupted because it's running on a Virtual Machine, but why? It's not "that" memory intensive of an operation, and other, bigger, applications are able to run just fine. Also, I already ran the VM image on a different computer, just in case it was a problem with mine. But, I'll try to play just the smaller sounds (menu select, jump, fire, etc) without the music, I'll comment the code, to see if it's memory related. Playing a single, small, wav file should be ok. Edgar Reynaldo said: Can allegro adjust the audio buffer size? You might try that if possible. I'll try it. But if it works, I'll be guessing: "why?" Edgar Reynaldo said: mp3 is the best compression you can get I believe, unless you're using MIDI. I was not able to find a MIDI file that sounds the same, I don't know if a MIDI file "can" sound like a NES tune, and by "sound like" I mean, exactly the same. It's important that is sounds the same, because I'm trying to clone the game as much as my laziness allows Thanks!!! |
Edgar Reynaldo
Major Reynaldo
May 2007
|
The only reason I can think of why it produces clicks and pops is either it's too small a buffer size or too big. Too small and it might run out, too long and it might have delays. I don't think you can vary the audio buffer size with a SAMPLE alone, but I know you can with an AUDIO_STREAM. Have you tried playing the sound without altering the loop point? It may be misaligned when the buffers get filled. Does it click when the sample loops? ogg files are still pretty small, and sound good if you want to try an alternative. Is it just mp3s that do this? Or is it all SAMPLEs? EDIT My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
killocan
Member #1,556
October 2001
|
I tried playing just simple wav files from a dat file, and I get the same sound glitch. I'll try QEMU, because that must be some problem with the virtualization... why? that, I guess I'll never know hehehe Because I can play mp3 files (and said WAV files as well) in the virtualized Linux using VLC without any problem. Also, when running native the game sounds fine. It must be some odd thing with the virtualization. [EDIT] how it sounds native VS running on the virtualized system: I'm using allegro 4.4.2. A side note: i noticed I registered my allegro.cc user in 2001, when I was 15, holy sh**** hahahahaha |
Edgar Reynaldo
Major Reynaldo
May 2007
|
The difference may be the buffer size. SAMPLE objects are handled solely by allegro for the buffering. Like I said, you may have better luck using an AUDIO_STREAM. From listening to your examples, it seems like it could be a buffering problem. Like the default buffering is too small and runs out. Can you make a small example program that just loads a SAMPLE and plays it? That would eliminate any errors from loading from a datafile, if that is the problem. Also, if you can upload your mp3 I can try it on my VBox VM. That could eliminate using an older version of Ubuntu. Maybe your guest sound drivers need to be updated by moving to a newer version of Ubuntu. That won't help though if you want to play on legacy versions of your guest OS. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
killocan
Member #1,556
October 2001
|
Yeah, that's some problem between allegro+fake sound driver on the virtual machine. I created a simple program like you said, it just loads and plays a WAV file, the glitch remains. Since VLC works, I guess it's a Allegro + Sound Driver problem. Well... Ok hehehe I'll finish the game one day anyway I'll test it on Qemu, or test another linux distro... Not now, I have Dr Wily stages to work on first And thank you very much! I appreciate the time! I guess all those years I just assumed I was the one doing something epically wrong and never thought about testing the API:D |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Try an AUDIO_STREAM and fill the sample data yourself if you can. You're totally welcome. It's a honor to attempt to help a veteran like you kilocan! Good to hear from you! EDIT Either way you choose, I wish you good fortune and swift sailing. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
killocan
Member #1,556
October 2001
|
I'll try to feed the AUDIO_STREAM manually, most out of curiosity About porting it, I thought about it some years ago, but I do some get/put pixel stuff, to change megaman color for example (when using different weapons), and if my memory is right there is no direct putpixel/getpixel on All5 right? I think that was what put me away from it, I know I can just have megaman in each color on the spritesheet, but anyways Good to hear from you too! Always good to interact here! This is like THE forum in my S2 |
Edgar Reynaldo
Major Reynaldo
May 2007
|
get and put pixel are still there, but you need to lock the bitmap if you intend to change many pixels. Locking memory bitmaps is fast and cheap since they don't have to be downloaded from the GPU. If you keep a memory copy of your megamen and upload them to the gpu as necessary I don't think you'll see a performance hit. EDIT Bump for progress and reply. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|