Dividing screen into x parts and output values and bangs based on mouse location

R_Gol's icon

R_Gol

10月 23 2024 | 2:33 午後

How can I take the size of my screen (x and y) and output bangs and x and y values of mouse based of the location of the mouse on the screen?

I would like to have the option to decide if the screen will be divide into 4 equal parts, 8 equal parts or any other number.

How(or if) it's possible?

double_UG's icon

double_UG

10月 23 2024 | 3:32 午後

Max Patch
Copy patch and select New From Clipboard in Max.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

TFL's icon

TFL

10月 23 2024 | 3:37 午後

Use [mousestate] to get the mouse position, [screensize] to get, well, your screen size and then do the math:

Max Patch
Copy patch and select New From Clipboard in Max.

R_Gol's icon

R_Gol

10月 23 2024 | 3:51 午後

But the output should be based on both location of x and y together

Source Audio's icon

Source Audio

10月 23 2024 | 3:56 午後

is that so difficult to deal with ?

pack x and y dividers and bang when mouse is in both set ranges.

R_Gol's icon

R_Gol

10月 23 2024 | 4:00 午後

is that so difficult to deal with ?

pack x and y dividers and bang when mouse is in both set ranges.

I don't understand how to decide the ranges in easy way?

what is the math formula I need in here?

double_UG's icon

double_UG

10月 23 2024 | 4:05 午後

just scale

scale 0 1919 1 4

R_Gol's icon

R_Gol

10月 23 2024 | 4:06 午後

just scale

scale 0 1919 1 4

probably there is something I missing but I'm looking for both x and y axis and not only one axis.

I don't understand what math equation is needed?

double_UG's icon

double_UG

10月 23 2024 | 4:14 午後

Max Patch
Copy patch and select New From Clipboard in Max.

xxxxxxxxxxxxxxxxxxxxxxxxxx

TFL's icon

TFL

10月 23 2024 | 4:51 午後

Here's Double_UG patcher but a bit neater, and which adapts to your screen resolution.

Max Patch
Copy patch and select New From Clipboard in Max.

R_Gol's icon

R_Gol

10月 23 2024 | 5:00 午後

Here's Double_UG patcher but a bit neater, and which adapts to your screen resolution.

Thanks!

This patch divide the screen into 16 parts. If I want it to be divided into only 4 parts or 8 parts? (or other number?)

TFL's icon

TFL

10月 23 2024 | 5:17 午後

Understand the patch and you'll understand how. In that version of the patch, the screen is divided in 4 parts horizontally and 4 parts vertically, which gives the 4x4=16 zones in total.

Search for '4' in the patch and this will be most likely what you want to update to change the number of subdivisions. Double_UG was pretty explicit when they said "just scale"

double_UG's icon

double_UG

10月 23 2024 | 5:21 午後

Max Patch
Copy patch and select New From Clipboard in Max.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

R_Gol's icon

R_Gol

10月 23 2024 | 5:37 午後

Thanks for the explanation! I see it now

Source Audio's icon

Source Audio

10月 24 2024 | 8:47 午前

there are few details left to deal with.

1~ limit input to 1 screen in case multiple screens are present

works also by using zmap instead of scale.

2~ filter out bottom & right edges of the screen.

if you scale 0 1024 0 4

then when you hit 1024 you will get 4 ... wrong result

Here I pointed my mouse to right-bottom corner :

R_Gol's icon

R_Gol

10月 24 2024 | 9:15 午前

Thanks! This should work with odd screen divide?

For example I put 3 for x(horizontal) and 2 for y (vertical) but the output seems off.

When I'm with my mouse on the right hand cornel I get 2 which make sense.

When I move the mouse to the bottom left corner I also get 2. I think it should be 3?

Max Patch
Copy patch and select New From Clipboard in Max.

TFL's icon

TFL

10月 24 2024 | 11:12 午前

Because of this cord. It should be connected to the number of horizontal divisions, like below, instead of number of vertical divisions.


Source Audio's icon

Source Audio

10月 24 2024 | 11:21 午前

you might also want to divide free ranges , like

1 2 3 4

5 6

7 8 9 10 11 12

13 14