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.

Sound Example

4 posters

Go down

Sound Example Empty Sound Example

Post  jj Mon Oct 06, 2008 3:30 am

I believe I'm back on track. Thanks!

Any chance you have an example of implementing sio2 sound on a physics collision?

jj

Posts : 77
Join date : 2008-09-24

Back to top Go down

Sound Example Empty Re: Sound Example

Post  sio2interactive Mon Oct 06, 2008 7:35 am

For implementing "trigger" on collision checkout SIO2sensor... for the sounds Im working on it to have a tutorial... but something happen recently and I lost some work... It'll take a bit longer than plan... sorry...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Sound Example Empty Re: Sound Example

Post  hazeleye Fri Oct 10, 2008 3:46 am

Can you write little bit of sample code how use sound in engine ? And which formats of files you use?

hazeleye

Posts : 34
Join date : 2008-09-24

Back to top Go down

Sound Example Empty Re: Sound Example

Post  sio2interactive Fri Oct 10, 2008 3:59 am

Allright quick and dirty:

1. Link an OGG into the third texture channel of your material

2. Now from that texture property:

MIPMAP = Autoplay
REPEAT = Loop Sound

INTERPOLATE = Ambient Sound
else
FX Sound

And you can control the volume of ambient or FX with:

sio2->_SIO2window->volume // For ambient sound
sio2->_SIO2window->fx_volume // For FX sound

Then pass the resource & window pointer to one of these function:

void sio2ResourceSetAmbientVolume( SIO2resource *_SIO2resource,
SIO2window *_SIO2window );

void sio2ResourceSetFxVolume( SIO2resource *_SIO2resource,
SIO2window *_SIO2window );


You can also control the sound with the SIO2sound structure check sio2_sound.h (for play,pause, stop etc...)
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Sound Example Empty Re: Sound Example

Post  hazeleye Fri Oct 10, 2008 6:06 am

can I know sound playing or not now? I want play my sound again by again
I write:
Code:

void templateRender( void )
{
        ...
       
        if (_SIO2sound1->state != SIO2_SOUND_PLAY) //But if I once set SIO2_SOUND_PLAY (in sio2SoundPlay()) state always will be ==SIO2_SOUND_PLAY even if sound not playing now
   {
      sio2SoundPlay(_SIO2sound1);
   }
   
      ...
}

hazeleye

Posts : 34
Join date : 2008-09-24

Back to top Go down

Sound Example Empty Re: Sound Example

Post  sio2interactive Fri Oct 10, 2008 4:40 pm

Well to play your sound again and again (which is called loop)... Im the Map Image panel make sure that REPEAT is toggled and it will play again and again...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Sound Example Empty Re: Sound Example

Post  hazeleye Sun Oct 12, 2008 9:45 pm

thank you for the answer Smile

hazeleye

Posts : 34
Join date : 2008-09-24

Back to top Go down

Sound Example Empty Re: Sound Example

Post  hazeleye Tue Oct 14, 2008 1:56 am

I can't manipulate with volume of my sounds. For testing I change your function in sio2_window.cc
Code:

void sio2WindowDefaultMode( SIO2window *_SIO2window )
{
   _SIO2window->volume      = 0.0f;//0.65f;
   _SIO2window->fx_volume   = 0.0f;//0.85f;   
}
But I still hear my sounds!

hazeleye

Posts : 34
Join date : 2008-09-24

Back to top Go down

Sound Example Empty Re: Sound Example

Post  sio2interactive Tue Oct 14, 2008 2:23 am

That's because this have absolutely no effect on the OpenAL API... Hey listen man... I upload this file for you, I do not have a video tutorial yet but that the tutorial that Im about to release to explain sound, its probably going to be different than the final one but all the basics are there, I also include the .blend file that I use to test as wel as the OGG's.

Check it out:

http://sio2interactive.com/dump/tutorial09.zip
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Sound Example Empty Re: Sound Example

Post  jj Mon Oct 20, 2008 9:23 pm

Can I control sounds that are not mapped to the object's material texture, and simply load the .ogg used in the implementation?

What methods do I need to setup the sound file and then play on command?

jj

Posts : 77
Join date : 2008-09-24

Back to top Go down

Sound Example Empty Re: Sound Example

Post  sio2interactive Mon Oct 20, 2008 9:58 pm

Checkout for the exact implementation, but just to explain briefly, basically you have 2 things, 1 is the SIO2soundbuffer that you need to init to load the OGG, and the second thing is SIO2sound that represent a sound in space, since you can have multiple sound source that use the same sound no need to have multiple sound buffer loaded in memory.

Basically the sequence is like this:

Code:


// Create a new sound buffer
sio2SoundBufferInit

// Load your OGG using an SIO2stream
sio2SoundBufferLoad


// Generate a sound buffer ID
sio2SoundBufferGenId


// Init a sound source
sio2SoundInit

// Bind the sound buffer to the source and generate a source ID, and pass the default parameters to the flags eg: SIO2_SOUND_AUTOPLAY | SIO2_SOUND_LOOP | SIO2_SOUND_AMBIENT
sio2SoundGenId


Then you can use OpenAL directly to set up the volume
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Sound Example Empty Re: Sound Example

Post  matt Tue Oct 21, 2008 4:27 pm

I tried it like so:

Code:
SIO2soundbuffer* buffer = sio2SoundBufferInit( "music.ogg" );
SIO2stream* stream = sio2StreamOpen( "music.ogg", 1 );
sio2SoundBufferLoad( buffer, stream );
sio2StreamClose( stream );
sio2SoundBufferGenId( buffer );
SIO2sound* sound = sio2SoundInit( "music.ogg" );
sio2SoundGenId( sound, buffer, 0 );
sio2SoundPlay( sound );
The problem: once I'm calling sio2SoundGenId with SIO2_DEBUG_AL enabled I'm getting an AL_INVALID_ENUM error. I'm wondering since everything else works smooth, even the buffer generation... Am I missing something?

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

http://elfrun.net

Back to top Go down

Sound Example Empty Re: Sound Example

Post  matt Tue Oct 21, 2008 4:58 pm

Ah! I found this thread and that was it. OpenAL doesn't work with OS 2.0 in the simulator, you need to use 2.1.

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

http://elfrun.net

Back to top Go down

Sound Example Empty Re: Sound Example

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