forked from defold/defold
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 3289 update sound from stringbuffer (defold#5675)
* Update sound resource from buffer - ref defold#3289 * 'Published' sound resource property in sound component. Now accessible from lua resource.get() * Support for sound-data resource update from lua string * Test case for stringbuffer sound update - ref defold#3289
- Loading branch information
Showing
7 changed files
with
111 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function init(self) | ||
self.updated = false | ||
end | ||
|
||
function update(self, dt) | ||
-- update sound only once | ||
if not self.updated then | ||
local f = io.open("src/gamesys/test/sound_ext/replacement.wav") | ||
local c = f:read("*all") | ||
f:close() | ||
|
||
local path = go.get("/go#dynamic-sound", "sound") | ||
resource.set_sound(path, c); | ||
|
||
self.updated = true; | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
components { | ||
id: "dynamic-sound" | ||
component: "/sound/valid.sound" | ||
} | ||
components { | ||
id: "set-sound-script" | ||
component: "/sound/set_sound.script" | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters