• entries
    359
  • comments
    237
  • views
    188202

Sound progress.

Sign in to follow this  
Telastyn

41 views

I worked a bit on the sound code tonight and earlier in the week. Added a bunch of sound classes which erm... make no sound. Included:

Silence - Takes a TimeSpan, and behaves like a sound object of that length with no actual sound.
Sequence - Takes two sound objects and ensures that they play one after another. Any methods are directed to the one actually playing.
SynchronizedPair - Takes two sound objects and plays them together (waiting until both finish to trigger the 'done' event). Methods effect both.
Fader - Decorator to fade the volume.
Looper - Decorator to loop the sound.

These should allow me to 'build' some sound effects via the composite pattern, like *whizz* *-wait wait-* *BANG* out of their parts rather than busting out my non-existent sound editor.


I also added a long overdue addition to my resource manager. Currently you say Load("definition"). The definition is linked to a longer string which is interpreted, stuff loaded, and returned. Useful since 'TitleMusic' can have its actual load commands changed without editing the load requests everywhere.

Unfortunately, it's a pain to just run commands through the interpreter that way. Direct interpretation is useful for these sort of decorators when their creation parameters is another load string. So I added a breakout to the interpreter. Load("!CommandString") now calls LoadAnon("CommandString") passing the string as a command through to the interpreter directly and returning the result.

I am glad my interpreter setup is flexible and powerful enough to deal with such things. I am disheartened that I'm using a powerful and flexible interpreter to just load stuff. I'm further disheartened that I'm using one I wrote rather than a myriad of pre-made alternatives...

Ah well. It works, and now more stuff works. Make stuff work first; retrospect decisions after.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now