See site in english Voir le site en francais
Website skin:
home  download  forum  link  contact

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

Author Topic: Wrong sounds after calling oapiSetFocusObject()  (Read 2949 times)

0 Members and 1 Guest are viewing this topic.

Offline movieman

  • Jr. Member
  • **
  • Posts: 23
  • Karma: 0
06 February 2005, 00:35:18
I seem to have found a problem with Orbitersound 3.0. I have a LEM and CSM and in the LEM I use the EVA switch to create an
astronaut. The LEM calls oapiSetFocusObject() to change focus to the astronaut, which then loads some sounds and plays them.

The problem is, I either get LEM sounds played, or nothing at all. However, if I manually switch back to the LEM and then to
the astronaut again, the sounds play properly.

Is this something that can be fixed, or is there some other way I can do this to work around the problem?


Offline DanSteph

  • Administrator
  • Legend
  • *****
  • Posts: 15410
  • Karma: 266
  • Hein, quoi !?
    • FsPassengers
Reply #1 - 06 February 2005, 01:16:15
Quote
movieman wrote:
I seem to have found a problem with Orbitersound 3.0. I have a LEM and CSM and in the LEM I use the EVA switch to
create an
astronaut. The LEM calls oapiSetFocusObject() to change focus to the astronaut, which then loads some sounds and
plays them.
The problem is, I either get LEM sounds played, or nothing at all. However, if I manually switch back to the LEM and
then to
the astronaut again, the sounds play properly.
Is this something that can be fixed, or is there some other way I can do this to work around the problem?

Can you see the OrbiterSound_log.txt ? try to see it just after switching all info are here...

Perhaps you might give somes timestep after the creation of the eva suit before
giving it the focus ? OrbiterSound doesn't load the sound immediatelly when
they are requested if you give the focus immediatelly it might be the problem.

pseudo code:

Code: [Select]
CreateModel
FocusChangeRequested=10;

void timestep(dt...)
{
      // give the focus to model
      if(FocusChangeRequested>1)
      {
            // now changing the focus
            if(FocusChangeRequested==1)
                oapiSetFocus();

            FocusChangeRequested--;
     }
}
[/color]


Perhaps trying different value for "FocusChangeRequested"

Dan


Offline movieman

  • Jr. Member
  • **
  • Posts: 23
  • Karma: 0
Reply #2 - 06 February 2005, 01:17:07
I tried adding a 500 timestep wait before it tries to play any sounds and that made no difference. The only way I can get
them to play is to use F3 to switch focus to the LEM and back before it starts playing.

I can try changing the LEM code so it waits a few timesteps before switching, and see if that helps.

OrbiterSound 3.0 ver. Jan 21 2005  Log Started
***********************************************

Passed initModule - Ok
Vessel AS-506 requested an ID, returned= 0 OK
Vessel AS-506-LM requested an ID, returned= 1 OK
attempting focus change...
Focus not ready bypassing focus change - Ok
Attempting RenderViewport initialisation...
Attempting GetStartValue initialisation...
Passed GetStartValue - Ok
Initialising directsound...
directsound initialised - OK
Passed RenderViewport - Ok
Attempting Mp3 initialisation...
MP3 found in playlist =  1
Mp3 initialised - Ok
Focus changed attempting to load vessel wave
Focus changed load vessel wave - OK
Loaded requested wav nbr= 9
attempting focus change...
Attempting GetStartValue initialisation...
Passed GetStartValue - Ok
Focus changed attempting to load vessel wave
Focus changed load vessel wave - OK
focus changed - Ok
Vessel AS-506-LM-LEVA requested an ID, returned= 2 OK
Attempting to close viewport...
Attempting to kill DirectSound...
DirectSound killed - OK
Passed CloseRenderViewport - Ok
Exited to Orbiter Launchpad - OK

Passed ExitModule - Ok


Offline movieman

  • Jr. Member
  • **
  • Posts: 23
  • Karma: 0
Reply #3 - 06 February 2005, 01:26:50
Ok, I added a delay before switching focus from the LEM, and a delay in the astronaut DLL before playing the 'one small step'
sound, and that seems to work now.


Offline movieman

  • Jr. Member
  • **
  • Posts: 23
  • Karma: 0
Reply #4 - 06 February 2005, 01:33:07
I still don't seem to have music in the external view though...


Offline DanSteph

  • Administrator
  • Legend
  • *****
  • Posts: 15410
  • Karma: 266
  • Hein, quoi !?
    • FsPassengers
Reply #5 - 06 February 2005, 04:03:46
Quote
movieman wrote:
I still don't seem to have music in the external view though...

Have you set soundconfig Mp3 parameter to "play in space?"

Dan


Offline movieman

  • Jr. Member
  • **
  • Posts: 23
  • Karma: 0
Reply #6 - 06 February 2005, 13:53:50
I get music in space for the other vessels, just not the astronaut: though I noticed last night that it does seem to
disappear at times for the CSM too.


Offline DanSteph

  • Administrator
  • Legend
  • *****
  • Posts: 15410
  • Karma: 266
  • Hein, quoi !?
    • FsPassengers
Reply #7 - 07 February 2005, 01:54:26
the code that switch Mp3 on/off is called each timestep, if the setting is in "external space only"
it then look at your focus vessel's pressure and then call the oapiCameraInternal() function.

I don't see any reason it would not work unless oapiCameraInternal() don't return right value
after having granted and set focus to your vessel (or focus pressure is wrong ?)

Anyway that's strange if work flawlessly for DGIII eva the only difference is that I don't give
focus , perhaps odd things happen here ?

What are you doing exactly when it don't work ? Does the OrbiterSound
log reflect your focus change ?

Dan



Post Edited ( 02-07-05 02:04 )

« Last Edit: 07 February 2005, 01:54:26 by DanSteph »