ice6 / opensheetmusicdisplay

Combine `osmd_transpose` and `osmd` together to show transposing function.
https://ice6.github.io/opensheetmusicdisplay/build
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

new version of transpose_xml() #14

Open AlbertHart opened 4 years ago

AlbertHart commented 4 years ago

I have created a new version of transpose_xml()

For this version, I removed all global naming from transpose_dom.js and renamed it to transpose_mdom.js.

transpose_dom.js contained code like this:


    // create osmd_transpose if it does not exist yet
    var osmd_transpose = osmd_transpose || {};

    osmd_transpose.version = "2020-06-01 12:27";
    console.log("IN tranpose_functions.js Version: %s", osmd_transpose.version);

osmd_transpose.initialize = function() 
{
    console.log("IN osmd_transpose.initialize");

and created a var object called osmd_transpose which we used in

 xml_string = osmd_transpose.transpose_xml(parameters, xml_string);

The new version creates an object prototype as a function in transpose_mdom.js

// the routine which uses this needs something like:
// var MDOM = new MusicDOM(); 

function MusicDOM() {

But the instance of the MusicDOM() object is created and named in the file which uses transpose_mdom.js

<script src="transpose_mdom.js?v=2.66"></script>

    <!-- this uses the namespace object MusicDOM in transpose_mdom.js to access transpose functions -->
    <script>
        // this gets our DOM functions in a object
        var osmd_transpose = new MusicDOM(); 
    </script>

If that makes sense, see if you can change things to use the new trasnpose_mdon.js file.

This should also fix the bug where we were not transosing names of chord symbols.

ice6 commented 4 years ago

👍 I will have a test