Jump to content
popmilo

How to stop RMT music playing but keep SFX working ?

Recommended Posts

Hi guys !

Anybody knows how to stop RMT music play but keep sfx playing ?

I've tried stopping music, disabling irq (that calls music play), but I either get music+sfx or nothing...

 

I would like to turn of music so it doesn't waste cpu time, but keep possibility of playing sfx when needed.

 

Any help appreciated !

Vladimir

 

Share this post


Link to post
Share on other sites

Looking at the player's entry points, wouldn't the rmt_sfx be the desired call?

e.g. set A,X and Y and then JSR RASTERMUSICTRACKER+15

 

RASTERMUSICTRACKER
jmp rmt_init
jmp rmt_play
jmp rmt_p3
jmp rmt_silence
jmp SetPokey
IFT FEAT_SFX
jmp rmt_sfx ;* A=note(0,..,60),X=channel(0,..,3 or 0,..,7),Y=instrument*2(0,2,4,..,126)
EIF
rmt_init

 

 

Share this post


Link to post
Share on other sites

Just add an empty song line with a loop to that line in the RMT file and initialize to it when you want to shut up the other voices.

 

  ldx #<MODUL ;low byte of RMT module to X reg
  ldy #>MODUL ;hi byte of RMT module to Y reg
  lda #Silence ;starting song line 0-255 to A reg
  jsr RASTERMUSICTRACKER ;Init

I hope this helps...

  • Like 2

Share this post


Link to post
Share on other sites

Generally wouldn't you want to resume music playback where it stopped?

 

The silence call would be the way. I thought about this problem and associated things in the past. The solution I deduced is to modify the player to store to shadow registers for AUDC/F etc. Then copy those registers to Pokey with your own code.

This was in aid of doing buffering of music data for situations where you wanted maximum CPU availability. Such a method could also allow selective muting or quieting of part or all of the song instruments while keeping effects at normal volume.

Share this post


Link to post
Share on other sites

Thanks guys !

 

@Wrathchild: sfx is not a problem. It works so good that I don't need music at all ;)

 

@Vitoco: sounds like most promising solution. Will try when I get home !

 

@Rybags: My game has music on title screen and then when game starts only sfx. When player dies or gets to the end of level I need to play another "song". So no resume music needed.

Call to "stopmusic" did nothing for me. Music plays as without that call... Who knows, maybe I didn't setup something properly.

 

Shame we only have such a limited choice of music trackers on A8. Would be great to have something current with online repo that we could all contribute to. If I had any music inclination or talent I would jump on it, but alas I'm total anti-talent music wise :)

Share this post


Link to post
Share on other sites

I use goto procedure to fast change music pattern.

What exactly do you mean by "goto procedure" ?

Share this post


Link to post
Share on other sites

I use "goto" procedure to play chosen song line. I use "Init" only on beginning.

 

Song lines takes last bytes of .rmt file.

rmt_goto=last address of song.rmt + 1 - (number of song_lines)*4

then

mwa #rmt_goto+number_song_line_to_play*4   p_song
jsr GetSongLine

example:

 

if I load song.rmt to adr=>from $A506 to $B6FF , and I have song lines from 00 to $1E, and I want play 6 song line

rmt_goto= $B6FF+1-1F*4 ;= $B6FF - $7B = $B684
mwa   #rmt_goto+6*4   p_song
jsr GetSongLine
Edited by shanti77
  • Like 1

Share this post


Link to post
Share on other sites

My game has music on title screen and then when game starts only sfx. When player dies or gets to the end of level I need to play another "song". So no resume music needed.

 

That is very similar to what I did in my game Toy'Swap. The RMT has a main song for the title screen, a song for the end of game (just some chords), and a blank song. During the game it is possible to toggle on/off the same main title by pressing OPTION, which swaps between the main and the blank songs, but by default the main song is on.

Share this post


Link to post
Share on other sites

You can set RMTGLOBALVOLUMEFADE variable to $F0 (if this feature is used) to mute the music and SFX will still work. Only that the music play continues and eats the CPU time.

Share this post


Link to post
Share on other sites

With "rmt_goto" you can off music (go to songline with empty tracks) but not stop gfx. This method is also faster than rmt_init.

Edited by shanti77

Share this post


Link to post
Share on other sites

This thread reminds me, I wanted to see why songs that end by just looping on a blank line suck so much CPU. All the songs I had for my project do that, but is there a better way of a song ending itself?

Share this post


Link to post
Share on other sites

The original music you had before the switch to rmt appeared to no have that problem. Sure would have made life easier as you were getting ready to let the bird leave the nest if rmt didn't eat as much as it did.

Edited by _The Doctor__

Share this post


Link to post
Share on other sites

Much more basic than RMT though, certainly nothing a musician could do anything fabulous with. Just a slightly extended sfx player.

Share this post


Link to post
Share on other sites

Make a blank song line somewhere and loop back to it inside the RMT song file. Either at the end of the song file. For Multiple songs on one file, just goto where the loop is. If you want your program to stop the song after a time or some event, just set song line to where the loop is.

Share this post


Link to post
Share on other sites

That's pretty much what I thought they are doing already. I will have another look though as CPU use on end loop may not be as bad as I remember. Thanks

Share this post


Link to post
Share on other sites

Hmmm.... Something is seriously wrong with my code... Although I can't find errors :(

 

Only way I managed to silence the song is by deleting all song data from my RMT file, and inserting single empty line at position zero, and loop back to it.

 

That way game starts silent and all sfx work.

 

What ever I tried with setting start position in song didn't work...

Code I tried is this:

                ldx #<MODUL                 ;low byte of RMT module to X reg
                ldy #>MODUL                 ;hi byte of RMT module to Y reg
                lda #$0A                    ;starting song line 0-255 to A reg
                jsr RASTERMUSICTRACKER      ;Init

What ever I put in aumulator doesn't change a thing. Song always started from start.... I looked for any other kind of init that would mess with that and didn't find any....

 

If anyone has a simple music play src demo with rmt file I would appreciate if you could upload it here for testing with my own rmt.

 

Thanks !

Share this post


Link to post
Share on other sites

How you do export RMT?

 

You must check only SFX support , enter start address and use "Copy all to clipboard" then , paste it to rmt_feat.asm

 

Rmt_player takes also memory before PLAYER address.(-$400)

Share this post


Link to post
Share on other sites

You are just doing "jsr rastermusictracker+3" in VBI, nothing else?

Yes. Once per frame I call it just like that. And music plays so I don't see a problem there...

 

How you do export RMT?

 

You must check only SFX support , enter start address and use "Copy all to clipboard" then , paste it to rmt_feat.asm

 

Rmt_player takes also memory before PLAYER address.(-$400)

SFX support is checked and I guess that's why sfx work. I do copy rmt_feat settings to my source.

Memory before PLAYER is reserved ... I will check that to make sure it isn't used by anything else...

 

Looking at that setting "play song always from 0" looks like exactly what my xex is doing... Even thou that flag is not set. I'll try experimenting with it...

 

If it doesn't help, I'll make a small example and post it here, so some good person could compare it and maybe discover what's going on :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...