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.

loading taking about 10 sec when after adding sound

2 posters

Go down

loading taking about 10 sec when after adding sound Empty loading taking about 10 sec when after adding sound

Post  foobar8675 Thu May 21, 2009 11:03 pm

I recently added sound , a 593kb oog and 136kg oog. However, after adding the code to play the sound, it's taking about 10 seconds to load the app where before it was about 1 second. It seems that sio2ResourceGenId() is the culprit but I have no idea why. I am calling sio2InitAL() in EAGLView.createFrameBuffer(). My code from template.templateLoading() is below and I believe I am doing everything correctly. Any thoughts?

sio2ResourceOpen( sio2->_SIO2resource, "tutorial12.sio2", 1 );
while( i != sio2->_SIO2resource->gi.number_entry )
{
sio2ResourceExtract( sio2->_SIO2resource, NULL );
++i;
}
sio2ResourceClose( sio2->_SIO2resource );
sio2ResourceBindAllSoundBuffers( sio2->_SIO2resource );
sio2ResourceBindAllImages( sio2->_SIO2resource );
sio2ResourceBindAllMaterials( sio2->_SIO2resource );
sio2ResourceBindAllMatrix( sio2->_SIO2resource );
sio2ResourceGenId( sio2->_SIO2resource );
sio2ResourceResetState();

// Set the volume for the ambient (music) sound source.
sio2->_SIO2window->volume = 1.00f;

// Set the volume for the FX sound source.
sio2->_SIO2window->fx_volume = 1.00f;

// Affect the ambient volume to all ambient sound.
sio2ResourceSetAmbientVolume( sio2->_SIO2resource,sio2->_SIO2window );

// Affect FX sound volume to all the FX sound.
sio2ResourceSetFxVolume( sio2->_SIO2resource,sio2->_SIO2window );

// Get the Suzanne object handle
_SIO2object = sio2ResourceGetObject( sio2->_SIO2resource, "object/Suzanne" );
_SIO2Cubeobject = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube" ); // bind later on event
sio2ObjectBindSound( _SIO2object );

foobar8675

Posts : 16
Join date : 2009-05-07

Back to top Go down

loading taking about 10 sec when after adding sound Empty Re: loading taking about 10 sec when after adding sound

Post  sio2interactive Fri May 22, 2009 12:12 am

Of course you are fully loading the sound, you should enable streaming, check tutorial15 video tutorial for more info...

The only limitations of streaming is that the sound source cannot be shared.
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

loading taking about 10 sec when after adding sound Empty stopping streaming sound

Post  foobar8675 Fri May 22, 2009 9:25 am

thanks alot. Streaming loads in about 1/2 the time (5 sec or so) which is good. What I'm stuck on is my call to

sio2SoundStop( _SIO2object->_SIO2sound[ _SIO2object->n_sound - 1 ] );

doesn't stop the streamed audio even thought i'm positive the object state is SIO2_SOUND_STOP .

when i stepped through sio2ResourceRender() i found that _SIO2resource->n_sound was 38 where the first time i stepped through that code, _SIO2resource->n_sound was only 1. i'm a bit confused since i only have 2 ogg files in the scene.

as a side note, i'm not sure what i'm doing wrong with adjusting the volume. i set the streamed ogg to not have interpol selected and the other ogg to have interpol. however when i adjust these values between .1 and 1

sio2->_SIO2window->volume = 0.1f;
sio2->_SIO2window->fx_volume = 0.1f;

i don't hear any change. any help is appreciated.

foobar8675

Posts : 16
Join date : 2009-05-07

Back to top Go down

loading taking about 10 sec when after adding sound Empty Re: loading taking about 10 sec when after adding sound

Post  sio2interactive Fri May 22, 2009 6:11 pm

sio2SoundStop( _SIO2object->_SIO2sound[ _SIO2object->n_sound - 1 ] );

doesn't stop the streamed audio even thought i'm positive the object state is SIO2_SOUND_STOP .

>> No idea


when i stepped through sio2ResourceRender() i found that _SIO2resource->n_sound was 38 where the first time i stepped through that code, _SIO2resource->n_sound was only 1. i'm a bit confused since i only have 2 ogg files in the scene.

>> Obviously there's a memory leak in your code...


sio2->_SIO2window->volume = 0.1f;
sio2->_SIO2window->fx_volume = 0.1f;

>> This is just an affectation... how can you expect a result by just assigning values? You should really check tutorial09 & tutorial15 in details...

Code:

      // Set the volume for the ambient (music) sound source.
      sio2->_SIO2window->volume = 0.65f;

      // Set the volume for the FX sound source.
      sio2->_SIO2window->fx_volume = 0.85f;

      // Affect the ambient volume to all ambient sound.
      sio2ResourceSetAmbientVolume( sio2->_SIO2resource,
                             sio2->_SIO2window );

      // Affect FX sound volume to all the FX sound.
      sio2ResourceSetFxVolume( sio2->_SIO2resource,
                         sio2->_SIO2window );


I think the comments are clear enough Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

loading taking about 10 sec when after adding sound Empty Re: loading taking about 10 sec when after adding sound

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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