loading taking about 10 sec when after adding sound
2 posters
loading taking about 10 sec when after adding sound
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 );
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
Re: loading taking about 10 sec when after adding sound
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.
The only limitations of streaming is that the sound source cannot be shared.
stopping streaming sound
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.
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
Re: loading taking about 10 sec when after adding sound
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...
I think the comments are clear enough
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
Similar topics
» Sound loading time
» Mesh disappear after adding ipo-animation
» Tutorial14 / adding md2 to tutorial09
» Adding a UIViewController to the SIO2 template
» Exporter Adding Faces
» Mesh disappear after adding ipo-animation
» Tutorial14 / adding md2 to tutorial09
» Adding a UIViewController to the SIO2 template
» Exporter Adding Faces
Permissions in this forum:
You cannot reply to topics in this forum