Kara-Moon Forum
March 29, 2024, 01:37:10 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: You can go back to the main site here: Kara-Moon site
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Fix for AFTER command?  (Read 2553 times)
bvdp
Kara-Moon Master
****
Posts: 1436


WWW
« on: June 03, 2021, 02:05:27 AM »

I noticed the other day that a command like:

   
Code:
   After Repeat=1 Print Here we go again
   Am * 4

did not work. Nothing printed at all. I spent way to many hours tracking this down and have come up with a fix. In parse.py at line 346 I changed the code to read:
Code:
           if rpt:
                gbl.barNum -= 1
                if MMA.after.needed():
                    MMA.after.check(recurse=True)
                gbl.barNum += 1

I think it is working now. But really do want some verification before I lock it in.

Thanks.
 
   
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1436


WWW
« Reply #1 on: June 03, 2021, 06:27:10 PM »

Okay, okay ... it still is not working  Roll Eyes I will do more work on this as whip it into submission.
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1436


WWW
« Reply #2 on: June 03, 2021, 07:03:19 PM »

I think I have it now Smiley The problem was my choice of variable to see if a repeat was active. So, let's try this again. In the module parse.py we need to change 2 occurrences of "rpt" to "rptcount > 1". These occur at lines 343 and 350.

Code:
            # if repeat count is set with dupchord we push
            # the chord back and get lyric.extract to add the
            # chord to the midi file again. A real lyric is
            # just ignored ... 2 reasons: the lyric is mangled and
            # and it makes sense to only have it once!
            if rptcount > 1 and lyric.dupchords:
                _,lyrics = lyric.extract(' '.join(l), 0)

            # The barNum and other pointers have been incremented
            # and a bar of data has been processed. If we are repeating
            # due to a "*" we do a AGAIN test. Without a rpt this would
            # be done at the start of a data line.
            if rptcount > 1 and  MMA.after.needed():
                MMA.after.check(recurse=True)


Again, I'm hoping someone can test this and let me know!
Logged

My online life: http://www.mellowood.ca
sciurius
Sr. Member
****
Posts: 443



« Reply #3 on: June 05, 2021, 01:28:30 PM »

I get "here we go again" 4 times, while I would expect it to print only once...

Test file t.mma:

Code:
After Repeat=1 Print Here we go again
Am * 4

Before the fix (mma as distributed):

Code:
Opening file 't.mma'.
After: Added event 'Print Here we go again' at bar 1.
File 't.mma' closed.
No data created. Did you remember to set a groove/sequence?

After the fix:

Code:
Opening file 't.mma'.
After: Added event 'Print Here we go again' at bar 1.
Opening file '/tmp/MMA_xovzel1t.mma'.
Here we go again
File '/tmp/MMA_xovzel1t.mma' closed.
Opening file '/tmp/MMA_53imszoy.mma'.
Here we go again
File '/tmp/MMA_53imszoy.mma' closed.
Opening file '/tmp/MMA_lnwkn0_m.mma'.
Here we go again
File '/tmp/MMA_lnwkn0_m.mma' closed.
Opening file '/tmp/MMA_9nwtq1dl.mma'.
Here we go again
File '/tmp/MMA_9nwtq1dl.mma' closed.
File 't.mma' closed.
No data created. Did you remember to set a groove/sequence?
Logged
bvdp
Kara-Moon Master
****
Posts: 1436


WWW
« Reply #4 on: June 05, 2021, 03:45:33 PM »

why would you only expect it to print one time? The idea behind AFTER is that it does "something" after creating/processing each bar of music. Have a go with pre/post fix versions with this:

   After Repeat=4 Print Printing a silly comment
   Am * 24

Logged

My online life: http://www.mellowood.ca
sciurius
Sr. Member
****
Posts: 443



« Reply #5 on: June 07, 2021, 06:24:16 AM »

I think I got confused. I've only user "After Count" once in a while...
Logged
bvdp
Kara-Moon Master
****
Posts: 1436


WWW
« Reply #6 on: June 07, 2021, 03:47:40 PM »

No worries ... I was confused by whole mess as well. But, I think it is solid now!
Logged

My online life: http://www.mellowood.ca
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.052 seconds with 20 queries.