| |
Optimus
Registered: Jan 2002 Posts: 122 |
Music fading, file loading
I don't know anything about music coding, more than just initialiazing and calling the player. But how easy it is to fade out the music? Do I have to write SID code? My last choice would be to write the music so that it fades in one point, but perhaps I would prefer to press a key and music fading at any point..
Then, is there a system call or anything to load a PRG file from the disk? So that I can load from my asm code the next part of my demo. A simple example..
p.s. I know I should be searching this in my docs instead before asking here, but somehow I felt I don't have much time. I hope you can give me an answer, I am still learning a bit..
|
|
| |
Case
Registered: Aug 2002 Posts: 142 |
Some music players have there own "fade" routines in, or another way to do it is to find the player's volume code ($d418) and write a routine that decreases this.
there are kernal routines for loading from disk, however they are very slow. I would suggest you look at some of the old multi-part demos and find the fast-loaders they used and then use it yourself ... or make yourself a cool irq loader, theres loads of them out there (covert bit-ops) for example.
|
| |
SIDWAVE Account closed
Registered: Apr 2002 Posts: 2238 |
find the byte in player that controls D418, then:
LDA .volume
ORA #$10 (if filter is 10, else use 30 or 00)
use what the player uses!
STA D418
RTS
if you find the STA D418 in musicplayer, and replace with JSR to your new small routine..
Then decrease value of .volume to fade..
|
| |
Optimus
Registered: Jan 2002 Posts: 122 |
>there are kernal routines for loading from disk, however they are very slow
I was afraid of that. However, the files of the parts might not be that big. Now I am thinking it again, perhaps I will just fit both parts compressed in memory and uncompress each part when I need it. Like an onefiler.
Thanks for the rest about the music. Sounds easy.. |
| |
Vai
Registered: Mar 2002 Posts: 50 |
What I normaly do for music fade: replace the sta $d418 in the player to $03ff (or whatever you want ;) )
Than implement this in the init of your code:
lda #$0f
sta $03fe
...
Than place this in the IRQ:
lda $03ff
and #$f0
ora $03fe
sta $d418
...
If you decrease $03fe in a small timer till 0 the music fades nicely.
|
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
optimus:
most (or all?) "modern" music players have a subroutine for fadeout. Look at the player, you should find more jmps than just those 2 to the play and the init routine. Check what the rest of the jmps do, you should find one that plays with d418, or controlls some other part of the player that writed d418.
btw, about d418: the lowmost 4 bits are for the volume, and the 4th bit (4th, if you count em from 0) is for filter, now as 99.9% of music uses filter better leave this bit on, if you plan to controll d418 "manually".
for faaast loading download this release:
Fixup #$00
read the note for instructions.
you should know, that fastloaders replaces the code inside the 1541, so there's a quite big init routine for those loaders with the code for the drive, that will be send into the drive during init. Now this part you can run only once, then forget about it, and just have the loader in the memory.
happy coding! |
| |
ready.
Registered: Feb 2003 Posts: 441 |
I was looking for an IRQ loader a few months ago, I found useful The Dreams loader. Look at http://www.the-dreams.de Go to the source-codes section and download Dreamload V2.3, I found it easy to use. Also get the XA assembler to compile the loader source code from the same site. Hope you've got all ya need, if not just ask. later Ready.
|
| |
St0fF
Registered: Oct 2002 Posts: 40 |
music fading: well yes, most newer players have a fade routine. on the other hand: the volume is very rarely changed in most tracks, if it gets changed at all - so just count down the register of the player, where the volume resides(the one that or_s in the low nybble before storing to $d418). nothing is easier than this.
Dreamload: has very low transfer speed for 2bit transfer if you don't have a lot of rastertime. it's in the way Doc Baccy coded the transfer - doing the gcr-decode while transferring ... |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
Talking about loaders, if you want the easiest solution, then use a non-irq loader. This means no music/gfx while loading, but it's faster, fills less and is much easier to use.
For instance you can rip the loader I have used in You Know The Routine 1+2. In the first part of YKTR1 it's placed in $0a00-$0bff, but has to be copied to $c000 before loading. Then you just need to put the filename (or some of the first chars followed by a '*') into $c1e3, and jsr $c000 to load a file. |
| |
HCL
Registered: Feb 2003 Posts: 728 |
A fast IRQ-loader reaches about 75% speed of a fastloader, and you can play music + show gfx meanwhile. -> The break will feel much longer with a fastloader (my opinion). |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Agree, and an IRQ-loader isn't that hard to use either, just make sure that the image you're displaying and the music you're playing + the code for handling this doesn't collide with the new part that you're loading.
/JackAsser |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
I'm not sure I believe that 75% of fastloader speed, but anyway, the main advantage of a fastloader is that it only fills about $200 bytes. This means that the previous part can use all the remaining $fe00 bytes (99.2% of the mem.) An irq-loader takes more, plus you need some gfx or other stuff that also eats bytes => less memory for the previous effect. |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
no argument actually, since an irqloader once installed also is about 1 to 2 blocks in memory. the one in deus ex machina uses less than $0200 bytes, but $0100 bytes is translation tables which can be avoided with better code. |
| |
hollowman
Registered: Dec 2001 Posts: 474 |
the smallest version of krills loader i've used takes $0100 bytes after install. |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
$100 for an irq-loader? Guess I'm outta excuses then. :) Ok, you still need some extra space for loader gfx/fx, but if the memory is filled up I guess you could just have a blank screen w/ music for a little while, while loading some loadertainment-stuff.
Guess it would be possible to make a fastloader that fills less than $100 though, if it was installed once like an irq-loader. And I would still recommend the fastloader option for n00b's like Optimus. :) |