Re: A possible sound loading bug
Status: Alpha
Brought to you by:
cwalther
|
From: James C. W. <jfc...@ya...> - 2010-12-12 01:40:22
|
Thanks, I think I understand now.
By the way, what exactly happens if I load a sound into a global variable, play it, then re-define the global variable again to load a different sound? Does it flush the old sound? Or does it stay in memory? Becouse I now realize that using my current function, the sound seems to stay in memory even after the scheduled function re-iterates and changes what sound the variable corrosponds to. This leads to a slow increase in memory use, about two megs per minute in my case. Any way I can avoid this, other then pre-loading all the sounds first in node.lua?
Thanks,
James
--- On Sat, 12/11/10, Christian Walther <cwa...@gm...> wrote:
From: Christian Walther <cwa...@gm...>
Subject: Re: A possible sound loading bug
To: "Content creation for the Pipmak Game Engine" <pip...@li...>
Date: Saturday, December 11, 2010, 2:30 PM
> I think I may have a bug, as the problem doesn't seem to be my code,
> but maybe it is.
> All I'm doing is playing a random short sound(3-5 seconds long) at a
> controlled random interval, with 16 possible sounds to choose from.
> The output tells me that the "sound" in the scheduled function "is a
> nil value".
> The function module is attached.
This is not a bug, but intended behavior. The node description
statements like "sound {...}", "cubic {...}", "hotspot {...}" etc. are
only defined during node loading and undefined (nil) otherwise. You
shouldn't think of them as functions, even though they technically
are, but as declarative statements that are only used at the outermost
level of node.lua, not in your own functions.
To load a sound in your own code, use the pipmak.loadsound() function.
(See also the footnote about it in the manual.)
It would be more efficient to load each sound only once (as part of
the node using a "sound {...}" statement, or on demand using
pipmak.loadsound()) than every time it is played (unless you need to
play the same sound file multiple times concurrently), but in your
case that probably doesn't matter much.
Also, "sfx_amb1_rand:play()" should probably be "sfx_amb1:play()".
I wonder if it would be a good idea, instead of resetting the node
description statements to nil after node loading, to set them to a
function that prints a more helpful error message.
-Christian
------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages,
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev
_______________________________________________
Pipmak-Users mailing list
Pip...@li...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users
|