Old 09-15-2020, 07:52 AM   #1
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default Snap won't enable

I have a project that I can't enable snap on. I'm sure I screwed something up but have no idea where to look. Very odd.
Coachz is offline   Reply With Quote
Old 09-15-2020, 08:29 AM   #2
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default

I deleted every track and snap still can't be enabled. I think this project is corrupted somehow or I have a wack setting. I have attached the project. Thanks for any ideas as we are laying guitar work and it's really hard to copy sections without snap. I saved it as a new project but no change.
Attached Files
File Type: rpp till the end of time.rpp (4.5 KB, 5 views)

Last edited by Coachz; 09-15-2020 at 08:37 AM.
Coachz is offline   Reply With Quote
Old 09-15-2020, 08:42 AM   #3
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default

I opened a new project tab and copied all the tracks to a new project with no problem and the snap works so that's a fix ! yay
Coachz is offline   Reply With Quote
Old 09-15-2020, 06:27 PM   #4
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default MAJOR PROBLEM

That's 2 projects today that lost the ability to snap and I had to copy the entire project into a new project. Can a dev please checkout my attached project to tell me what happened please.
Coachz is offline   Reply With Quote
Old 09-15-2020, 11:47 PM   #5
Pink Wool
Human being with feelings
 
Join Date: Apr 2020
Posts: 106
Default

Could it have something to do with the tempo map? I can confirm the snapping not working on your project file.
Pink Wool is offline   Reply With Quote
Old 09-16-2020, 06:35 AM   #6
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default

Quote:
Originally Posted by Pink Wool View Post
Could it have something to do with the tempo map? I can confirm the snapping not working on your project file.
Thanks for the reply. On the master track I deleted the tempo and saved/reopened the project but I still have no snap. It's got me stumped.
Coachz is offline   Reply With Quote
Old 09-16-2020, 06:59 AM   #7
karbomusic
Human being with feelings
 
karbomusic's Avatar
 
Join Date: May 2009
Posts: 26,733
Default

Your snap/grid settings has most everything unchecked (right click the snap button in toolbar). Open another project that works, screenshot the snap/grid settings and compare to this project.
__________________
Music is what feelings sound like.
karbomusic is offline   Reply With Quote
Old 09-16-2020, 07:55 AM   #8
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default

karbomusic, you fixed it. I have some code that does things with snap that must be doing more than I though. Thanks VERY much. These are my normal snap settings

Coachz is offline   Reply With Quote
Old 09-16-2020, 02:51 PM   #9
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default

So what code do I need to enable grid lines ? I'm not getting how config variables work.

-- enable grid lines
retval = reaper.SNM_SetIntConfigVar( "projshowgrid", 1)


projshowgrid

Description:
Several Snap/Grid-Settings, as set in Snap/Grid Settings located in menu Options -> Snap/grid -> Snap/grid settings
It is an integer-bitfield.

&1=0, Show grid, line spacing-checkbox(off) - unchecked
&1=1, Show grid, line spacing-checkbox(on) - checked

&2=0, Snap Media items to grid(off) - unchecked
&2=1, Snap Media items to grid(on) - checked

&4=0, Snap Cursor to grid(off) - unchecked
&4=1, Snap Cursor to grid(on) - checked

&8=0, Snap Selection to grid(off) - unchecked
&8=1, Snap Selection to grid(on) - checked

&16=0, Snap Media items to selection/markers/cursor(off) - unchecked
&16=1, Snap Media items to selection/markers/cursor(on) - checked

&32=0, Snap Cursor to selection/markers/cursor(off) - unchecked
&32=1, Snap Cursor to selection/markers/cursor(on) - checked

&64=0, Snap Selection to selection/markers/cursor(off) - unchecked
&64=1, Snap Selection to selection/markers/cursor(on) - checked

&128=0, Snap media items to nearby media items up to(off) - unchecked
&128=1, Snap media items to nearby media items up to(on) - checked

&256=0, Enable snapping(on) - checked
&256=1, Enable snapping(off) - unchecked

&512=0, Use the same grid division in arrange view and MIDI editor(also in MIDI Editor -> Options)(off) - unchecked
&512=1, Use the same grid division in arrange view and MIDI editor(also in MIDI Editor -> Options)(on) - checked

&1024=0, Snap to grid at any distance(off) - unchecked
&1024=1, Snap to grid at any distance(on) - checked

&2048 and &4096, Media items snap at-dropdownlist

0 0, Mouse-position dependent
1 0, Only snap at start/snap offset
0 1, Snap both start/end

&8192=0, Snap cursor to edges of media items on any track(off) - unchecked
&8192=1, Snap cursor to edges of media items on any track(on) - checked

&16384=0, unknown
&16384=1, unknown

&32768=0, Grid snap settings follow grid visibility(on) - checked
&32768=1, Grid snap settings follow grid visibility(off) - unchecked

&65536=0, unknown
&65536=1, unknown

&131072=0, Snap to project sample rate(off) - unchecked
&131072=1, Snap to project sample rate(on) - checked
Coachz is offline   Reply With Quote
Old 09-16-2020, 03:30 PM   #10
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,916
Default

Quote:
Originally Posted by Coachz View Post
So what code do I need to enable grid lines ? I'm not getting how config variables work.

-- enable grid lines
retval = reaper.SNM_SetIntConfigVar( "projshowgrid", 1)
That's it but you also need a
Code:
reaper.UpdateArrange()
to trigger a redraw.
(For a more detailed rundown about config vars see here.)

edit:
Nah, this is wrong sorry, as it turns all the other bits off.
This should be the one:
Code:
enableOK = reaper.SNM_SetIntConfigVar("projshowgrid", reaper.SNM_GetIntConfigVar("projshowgrid", -666)|1) -- bitwise OR, set bit

Last edited by nofish; 09-16-2020 at 03:40 PM.
nofish is offline   Reply With Quote
Old 09-16-2020, 03:44 PM   #11
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default

Thanks so much. That code worked even without updating arrange but how did you get to that from this and why do you have to wrap SNM_GetIntConfigVar in SNM_GetIntConfigVar ? Thanks !!

&1=0, Show grid, line spacing-checkbox(off) - unchecked
&1=1, Show grid, line spacing-checkbox(on) - checked
Coachz is offline   Reply With Quote
Old 09-16-2020, 03:57 PM   #12
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,916
Default

You first get the current value of projshowgrid, then you set the first bit of it (that's what the '&1' in the doc is saying) to 1 (on) by bitwise ORing it with 1 (binary ...000001) because
0 OR 1 == 1 and
1 OR 1 == 1
so it's set to 1 no matter of the previous state (the other bits stay the same because 1 OR 0 == 1 and 0 OR 0 == 0).
https://en.wikipedia.org/wiki/Bitwise_operation#OR

Sorry, Wiki probably does a better job explaining than me..

Last edited by nofish; 09-16-2020 at 04:21 PM.
nofish is offline   Reply With Quote
Old 09-16-2020, 04:30 PM   #13
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default

Quote:
Originally Posted by nofish View Post
You first get the current value of projshowgrid, then you set the first bit of it (that's what the '&1' in the doc is saying) to 1 (on) by bitwise ORing it with 1 (binary ...000001) because
0 OR 1 == 1 and
1 OR 1 == 1
so it's set to 1 no matter of the previous state (the other bits stay the same because 1 OR 0 == 1 and 0 OR 0 == 0).
https://en.wikipedia.org/wiki/Bitwise_operation#OR

Sorry, Wiki probably does a better job explaining than me..
I see. Thanks nofish for taking the time to help me out. Have a great day !
Coachz is offline   Reply With Quote
Old 09-17-2020, 05:07 AM   #14
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default

Quote:
Originally Posted by nofish View Post
That's it but you also need a
Code:
reaper.UpdateArrange()
to trigger a redraw.
(For a more detailed rundown about config vars see here.)

edit:
Nah, this is wrong sorry, as it turns all the other bits off.
This should be the one:
Code:
enableOK = reaper.SNM_SetIntConfigVar("projshowgrid", reaper.SNM_GetIntConfigVar("projshowgrid", -666)|1) -- bitwise OR, set bit
So the -666 is the return value from getting and then you are ORing it with the one. And if you wanted to set another property you would OR it with whatever its associated value was like maybe 256 right?
Coachz is offline   Reply With Quote
Old 09-19-2020, 07:44 AM   #15
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,916
Default

Quote:
Originally Posted by Coachz View Post
So the -666 is the return value from getting and then you are ORing it with the one.
The -666 is just an arbitrarily chosen errvalue which is returned in case SNM_GetIntConfigVar() fails (see doc).
So a more non-lazy version of it would be:
Code:
-- enable show grid line spacing
projshowgridConfig = reaper.SNM_GetIntConfigVar("projshowgrid", -666)
if projshowgridConfig ~= -666 then -- got value ok, we can continue
  -- set 1st bit of projshowgridConfig to 1 (by bitwise ORing with 1)
  enableOK = reaper.SNM_SetIntConfigVar("projshowgrid", projshowgridConfig|1)
  -- may check if enableOK returned true...
end
Quote:
And if you wanted to set another property you would OR it with whatever its associated value was like maybe 256 right?
In principle yes, but note that for Enable snapping the doc says:
Quote:
&256=0, Enable snapping(on) - checked
&256=1, Enable snapping(off) - unchecked
So in this case you have to do a bitwise AND NOT for enabling snapping (clear the 9th bit):

Code:
-- enable snapping
projshowgridConfig = reaper.SNM_GetIntConfigVar("projshowgrid", -666)
if projshowgridConfig ~= -666 then -- got value ok, we can continue
  enableOK = reaper.SNM_SetIntConfigVar("projshowgrid", projshowgridConfig&(~256))
  -- may check if enableOK returned true...
end
or the lazy version:
Code:
enableOK = reaper.SNM_SetIntConfigVar("projshowgrid", (reaper.SNM_GetIntConfigVar("projshowgrid", -666)&(~256))) -- bitwise AND NOT, clear bit

Last edited by nofish; 09-19-2020 at 07:57 AM.
nofish is offline   Reply With Quote
Old 09-19-2020, 08:14 AM   #16
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default

Very interesting and thank you for the information. So how do you know when you need to do an or or an and not?
Coachz is offline   Reply With Quote
Old Yesterday, 01:58 PM   #17
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,916
Default

OR for setting a bit (when it says &n=1 in the doc), AND NOT for clearing a bit (when it says &n=0 in the doc).
nofish is offline   Reply With Quote
Old Yesterday, 02:17 PM   #18
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,137
Default

Got it, thanks my friend
Coachz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:19 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.