added ability to export sounds

pull/89/head
jmoenig 2019-01-25 13:38:08 +01:00
rodzic 19f17e7243
commit 9608bc9b45
2 zmienionych plików z 14 dodań i 0 usunięć

Wyświetl plik

@ -12,6 +12,7 @@
* new "string" library, thanks, Brian
* added "neg" selector to monadic function reporter in "Operators" category
* enhances support for embedding Snap in other website, thanks, Bernat!
* export sounds
* Notable Changes:
* added third hsv dimension to pen colors, changed SET and CHANGE pen blocks
* added transparency (alpha) to pen colors
@ -33,6 +34,7 @@
### 2019-01-25
* Threads: tweaked CSV-parser to handle \r-only record delimiters
* Cloud, GUI: Decouple cloud access from GUI, thanks, Michael and Bernat!
* GUI: added ability to export sounds
### 2019-01-24
* Turkish translation update, thanks, Turgut!

Wyświetl plik

@ -4704,6 +4704,11 @@ IDE_Morph.prototype.saveCanvasAs = function (canvas, fileName) {
this.saveFileAs(canvas.toDataURL(), 'image/png', fileName);
};
IDE_Morph.prototype.saveAudioAs = function (audio, fileName) {
// Export a Sound object as a WAV file
this.saveFileAs(audio.src, 'audio/wav', fileName);
};
IDE_Morph.prototype.saveXMLAs = function(xml, fileName) {
// wrapper to saving XML files with a proper type tag.
this.saveFileAs(xml, 'text/xml;chartset=utf-8', fileName);
@ -8911,6 +8916,8 @@ SoundIconMorph.prototype.userMenu = function () {
if (!(this.object instanceof Sound)) { return null; }
menu.addItem('rename', 'renameSound');
menu.addItem('delete', 'removeSound');
menu.addLine();
menu.addItem('export', 'exportSound');
return menu;
};
@ -8944,6 +8951,11 @@ SoundIconMorph.prototype.removeSound = function () {
jukebox.removeSound(idx);
};
SoundIconMorph.prototype.exportSound = function () {
var ide = this.parentThatIsA(IDE_Morph);
ide.saveAudioAs(this.object.audio, this.object.name);
};
SoundIconMorph.prototype.createBackgrounds
= SpriteIconMorph.prototype.createBackgrounds;