Sunday 28 December 2008

The new year is almost here...

And so is the end of the project at work. It's been a while since my last post, so I figured I'd do one just before the new year sets in. After a month of working late most nights to get the project (which I can't disclose info on just yet..) at work finished, its finally there. I'm sitting on a sunday afternoon just keeping an eye on the bug database incase anything bad comes in, it goes off the first week of the new year so I'm sitting ready to go into work any time.

Even with the extra time spent at work the last month, I've still been working at home on FF. It's not had a lot of work done to it, mostly been dabbling about with the Python bindings and working out nicer approaches to get it working seamlessly with C++. A night down the pub with Callidus a while back, he was mentioning binding Python tightly with his engine's event system. The basic idea was to register a callable PyObject* with an event, and from C++, call this directly - avoiding SIP entirely, and above all else - being very fast. I've expanded a little on this idea by passing objects with events much like wxPython does. The objects passed in are autogenerated C++ classes with autogenerated SIP bindings, and autogenerated utility routines to help the event system work nicely with them, as well as being memory efficient. All thats needed is a small file which defines all the events, from that, it generates all the enums, classes, and macros required to use them. This allows C++ to send user data to Python, and Python to send user data to C++ - all with the same interface, so converting any C++ code to Python, and visa versa shouldn't be a problem if it relies on the event system. Anyways, a small example of the event descriptor used to generate the event classes:

Ev:MusicNext
Ev:MusicPrev
Ev:MusicStartedTrack
string trackArtist
string trackTitle

Two events straight out of FF. The Python music player binds to the MusicNext and MusicPrev, and when a track is started, it send MusicStartedTrack with info about the track started attached. I've got a script which parses this descriptor to generate the code. A snippet of the code it generates is as follows:

75 class EvMusicNext: public EvBaseEvent

76 {

77 public:

78 EvMusicNext(): EvBaseEvent( evET_MUSICNEXT ){}

79

80

81 private:

82 };

83

84 class EvMusicPrev: public EvBaseEvent

85 {

86 public:

87 EvMusicPrev(): EvBaseEvent( evET_MUSICPREV ){}

88

89

90 private:

91 };

92

93 class EvMusicStartedTrack: public EvBaseEvent

94 {

95 public:

96 EvMusicStartedTrack(): EvBaseEvent( evET_MUSICSTARTEDTRACK ){}

97

98 void trackArtist( const BcChar* _trackArtist ){ BcStrNCopy( trackArtist_, _trackArtist, 32 ); trackArtist_[31] = '\0'; };

99 const BcChar* trackArtist() const{ return trackArtist_; };

100 void trackTitle( const BcChar* _trackTitle ){ BcStrNCopy( trackTitle_, _trackTitle, 32 ); trackTitle_[31] = '\0'; };

101 const BcChar* trackTitle() const{ return trackTitle_; };

102

103 private:

104 BcChar trackArtist_[32];

105 BcChar trackTitle_[32];

106 };


You can see its quite heavy, but it's better that than being flaky. I'd rather have a wrapped up interface than having the events as raw structs.

In other news, Christmas has passed, and I got an EeePC 900A! Finally I have a working laptop once again to serve as a secondary machine/third monitor, and something to mess about on. First thing that was done to it was strip off Xandros (sorry..), and install a fresh copy of XP onto it. Out of the box, it runs very poorly. Thanks to a guide on the EeeUser forums, it's running up to speed now! Most of the speed improvement seemed to come from setting up a Ramdrive for temp files and the firefox cache. I have a 2GB RAM upgrade on it's way so I can bump up the Ramdrive to a larger size, and not run low with the swap file disabled. This thing is 'supposed' to be only really for browsing, but I'm treating it as my second dev machine. Python 2.5.2 and Visual Studio occupy a large chunk of the ickle 8GB SSD.

And finally, some people are already aware of this, but in about 3 weeks I'm off to Thailand! As always I can't give many details, but what I can say is Goodbye UK! I'm there for a total of 3 months, and heading to Australia for a couple of weeks afterwards to visit family. Due back in the UK mid May! When out there, this and Facebook will be my means of keeping in touch with people back home, though its primarily a development blog - so there won't be a single post without news on FF, which I will hopefully have a LOT of time free to work on whilst away.

Bbai for now!