sh0dan // VoxPod

Thursday, January 11, 2007

SoundOut plugin for AviSynth

I have spent some time on my new project, a sound output plugin for AviSynth. It was actually one of many projects, but I wanted to do something new, so a GUI-based AviSynth filter seemed like a good challenge.

I had recently touched "traditional" windows GUI, when developing for Windows CE, but it has been years since I last had done some real GUI work (which honestly was mostly copy+adapt+paste). And since I had recently been frustrated with the effort required to export sound from AviSynth, I had myself a project. Enter SoundOut:


Yes - there are still some grayed out boxes, so I obviously haven't finished, but right now I struggling with Commandline Output using pipes and slowly implementing general parameter and preset handling.

Even though the Resource Editor has been disabled in the Visual Studio 2005 Express, I choose to go the "oldfashioned" way, and use Common Controls. I had tried using CLR Windows Forms for a simple GUI for the TCPDeliver server, but I didn't manage to integrate it into the current code, since it required the project to be compiled with CLR support.

After some frustration (since I refuse to go back to VS 6) I did however find a very nice free resource editor called resED. It works very well, if you create your resources from scratch - it does seem to have small problems importing VC6 resources. But with that in mind, I haven't had any additional issues with it. I did however find out how hard it actually is to find coding documentation on on Common Controls on MSDN - you have to dig very deep at times.



It has been quite nice to work with prebuilt libraries. The API's are usually very different. None of them are perfect, but they usually work quite well within their limitations. So far the only problem besides the usual linker strangeness has been time. Building GUIs are extremely time-consuming - I had almost forgotten how it was - but it just takes so much time to get everything tweaked right the way you want it. I love the control you have in C++, but trivial tasks like adding a checkbutton for an output option simply takes a long time. Right now the workflow is:
  • Add GUI element in the resource editor.
  • Setting the internal parameter to default value on output module creation.
  • (Apply presets / script value overrides - This is thankfully generic code)
  • Setting the parameters to the GUI.
  • Waiting for user inputs.
  • Transfer user GUI values to internal parameter storage.
  • (Save internal parameters - again generic code)
  • Apply the internal parameters to the output module.
This is (obviously) of the things I'm considering adding more generic code for. If I could set up simple relations between GUI elements and internal parameters for checkboxes, sliders, etc. a lot of code would probably be a lot simpler.

Ok - seems like we are getting a bit to technical here. I could wrote for hours about the threading and performance stuff, but I'll stop here... Either way, I see this as a good personal development project - and I also hope a few more people will use this than TCPDeliver, or AviSynth 2.6 for that matter! ;)



The future for this project holds:
  • Storing and loading presets.
  • A framework for attaching buttons to parameters internally.
  • Read settings from script.
  • Implement missing compression types.
  • Test & Documentation.
  • Sound Input filters? We already have the libraries - most of them have some input modes.

But there are other possible projects (in no specific order) I hope to get some time for:
  • Putting more time into finishing up AviSynth 2.6.
  • Writing a kernel blur, using the AviSynth resizer.
  • Yet another GUI for AviSynth. ;)
  • Beginning a new project on a GPU-based RAW photo converter from scratch.
  • Getting more work done on a text-indexing project I've been working on.
... But as always time and energy is the limiting factor. Right now the NFL Playoffs are taking away my weekend evenings. It also seems like there is a Symbian port of my work project coming up - so odds are against much more than finishing up the projects.