Jump to content

Photo

How to stop RMT music playing but keep SFX working ?

music rmt sfx source coding asm

20 replies to this topic

#1 popmilo OFFLINE  

popmilo

    Stargunner

  • 1,573 posts
  • Location:Senta, Srbija

Posted Mon Feb 19, 2018 3:30 PM

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

 



#2 Wrathchild ONLINE  

Wrathchild

    River Patroller

  • 2,153 posts
  • Location:Reading, UK.

Posted Mon Feb 19, 2018 4:04 PM

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
 

 

 



#3 vitoco OFFLINE  

vitoco

    Moonsweeper

  • 330 posts

Posted Mon Feb 19, 2018 7:31 PM

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...



#4 Rybags ONLINE  

Rybags

    Gridrunner

  • 16,029 posts
  • Location:Australia

Posted Tue Feb 20, 2018 1:40 AM

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.



#5 popmilo OFFLINE  

popmilo

    Stargunner

  • Topic Starter
  • 1,573 posts
  • Location:Senta, Srbija

Posted Tue Feb 20, 2018 2:32 AM

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 :)



#6 Rybags ONLINE  

Rybags

    Gridrunner

  • 16,029 posts
  • Location:Australia

Posted Tue Feb 20, 2018 3:06 AM

It's been a while... possibly an empty "null" song or something could help.



#7 shanti77 OFFLINE  

shanti77

    Chopper Commander

  • 168 posts
  • Location:Poland

Posted Tue Feb 20, 2018 5:04 AM

I use goto procedure to fast change music pattern.

#8 popmilo OFFLINE  

popmilo

    Stargunner

  • Topic Starter
  • 1,573 posts
  • Location:Senta, Srbija

Posted Tue Feb 20, 2018 8:24 AM

I use goto procedure to fast change music pattern.

What exactly do you mean by "goto procedure" ?



#9 shanti77 OFFLINE  

shanti77

    Chopper Commander

  • 168 posts
  • Location:Poland

Posted Tue Feb 20, 2018 10:06 AM

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, Tue Feb 20, 2018 10:07 AM.


#10 vitoco OFFLINE  

vitoco

    Moonsweeper

  • 330 posts

Posted Tue Feb 20, 2018 10:07 AM

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.



#11 MaPa OFFLINE  

MaPa

    Dragonstomper

  • 961 posts
  • Location:Czech Republic

Posted Tue Feb 20, 2018 11:17 AM

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.



#12 shanti77 OFFLINE  

shanti77

    Chopper Commander

  • 168 posts
  • Location:Poland

Posted Tue Feb 20, 2018 11:38 AM

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, Tue Feb 20, 2018 11:38 AM.


#13 Sheddy OFFLINE  

Sheddy

    Dragonstomper

  • 771 posts
  • Location:UK

Posted Tue Feb 20, 2018 12:11 PM

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?

#14 _The Doctor__ OFFLINE  

_The Doctor__

    Flux Capacitor Master Craftsman

  • 6,537 posts
  • Location:10-0-11-00:02

Posted Tue Feb 20, 2018 1:07 PM

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__, Tue Feb 20, 2018 1:08 PM.


#15 Sheddy OFFLINE  

Sheddy

    Dragonstomper

  • 771 posts
  • Location:UK

Posted Wed Feb 21, 2018 3:03 AM

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

#16 peteym5 OFFLINE  

peteym5

    River Patroller

  • 2,378 posts
  • Location:Buffalo NY USA

Posted Wed Feb 21, 2018 6:40 AM

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. 



#17 Sheddy OFFLINE  

Sheddy

    Dragonstomper

  • 771 posts
  • Location:UK

Posted Wed Feb 21, 2018 11:50 AM

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

#18 popmilo OFFLINE  

popmilo

    Stargunner

  • Topic Starter
  • 1,573 posts
  • Location:Senta, Srbija

Posted Thu Feb 22, 2018 2:55 AM

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 !



#19 Sheddy OFFLINE  

Sheddy

    Dragonstomper

  • 771 posts
  • Location:UK

Posted Thu Feb 22, 2018 3:20 AM

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

#20 shanti77 OFFLINE  

shanti77

    Chopper Commander

  • 168 posts
  • Location:Poland

Posted Thu Feb 22, 2018 4:33 AM

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)

#21 popmilo OFFLINE  

popmilo

    Stargunner

  • Topic Starter
  • 1,573 posts
  • Location:Senta, Srbija

Posted Thu Feb 22, 2018 7:50 AM

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 :)







Also tagged with one or more of these keywords: music, rmt, sfx, source, coding, asm

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users