comparison js/chiptune2.js @ 70:629553bdc8aa

music: fix metadata fetching in chiptune2.js turns out the function for getting ascii strings was deprecated, and now I have to use a custom build of libopenmpt because there's no other way to do it. YAY!
author Paper <mrpapersonic@gmail.com>
date Sat, 30 Sep 2023 02:32:41 -0400
parents e6c574c6f8e0
children
comparison
equal deleted inserted replaced
69:2e645b936727 70:629553bdc8aa
83 ChiptuneJsPlayer.prototype.metadata = function() { 83 ChiptuneJsPlayer.prototype.metadata = function() {
84 var data = {}; 84 var data = {};
85 var keys = UTF8ToString(libopenmpt._openmpt_module_get_metadata_keys(this.currentPlayingNode.modulePtr)).split(';'); 85 var keys = UTF8ToString(libopenmpt._openmpt_module_get_metadata_keys(this.currentPlayingNode.modulePtr)).split(';');
86 var keyNameBuffer = 0; 86 var keyNameBuffer = 0;
87 for (var i = 0; i < keys.length; i++) { 87 for (var i = 0; i < keys.length; i++) {
88 keyNameBuffer = libopenmpt._malloc(keys[i].length + 1); 88 keyNameBuffer = libopenmpt._malloc(libopenmpt.lengthBytesUTF8(keys[i])+1);
89 writeAsciiToMemory(keys[i], keyNameBuffer); 89 libopenmpt.stringToUTF8(keys[i], keyNameBuffer, libopenmpt.lengthBytesUTF8(keys[i])+1);
90 data[keys[i]] = UTF8ToString(libopenmpt._openmpt_module_get_metadata(this.currentPlayingNode.modulePtr, keyNameBuffer)); 90 data[keys[i]] = UTF8ToString(libopenmpt._openmpt_module_get_metadata(this.currentPlayingNode.modulePtr, keyNameBuffer));
91 libopenmpt._free(keyNameBuffer); 91 libopenmpt._free(keyNameBuffer);
92 } 92 }
93 return data; 93 return data;
94 } 94 }