View unanswered posts | View active topics It is currently Wed Jan 16, 2019 11:07 am



Reply to topic  [ 54 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
 dsdoom source 
Author Message

Joined: Thu Jul 02, 2009 1:19 pm
Posts: 352
I have been working on a heretic port. I have added in Pate's adlib emulator and have cobbled together something to get MUS files playing. you are welcome to it if you are interested. the drawbacks to this route are that the adlib emulator takes up 9 of the ds sound channels. I am using software mixing for the sound effects so it is not a big deal for me, as I only need two channels for that.


Mon May 23, 2011 1:29 pm
Profile

Joined: Mon May 02, 2011 10:13 pm
Posts: 28
it would be nice not to have external *.raw files, is there a stand alone version of adlib emulator for the nds ? if so where can i get it from ?

currently i am using soundPlaySample to play sfx in doom, how are you doing the software mixing for the sound effects in heretic?


Tue May 24, 2011 6:20 am
Profile

Joined: Mon May 02, 2011 10:13 pm
Posts: 28
google is god ;-) found the source to adlib

http://dsx86.patrickaalto.com/DSdown.html

so it uses channels 2-10 for sound, soundPlaySample uses the first free channel it finds so if I limit the calls to soundPlaySample to a maximum of 7 I should have enough channels to play 7 sfx + music simultaneously ;-)

so my next question is how do I use adlib to play mus / midi files ? can I have a look at your "cobbled together" code please.

not sure if this will help but if you look at the source code for chocolate doom

http://sourceforge.net/projects/chocolate-doom/

under src directory their are two files

mus2mid.c
midifile.c

these may help convert play midi files using adlib (I need to spend so time looking over the files)


Tue May 24, 2011 8:40 am
Profile

Joined: Wed Mar 31, 2010 6:05 pm
Posts: 212
this is not completely on topic, but somebody really ought to remake the doom music as mods using samples derived from the adlib patches.


Tue May 24, 2011 8:45 am
Profile

Joined: Thu Jul 02, 2009 1:19 pm
Posts: 352
here is the code for playing mus files musplay.c. This is from multiple open source projects mostly MUS File Player Library V1.75.


Tue May 24, 2011 1:35 pm
Profile

Joined: Mon May 02, 2011 10:13 pm
Posts: 28
you sir are a star thanks for the code :D

is it possiable to have a variable call back function to handle track timings ? ie do something like this

void OPL_SetCallback(unsigned int ms, VoidFn callback)
{
timerStart( 2, ClockDivider_1024, TIMER_FREQ_1024( 1000 / ms ), callback );
}

and then just call OPL_SetCallback with different values of ms, would this work ? or would I need to stop the timer in the call back function before each call to OPL_SetCallback ?


Thu May 26, 2011 4:05 pm
Profile

Joined: Thu Jul 02, 2009 1:19 pm
Posts: 352
yes, that will work it will just stomp the old timer callback. curious, what are you timing?

EDIT: not sure if that is the latest code. I will check the svn when I get home and let you know if there were updates.


Thu May 26, 2011 5:40 pm
Profile

Joined: Mon May 02, 2011 10:13 pm
Posts: 28
musplay.c calls a routine (mus_play_timer) every 1/140 seconds this routine in turns call a second function (mus_delay_ticks) which sets up a variable called MUSticks.

no music is played until this variable gets decremented to zero, it this point mus_play_tick is called. So for every call to mus_play_tick, mus_play_timer gets called

mus_play_timer * MUSticks

this is a waste of cpu time it would be better to do something like this

mus_play{

MUSticks = mus_delay_ticks();
OPL_SetCallback(MUSticks, mus_play_tick)
}

that way the routine only runs when its needed, well thats the plan I havnt got anything running yet :( will post something when I get the time to get something working !


Fri May 27, 2011 9:28 am
Profile

Joined: Thu Jul 02, 2009 1:19 pm
Posts: 352
what is that saying about premature optimization?

minimal code to get it working:
add " mus_init_music();" to S_Init
add "mus_play_music(S_music[song].name);" to S_StartSong

not 100% sure about the second one - "S_music[song].name" needs to be the name of the MUS file. this is from heretic, but it uses the doom engine so it should be similiar if not the same.


Fri May 27, 2011 1:53 pm
Profile
Site Admin

Joined: Tue Aug 09, 2005 3:21 am
Posts: 1314
Location: UK
You're wasting your time with that and I don't think converting MUS to mod will work well either. The DS arm7 isn't powerful enough for OPL emulation in C.

Your best bet for music is AdLibSrc.zip from http://dsx86.patrickaalto.com/DSdown.html

Also, the diff you made is a bit wrong, what you need to do is use svn diff directly against the code on the google code project. I'm not 100% sure offhand but I believe you can use svn add and svn remove without checkin privileges. If you deleted any files then use svn remove, for any files you added then use svn add.

The diff you attached has all sorts of stuff from the svn control files.

_________________
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog


Sat May 28, 2011 5:06 pm
Profile ICQ WWW
Display posts from previous:  Sort by  
Reply to topic   [ 54 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.
Get devkitPro at SourceForge.net. Fast, secure and Free Open Source software downloads