{"id":2517,"date":"2025-09-23T22:21:10","date_gmt":"2025-09-23T13:21:10","guid":{"rendered":"https:\/\/rsynth.net\/?p=2517"},"modified":"2025-09-23T22:21:12","modified_gmt":"2025-09-23T13:21:12","slug":"scd70_sc55-ja","status":"publish","type":"post","link":"https:\/\/rsynth.net\/ja\/2025\/09\/23\/scd70_sc55-ja\/","title":{"rendered":"Roland SC-D70(GS\/SC-55)"},"content":{"rendered":"  <table id=\"api-data-table\" class=\"display\">\n    <thead>\n      <tr>\n\t\t<th><\/th>\n        <th>#<\/th>\n        <th>name<\/th>\n        <th>pgm<\/th>\n        <th>msb<\/th>\n        <th>lsb<\/th>\n      <\/tr>\n    <\/thead>\n    <tbody><\/tbody>\n  <\/table>\n  <audio id=\"dynamic-player\" preload=\"none\" hidden><\/audio>\n\n  <link rel=\"stylesheet\" href=\"https:\/\/cdn.datatables.net\/1.13.6\/css\/jquery.dataTables.min.css\">\n  <script src=\"https:\/\/code.jquery.com\/jquery-3.7.1.min.js\"><\/script>\n  <script src=\"https:\/\/cdn.datatables.net\/1.13.6\/js\/jquery.dataTables.min.js\"><\/script>\n\n<script>\nconst btn_play    = '\u25b6 PLAY';\nconst btn_stop    = '\u25a0 STOP';\nconst btn_error   = 'error';\nconst btn_loading = '... load';\n\nfunction playerPlay() {\n    const player = document.getElementById('dynamic-player');\n    const audioSrc = $(this).data('src');\n    const button = this;\n\n    if (audioSrc) {\n        if (player.src === audioSrc && !player.paused) {\n            \/\/\n            \/\/ Stop play audio\n            \/\/\n            player.pause();\n            player.src = '';\n            player.onloadstart = null;\t\t\t\t\n            button.textContent = btn_play;\n        } else {\n            \/\/\n            \/\/ Start play audio\n            \/\/\n            player.src = audioSrc;\n            player.style.display = 'block';\n\t\t\t\n            \/\/ event handler: audio loading\n            player.onloadstart = () => {\n                button.textContent = btn_loading;\n            };\n            \/\/ event handler: audio play start\n\t\t\tplayer.oncanplay = () => {\n                button.textContent = btn_stop;\n            };\n            \/\/ event handler: audio play stop\n            player.onended = () => {\n                player.src = '';\n                player.onloadstart = null;\t\t\t\t\n                button.textContent = btn_play;\n            };\n\n\t\t\t\/\/ audio play\n            player.play()\n\t\t\t  .catch(error => {\n                button.textContent = btn_error;\n                console.error('error player.play():', error);\n              });\t\t\t\n            \/\/ Reset other buttons to \"\u25b6 PLAY\"\n            const buttons = document.querySelectorAll('button[id=\"play-audio\"]');\n            buttons.forEach(btn => {\n                if (btn !== button) {\n\t\t\t\t\tif (btn.textContent != btn_error){\n                        btn.textContent = btn_play;\t\t\t\t\t\t\n\t\t\t\t\t}\n                }\n            });\t\t\t\n        }\n    } else {\n        console.error('no audio file');\n        button.textContent = btn_error;\n    }\n}\n\t\nfunction addListener() {\n  const buttons = document.querySelectorAll('button[id=\"play-audio\"]');\n  buttons.forEach(btn => {\n\tconsole.error(btn.id);\n\tbtn.addEventListener('click',playerPlay,true);\n  });\n};\n\nfunction escapeHTML(str) {\n  return str\n    .replace(\/&\/g, '&amp;')\n    .replace(\/<\/g, '&lt;')\n    .replace(\/>\/g, '&gt;')\n    .replace(\/\"\/g, '&quot;')\n    .replace(\/'\/g, '&#39;');\n};\n\nconst atts_url = 'https:\/\/sound.rsynth.net\/api\/ROLAND\/SC-D70\/SCD70_SC55\/synth.sound';\nconst base_url = atts_url.split(\"\/\").slice(0, 7).join(\"\/\");\nfunction loadTableData() {\n    fetch(atts_url)\n        .then(response => response.json())\n        .then(data => {\n            const tbody = $('#api-data-table tbody');\n            tbody.empty();\n\n            Object.entries(data.result.sound).forEach(([bank_msb, item_msb]) => {\n                Object.entries(item_msb).forEach(([bank_lsb, item_lsb]) => {\n                    Object.entries(item_lsb).forEach(([pgm_no, item_pgm]) => {\n\t\t\t\t\t\tif (item_pgm.sound_name !== '(mute)'){\n\t\t\t\t\t\t  const sound_url = `${base_url}\/${bank_msb}\/${bank_lsb}\/${pgm_no}\/sound.mp3`;\n                          const view_pgm = pgm_no.slice(-3);\n\t\t\t\t\t\t  var view_sound_name = escapeHTML(item_pgm.sound_name);\n                          const row = `<tr>\n                            <td><button id=\"play-audio\" data-src=\"${sound_url}\">${btn_play}<\/button><\/td>\n                            <td>${item_pgm.sound_no}<\/td>\n                            <td>${view_sound_name}<\/td>\n                            <td>${view_pgm}<\/td>\n                            <td>${bank_msb}<\/td>\n                            <td>${bank_lsb}<\/td>\n                          <\/tr>`;\n                          tbody.append(row);\n\t\t\t\t\t\t};\n                    });\n                });\n            });\n\n            if ($.fn.DataTable.isDataTable('#api-data-table')) {\n                $('#api-data-table').DataTable().destroy();\n            }\n\n            const table = $('#api-data-table').DataTable();\n\n            \/\/ Add event listener after each table draw\n            table.on('draw', function () {\n                addListener();\n            });\n\n            \/\/ Initial listener setup\n            addListener();\n        })\n        .catch(error => console.error('fetch error:', error));\n};\n\njQuery(document).ready(function($) {\n  loadTableData();\n});\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":4,"featured_media":2360,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"https:\/\/rsynth.net\/?p=2327","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[59],"tags":[],"class_list":["post-2517","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sc-d70","ja","card","col-md-4","col-sm-6"],"jetpack_featured_media_url":"https:\/\/rsynth.net\/wp-content\/uploads\/2025\/09\/img_4740.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rsynth.net\/wp-json\/wp\/v2\/posts\/2517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rsynth.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rsynth.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rsynth.net\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/rsynth.net\/wp-json\/wp\/v2\/comments?post=2517"}],"version-history":[{"count":1,"href":"https:\/\/rsynth.net\/wp-json\/wp\/v2\/posts\/2517\/revisions"}],"predecessor-version":[{"id":2518,"href":"https:\/\/rsynth.net\/wp-json\/wp\/v2\/posts\/2517\/revisions\/2518"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rsynth.net\/wp-json\/wp\/v2\/media\/2360"}],"wp:attachment":[{"href":"https:\/\/rsynth.net\/wp-json\/wp\/v2\/media?parent=2517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rsynth.net\/wp-json\/wp\/v2\/categories?post=2517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rsynth.net\/wp-json\/wp\/v2\/tags?post=2517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}