FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Duplicating an object with sound attached

Go down

Duplicating an object with sound attached Empty Duplicating an object with sound attached

Post  cgen2 Fri Sep 18, 2009 10:38 pm

I created a static object in Blender and attached a sound. I find I cannot duplicate the object with the sound attached. My code binds the sound buffers but aborts (bad access) when binding the sounds as follows:
[ // Duplicate balloon
SIO2object *_SIO2duplicate = NULL;
char name[ SIO2_MAX_CHAR ];
SIO2object *_SIO2parent = sio2ResourceGetObject( sio2->_SIO2resource, "object/Balloon" );

for( int i = 0; i < FS_BALLOON_DUPS; i++ )
{
// Create a unique name for our new object
sprintf( name, "%s_%d", _SIO2parent->name, i );

// Create an instance of balloon
if( _SIO2parent->_SIO2objectphysic->bounds == SIO2_PHYSIC_CONVEXHULL )
{ _SIO2duplicate = sio2ObjectHardCopy( _SIO2parent, name ); }
else
{ _SIO2duplicate = sio2ObjectSoftCopy( _SIO2parent, name ); }

sio2TransformCopy( _SIO2duplicate->_SIO2transform, _SIO2parent->_SIO2transform );

// Set position of balloon
_SIO2duplicate->_SIO2transform->loc->x = 20.0f;
_SIO2duplicate->_SIO2transform->loc->y = -100.0f + i * 75.0f;
_SIO2duplicate->_SIO2transform->loc->z = 30.378f;

sio2TransformBindMatrix( _SIO2duplicate->_SIO2transform );
sio2PhysicAddObject( sio2->_SIO2physic, _SIO2duplicate );

if( _SIO2parent->_SIO2objectphysic->bounds == SIO2_PHYSIC_CONVEXHULL )
{ sio2ObjectGenId( _SIO2duplicate ); }
}

// Bind all resources in resource manager to associated material.
sio2ResourceBindAllSoundBuffers( sio2->_SIO2resource );
:
:
:

// Generate the sound source buffer ID.
sio2ResourceGenId( sio2->_SIO2resource );

// Bind all sound sources to their buffers.
sio2ResourceBindAllSounds( sio2->_SIO2resource );]

(BTW: I'm not using convex hull).

Have I missed something?

cgen2

Posts : 38
Join date : 2008-12-14

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum