Bed Dismantling

Today was a bit of a break, which was nice. I’d bought a bed on ebay (as you do) and so we had to get the old bed to pieces and round to next door.

Then we had to make space in the bedroom, put the new bed in, find it fits exactly (wahay!) and then I went off and picked up my new car. Turns out that buying new cars is another good displacement activity. And no, I didn’t get it on ebay.

True Story

I’ve not been writing all the time I suppose. Last week I had to take my computer in to the mender to have a working cpu board replaced with another working one.

Some time back, just hours before my trip to Cairo, my lovely MacBook became a lot less lovely by dropping dead on me. Fortunately I had a tiny spare machine in the form of my Advent notebook which did a sterling job of standing in for my shiny paperweight.

When I got back I took the laptop to the menders and they put a new cpu board in which worked fine. Unfortunately the board they fitted was the wrong one, and so last week I had to take two hour break from the courseware while my machine was back in the workshop having the board replaced with one that was 0.2 GHz faster. I’d like to be able to say that I can tell the difference, but I really can’t.

Writing

There should be a corollary to the old adage “Be careful what you wish for” which is “Be careful what you promise to do”.

Some time back I promised to write some XNA courseware. A whole course worth in fact, based on my XNA book.  This has turned out to be a non-trivial exercise. In fact I’ve been writing pretty much continuously for the last fortnight, around 10 hours a day, 7 days a week. And at the time of writing I’ve reached chapter 12.

Silly me.

The problem is that after a day of writing I don’t really feel that keen to trot out some fun prose about what kind of day I have had because, quite frankly, at the moment I can’t tell them apart. And I can’t even think of novel combinations of the “I have been mostly writing today”.

The good news is that some day soon you will be able to download and use my XNA course material. And I jolly well hope you find it useful.

Breaking Changes in XNA 3.1 SoundEffect

I hate breaking changes. They are like getting into your car and finding that the steering wheel is now the gear lever, and the seats are facing the other way.

Generally speaking the people who make the software try to avoid them too, which is as it should be. But every now and then they make the judgement call that somebody else’s pain is worth their gain, and so they go and move the universe around a bit.

They have done it with the move to XNA 3.1 from XNA 3.0. XNA 3.0 introduced a new SoundEffect type which made it much easier to make sound. Unfortunately, in its original incarnation this type also made it easy to inadvertently make sound that stole all the sound channels by mistake, and so they have fixed this in version 3.1.

Essentially, in XNA 3.0 the SoundEffect.Play() method used to return a reference to a SoundEffectInstance object, that you could then tweak to change some of the properties of the playing sound. This was kind of neat, except that if you ignored the return from Play it meant that the SoundEffectInstance that was created ended up being left hanging around, probably hogging a sound channel, until the garbage man got around to killing it off. If your game was well designed and looked after memory properly this may not happen of course, and so you would run out of sound channels for no good reason.

In XNA 3.1 the same Play method returns something different. It just sends back a boolean value that indicates that the sound is playing correctly. To get hold of a SoundEffectInstace you have to call the aptly named CreateInstance method on your SoundEffect. All very sensible, and much less likely to hog all the sound channels.

However, if you have just written a book which carefully describes the way that XNA 3.0 works in this respect (just like I have) then you are left wondering why they didn’t add an extra method (perhaps called QuickPlay or something) and leave the old Play intact…

Oh well.