Background Audio

I am writing a game that has continuous background audio that needs to play regardless of what Window is open. I would prefer it if I didn’t have to have a separate hidden Window to handle this.

I thought about using a Global Property to store the MoviePlayer but I can’t get the audio to play or the program crashes when trying to debug.

you do not need a movieplayer,
make a property ‘mysound’

  dim f as FolderItem = GetFolderItem("/path/to/your/soundfile/your sound.mp3", FolderItem.PathTypeNative)
  if f <> nil and f.Exists then
    mysound = f.OpenAsSound
    mysound.play
  end if

you can stop it with

mysound.stop

The sound is stored as text inside a SQLite Database file.

You could write it to temporary then load i as a file from there. The sound class does not have a FromData helper like the picture class unfortunately so you can’t create it directly from the data in your database.

Axel: Just a thumbs up to you for all of your ‘workarounds’. I use several of them (your popup box most recently) and they’re always great!

I use the MBS Plugins and there is a function to convert Text to a Movie and that’s what I was using. Unfortunately there is no Text to Sound function.

Is there a way to convert the Movie to Sound then. I would like to avoid writing temporary files.