Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

research using odot bundle as main score structure #114

Open
ramagottfried opened this issue Apr 25, 2018 · 3 comments
Open

research using odot bundle as main score structure #114

ramagottfried opened this issue Apr 25, 2018 · 3 comments
Assignees
Labels
activity Describe a coding task as one of the steps to achieve a whole user story enhancement

Comments

@ramagottfried
Copy link
Owner

I'm currently looking into whether we could use an odot bundle as the main Score data structure, rather than a vector of Symbols.

Having the full Score in a bundle would allow users to easily write o.expressions that refer to different Symbols; and since an odot bundle is already a hierarchy with the ability to store sub-bundles, it would make sense to go this route.

The idea would be that Components would link to an OSC message address, or ideally the OSC bundle stored at a message address.

One challenge at the moment is that the odot bundle structure historically has not been used in this way, so some work may be required to make sure that the memory addresses for sub-bundles remain constant.

Since the a Symbol's graphic Component should never outlive the Symbol, I think the pointer reference approach is viable.

@ramagottfried ramagottfried self-assigned this Apr 25, 2018
@ramagottfried ramagottfried added enhancement activity Describe a coding task as one of the steps to achieve a whole user story labels Apr 25, 2018
@ramagottfried
Copy link
Owner Author

note: symbol numbering could be used for drawing layer, e.g. /symbol/0 is drawn first, on the bottom layer

@ramagottfried
Copy link
Owner Author

ramagottfried commented May 15, 2018

this may also possibly solve the /id numbering issue, for example:

/layer/1 : {
    /name : note,
    /id : note/1
}

where the symbol /id is always the name + the layer number, then within a group, there would be a secondary level of layers. possibly the /id should have the full path included, like so:

/layer/1 : {
    /name : notegroup,
    /id : notegroup/1,
    /type : group,
    /subsymbol/1 : {
        /name : note,
        /id :  notegroup/1/note/1,
        /type : text,
        [ ... ]
    }
}

@ramagottfried
Copy link
Owner Author

some ideas about how the score bundle should be structured:

{
    /palette : {
        /1 : {
            # symbolist tools for OSC lookup
            /layer : 1,
            /name : "path",
            /id : "path/1",

            # type for calling the SVG drawing method
            /type : "path",

            # SVG drawing information:
            /path : {
                /d : "M0,0 L100,100 Z",
                /style : {
                    /color : "red",
                    /stroke-width: 1
                }
            },

            # JUCE positioning information (determined by mouse placement, and graphic bounds):
            /x : 100,
            /y : 200,
            /w : 10,
            /h : 10
        }
    },

    /score : {
        /numlayers : 1,

        /1 : {
            # symbolist tools for OSC lookup
            /layer : 1,
            /name : "path",
            /id : "path/1",

            # type for calling the SVG drawing method
            /type : "path",

            # SVG drawing information:
            /path : {
                /d : "M0,0 L100,100 Z",
                /style : {
                    /color : "red",
                    /stroke-width: 1
                }
            },

            # JUCE positioning information (determined by mouse placement, and graphic bounds):
            /x : 100,
            /y : 200,
            /w : 10,
            /h : 10,

            # scripts
            # can allow the creation of temporary subsymbols, actual new symbols,
            # and handle dynamic positioning based on clef grammar
            # called from layer so it can reference anything within this symbol layer
            # I guess the JUCE positioning information might need to change if the sublayer
            # is larger than the current parent.

            /onmouse : {
                /down : "lambda([x,y,modifiers],
                    /cx = /x + /w * 0.5,
                    /cy = /y + /h * 0.5,
                    /subsymbol/1 = /~./newRectangle( "overlay", /cx, /cy, /w, /h )
                )"
            }
        }
    },

    # temporary overlay graphic layer
    /overlay : {
        /numlayers : 0
    },

    # global scripts available in all layers/sub-bundles
    /~ : {
        /newLayer : "lambda([parentlayer],
            /_parent = value(parentlayer),
            if( bound(/_parent),
                progn(
                    /_layernum = /_parent./numlayers++,
                    assign_to_bundleMember(/_parent, "/" + /_layernum, emptybundle() )
                )

            ),
            prog1(
                value( parentlayer + "/." + /_layernum),
                delete( /_layernum ), delete(/_parent)
            )

        )",

        /newRectangle : "lambda([layer, cx, cy, w, h],
            /_layer = if( layer == null,
                /~./newLayer( "/score" ),
                value( "/score./" + layer )
            ),

            /_layer./x = cx - w * 0.5,
            /_layer./y = cy - h * 0.5,
            /_layer./w = w,
            /_layer./h = h,

            /_layer./type = "rectangle",
            /_layer./rectangle = {
                /cx = cx,
                /cy = cy,
                /width = w,
                /height = h,
                /style = {
                    /color = "black",
                    /stroke-width = 2,
                }

            }
        )"
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
activity Describe a coding task as one of the steps to achieve a whole user story enhancement
Projects
None yet
Development

No branches or pull requests

2 participants