Elvas Tower: X1685 - Elvas Tower

Jump to content

  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

X1685 Rate Topic: -----

#11 User is offline   Lindsayts 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,849
  • Joined: 25-November 11
  • Gender:Male
  • Country:

Posted 22 July 2013 - 10:48 PM

View Postroeter, on 22 July 2013 - 04:06 PM, said:

Hello,

now we're one this subject, there's something that's been bothering me for quite some time.
When the system has to load a 'new' sound (i.e. one that's not been played before in this session), the whole display freezes while the sound is loaded.
I would assume that with multithreading etc., display would be independent from sound, but apparantly that is not so.
Are we one thread short - should sound have it's own thread? Or is there something else going on in the background that's causing this?

Thanks,

Rob Roeterdink



There's probably no real way around this sort of problem. One can if one has the time to try and optomise the particular thread's software to minimise the issue but in the end there is no real way to forecast the future requirements of the program in a simple and non intrusive fashion (note the simple and nonintrusive).
Over the years (we are talking 50 years here!) there has been PLENTY of effort within hardware, aplication programming and operating system design to try and minimise file axis times.

Lindsay

#12 User is online   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,491
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 23 July 2013 - 01:58 AM

View Postroeter, on 22 July 2013 - 04:06 PM, said:

now we're one this subject, there's something that's been bothering me for quite some time.
When the system has to load a 'new' sound (i.e. one that's not been played before in this session), the whole display freezes while the sound is loaded.
I would assume that with multithreading etc., display would be independent from sound, but apparantly that is not so.
Are we one thread short - should sound have it's own thread? Or is there something else going on in the background that's causing this?


There is a very long-standing bug in the cab control code, which causes it to load the sound files directly (i.e. in the Updater Process). This is obviously completely wrong but I've not felt comfortable enough with the sound code to fix it. Everything else, including environmental sounds, is all done from the Sound Process, which is a completely independent thread and AFAIK never causes any issues.

#13 User is offline   dennisat 

  • Conductor
  • Group: Status: Contributing Member
  • Posts: 474
  • Joined: 16-February 13
  • Gender:Male
  • Simulator:Open Rails & MSTS
  • Country:

Posted 23 July 2013 - 05:00 AM

View PostJames Ross, on 23 July 2013 - 01:58 AM, said:

There is a very long-standing bug in the cab control code, which causes it to load the sound files directly (i.e. in the Updater Process)


Are sounds for the AI train cabs loaded and played? I sometimes here cab sounds when in external views, eg brake and throttle operation, which are not the Player train cab sounds. I am assuming these sounds are coming from nearby AI trains. If this is the case, could these sounds not be loaded or is it likely to be a problem with the sms file?

Dennis

#14 User is offline   gpz 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,772
  • Joined: 27-October 12
  • Gender:Male
  • Location:Budapest
  • Simulator:OpenRails
  • Country:

Posted 23 July 2013 - 05:08 AM

This shouldn't normally happen, there is a code piece that intends to prevent this. Can you reproduce it (preferably with standard routes)? If you can, please file a bug report at https://launchpad.net/or

#15 User is offline   copperpen 

  • Executive Vice President
  • Group: Status: Elite Member
  • Posts: 3,144
  • Joined: 08-August 05
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 23 July 2013 - 07:54 AM

James

Thank you for explaining the why and how of the stutters. I have tried the experimental load delay, but it is definitely not for me. The load process is made longer as intended, which does smooth things out quite well, however the big downside is chunks of scenery popping into view quite close to the player viewpoint. I will put up with the judders and screen freezes until a solution is found.

#16 User is offline   gpz 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,772
  • Joined: 27-October 12
  • Gender:Male
  • Location:Budapest
  • Simulator:OpenRails
  • Country:

Posted 23 July 2013 - 09:29 AM

View PostJames Ross, on 23 July 2013 - 01:58 AM, said:

There is a very long-standing bug in the cab control code, which causes it to load the sound files directly (i.e. in the Updater Process). This is obviously completely wrong but I've not felt comfortable enough with the sound code to fix it. Everything else, including environmental sounds, is all done from the Sound Process, which is a completely independent thread and AFAIK never causes any issues.

James,

Do you mean the LoadCarSound() and LoadTrackSound() functions in constructors of MSTSWagonViewer and MSTSLocomotiveViewer classes? Those parse the sms files, add SoundSource objects to SoundSources list and register events at car loading time, but don't actually load any wav files. Wav files get loaded by the sound process when it runs through SoundSources. Or is there some other code that don't come to my mind now? (I'm really interested, it should be fixed if possible.)

#17 User is online   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,491
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 23 July 2013 - 11:56 PM

View Postgpz, on 23 July 2013 - 09:29 AM, said:

Do you mean the LoadCarSound() and LoadTrackSound() functions in constructors of MSTSWagonViewer and MSTSLocomotiveViewer classes? Those parse the sms files, add SoundSource objects to SoundSources list and register events at car loading time, but don't actually load any wav files. Wav files get loaded by the sound process when it runs through SoundSources. Or is there some other code that don't come to my mind now? (I'm really interested, it should be fixed if possible.)


I don't think it is that code; it is the code that plays sounds when you operate the cab controls. I've not actually looked in to the code but I have clearly observed the cab control sound files being loaded on the wrong thread.

#18 User is offline   gpz 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,772
  • Joined: 27-October 12
  • Gender:Male
  • Location:Budapest
  • Simulator:OpenRails
  • Country:

Posted 24 July 2013 - 11:55 AM

There is only the OpenWavFile() function loads wav files, which is called from constructor of SoundPiece class, which is called only by SoundItem.SetPiece() function, which is called from ALSoundSource.Queue(), which is called from sound commands' Run() function. These functions are called by TryTrigger(), which is called by SoundStream.Update(), which is a sound thread function.

Cab sound events are registered in MSTSLocomotiveViewer:
if (Locomotive.CabSoundFileName != null) LoadCarSound(wagonFolderSlash, Locomotive.CabSoundFileName);

But this line doesn't load the wav files, just adds the SoundSources and SoundStreams to the list, for being updated as written above. As I can find out these tasks are completely separated. (And these lines might be extremely boring for a non-programmer. :drinks: )

#19 User is online   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,491
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 25 July 2013 - 12:45 AM

View Postgpz, on 24 July 2013 - 11:55 AM, said:

But this line doesn't load the wav files, just adds the SoundSources and SoundStreams to the list, for being updated as written above. As I can find out these tasks are completely separated. (And these lines might be extremely boring for a non-programmer. ;) )


If this has changed in the last few months, the issue might be fixed now, but I know it was an issue not that long ago.

#20 User is offline   gpz 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,772
  • Joined: 27-October 12
  • Gender:Male
  • Location:Budapest
  • Simulator:OpenRails
  • Country:

Posted 25 July 2013 - 04:15 AM

View PostJames Ross, on 25 July 2013 - 12:45 AM, said:

If this has changed in the last few months

Well, I'm afraid not. So it must be something else.

  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users