|
Author |
Message |
kas1e
Member |
Can anyone here explain, how i can play mod format from my code? (i mean not any 3d libs, but write little player). I am in interesting of 'depacking' stage. What i need to do ? check header, load samples as raw data and play it in some period or what ? Thanks.
|
noname
Member |
Although it doesn't feel right to answer this I would like to point you to possible starting points. Check existing source-codes of replayers like Protracker, Tracker Packer or The Player.
There are a lot of old replayers on Exotica.
And some of the more recent ones at Amiga Stuff.
For your high end application (I assume it is for your mag) I reckon you might be interested in some soundcard compatible player. I think Digibooster and AHI might be interesting then. I still wonder how think about 3D libs in this context but it might just have been a type.
Happy coding.
|
winden
Member |
kas1e, the problem with "writing my own little player" in regard to MODs is that many 4ch mods use commands very heavily and will sound wrong if your replayer is not 100% bug-for-bug compatible to the tracker. There is the old quote about the time when Moby first joined Sanity, something along the lines of "The fact is that Chaos is the only coder I've ever met which has fixed his tweaked his player so that my mods play fine, instead of telling me that I should fix my mods so that they play fine on his traker". So my recomendation for this case, if you don't want to have problems with mods people send you, is to use a standard well-tested player.
|
kas1e
Member |
@noname
3d libs i mean 3dparty libs (sorry for mistake) like ptahiplay, dbm.library, etc.
so, if someone in interest, i can talk a little why i think about my own player (sorry for bad english, no time for check).
well, for full compatiblity over a1/peg/classic i must to use ahi, and, ahi have 2 'interface' of coding, low-level - full access to ahi.device, and as result all programms which will write as 'low-level' can't do nice feature - mixing of sounds. hi-level - it just as shared library, and any just raw data can be write by CMD_WRITE. So, all programms which will write as 'hi-level' can do mix, (for example two programms can works and play sounds at the same time).
for, me, i will want to play module, and do some 'splash' sounds (like menu choice, scrolling, etc). And of course, all 3d party libs (dbm.player, ptahiplay) which works over ahi, was write in 'low-level' style. So, no mix of sound.
and in end, i think about 2 ways: 1. write my own mod player over 'hi-level' ahi interface. and 2. just use mp3 with 22100/mono/etc, over mpega.library. modules conver pretty nice to mp3, but of course for example mod per 200 kb. will be as 1 mb in mp3. writing of mp3 player over 'hi-level' ahi apos - it easy work, but as i understand writing own ptreaplay it really hard..
|
krabob
Member |
mod. format was really simple and dumb. It has just some name/info tag with a contant length, the number of pattern and sample, then the patterns, all 1024 byte long because all had 4 voices ( 64*4*4), and so, sample number+effect weight 4 bytes. then the 8bit samples were at the end, indexed by a table before the pattern I guess...
google is your friend, try mod+format+4xx, ...
|
kas1e
Member |
btw, today i try to compare ptahiplay and mp3 play over ahi with 22100/mono, and .. rezult is strange, but it looks like mp3 player take not so much cpu loading over ptahiplay.
|
rload
Member |
ptahiplay you say? the only thing I need to port all eph demos to Pegasos is some good protracker player based on AHI. Where did you find it? Is it much work to adapt it (make it play setting up AHI and all)?
|
kas1e
Member |
i get it here: http://www.neoscientists.org/~tmueller/ptplay/
here is port for morphos too (over gcc). I use it only for 68k over sasc (was tryed few times to port it to vbcc, but tired with it and i use sasc anyway mainly). for using, think sources looks like not very easy for brief look, srcs with hooks /call backs/ etc. also as i said, here is low-level ahi coding, so, no mixing of any other sounds.
some time ago i was talk with one of authors, and hi said this:
Ptplay is almost as simple as that:
ptmod = pt_init(modbuf, buflen, mixfreq);
while (!finished)
{
pt_render(ptmod, buffer_left, buffer_right, bytes_per_sample,
num_samples, 1, 16, 2); /* no oversample, 16 bit, stereo */
playaudio(buffer_left, buffer_right, num_samples);
}
pt_free(ptmod);
If you want to have such a library to actually play the audio stream,
then this would be outside the scope of the core routines. We added
the commandline player for the exact reason of demonstrating how it can
be done on the Amiga (mind you, playing via audio.device or hardware
would look entirely different).
but if compare it with ptreplay.library, where is only open/loadl/play/stop, it little different, but usable anyway.
|
rload
Member |
oki.. I'm currently using VBCC now. I've just got a sense of deja vu. Maybe I've tried this one before. Anyway I'll have a look. Thanks!
|
kas1e
Member |
rload , if you will be in interest port it to vbcc, we can cooperate with it, i already have sources which will compiled over vbcc, but just halt amiga after running ;) i think it is becouse sasc use always FAR data mode, etc, and i just stop on it, but if you will in interest we can compete it for happy using :)
|
krabob
Member |
...mmm I'm going to code a ptplay.fx plugin for karate at ONCE, to redirect this library.
... And as I'm thinking about it... a member of the morphos team once send me the source of dbplayer.library (680X0,SASC, half C, half ASM.). It was done by one of the venus art coder in their 1998 PPC period, and now "they don't give a shit about it". The MOS guys asked me to port it native to MOS at the time their AHI was buggy, but finnaly the lib is well emulated on MOS now.... but not on OS4 (some circular buffer modulo buggs it seems) ! So converting the thing to pure portable C is one of the thing I could/should do.
...
...
but oh my god, making a player library by format is a real shit !!! We should code more object and have such an intelligent plug interface like
they did on DELITRACKER. and actually, the abstract perfection should be : using dataypes, because a sound interface by applicationon a systeme is redundant shit; But dtt miss some features like:
- attaching callbacks to sound events.
- get the sound signal to make some FFT effects.(<- not sure).
|
kas1e
Member |
krabob, you port it over low-level ahi interface, or over hi-level ?
|
krabob
Member |
dbplayer is already using AHI. I don't know for the low or high level interface.
Its just , I had to port it PPC native & correct minor buggs.
|
kas1e
Member |
krabob, in other words, it can do mixing of sounds, or now ? becouse i am test a original 68k version of dbplayer, and it use lowlevel ahi interface which do not allow to mixing sounds ..
|
|
|