Uzeamp

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
Post Reply
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Uzeamp

Post by yllawwally »

Is there a tutorial for integrating the wav playing from uzeamp into other projects? I'm looking into using wavs instead of midis, and I'm finding my game crashes when mmc_masterInit is called.
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Uzeamp

Post by D3thAdd3r »

It might require some integration with the video mode itself to be feasible. I *think* that is how UzeAmp works, perhaps that could cause the problems you are having?

Closest example that came up over the years was Hartmut's Digital Thermometer Demo, which plays voice samples off the SD card while running user code. It might actually just be built on top of UzeAmp, in which case it is perhaps no more help at the lower level than UzeAmp itself is. Best advice I can come up with :|
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: Uzeamp

Post by yllawwally »

Can I just put data straight from a wav file into the mix_buf? Other than the first 43 bytes of the files which is header info.
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Uzeamp

Post by D3thAdd3r »

With the -DSOUND_MIXER=0 in the makefile, I think you can pull it off. An example of easily writing to the sound buffers at high level is here.

The part I worry about, that might need to happen during HSYNC, is all the cycles it will take(mostly waiting) to fill those buffers from SD. At least you would need to access the SD card sequentially and lower level than something like slow PetitFS. That said, I hope I am wrong as it would be very nice to have wav music in games if there is enough resources left for the game; I have never tried it. I am quite interested to hear about your results.
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Uzeamp

Post by Jubatian »

If you wrote a custom mixer for it, I think it is possible (even likely with one or two normal channels remaining for effects). A definite constraint is however that you either stream music from the SD or use it for other things, I mean for example while you are loading game data from the SD, you can't have streamed music playing at all.

Another important thing you might have to consider is what you wanted to play there. I mean the legal crap here, unless you already have a selection of GPL-ed music you want to use. Using just arbitrarily music picked off from the web could bite back later. Of course remakes and likes could already be murky, but those are usually games which were long abandonned, made free, or are not eligible for copyright by the idea, anyway, so things where it is very unlikely to ever face such a problem. Digital music is different, for a start even Youtube might auto-detect and disable it if it matches reasonably well a copyrighted source protected by DMCA. (Just noting: Actually there are lots of good open musics under various licenses including GPL. You could even reuse music from famous open source games such as Battle for Wesnoth).

For practical matters the size could be important. A large piece of music will make the game worse for downloading over the Internet. It doesn't compress very well by Zip and similar lossless methods, so don't expect something like the Tempest level file's compression ratio. A good selection of musics will make the game large.
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: Uzeamp

Post by yllawwally »

My plan is to get high quality versions of classical music, relatively high quality. Although the midi works pretty well. It seemed the resources for doing wav vs midi were pretty comparable. Roguze is basically set in the dark ages, so dark ages music would be very appropriate, such as greensleeves. If the resources in the game could handle wav, then it makes sense to use the much higher quality music. PC's have much better midi techniques, so converting a midi to a wav, would provide better sounding music.
Post Reply