Tuesday, February 28, 2006

help changes for 1.3

add Random Ramp to Waveforms GIF (done)
add Trail to Master Controls (done)
add Convex to Trail (done)
add Convex to Effects (done)
modify Origin Motion for Trail (done)
modify Mouse Modes for Trail (done)
modify Canvas Scale for new origin limits (done)
modify Zoom for new origin limits and Window/Zoom (done)
modify Panic for Trail reset (done)
update shortcut tables (done)
add Trail to features list on web site (done)
idea: comprehensive list of menu commands?

help changes for 1.2

Master offsets are now saved. Affected topics: Master Offsets, Playlists
Add oscillator override (new topic)
Add MIDI setup's Advanced checkbox
Zero controllers / Panic reset oscillator frequency overrides

Monday, February 27, 2006

MIDI color oscillator overrides

Frequency AND amplitude, for each color component (HLS), for both foreground and background color is 2 * 3 * 2 = 12 knobs. It turns out to be too much to handle live. Better to control the frequencies only, and hard-code the amplitudes:

amp freq (range)
color speed 1 .1
lightness .25 .1
saturation .5 .1
bk hue 180 .01
bk lightness .25 .1
bk saturation .5 .1

Thursday, February 23, 2006

don't draw to video memory

Supposedly mirrored mode is faster because it reduces drawing by 3/4, but even if this difference is eliminated (by restricting drawing to the upper left quadrant), mirrored mode is STILL faster. The reason is that mirrored mode always draws to system memory. The solution is to draw to system memory in all cases.

Tuesday, February 07, 2006

awesome matt trail demo

patch "pinwheel fab color", master 158, zoom 119, damping 95.5, tempo 14.96, unmirrored, fill, outline (requires serious hotrod action)

This demo proves that trail is way better than odd shift and should be up next on the enhancement list.

Friday, February 03, 2006

allow user to register BmpToAvi

Cool idea, but unnecessary: now that the installer correctly handles upgrading (each release must have a new project GUID, but the same upgrade GUID), this situation can't arise anymore.

if (bta.GetLastError() == CBmpToAvi::ERR_CREATE_SOURCE
&& hr == REGDB_E_CLASSNOTREG) {
static const LPCSTR BmpToAviName = "BmpToAvi.ax";
if (AfxMessageBox(IDS_MEX_BTA_INSTALL, MB_YESNO) == IDYES) {
CPathStr path = CMainFrame::GetAppPath();
path.Append(BmpToAviName);
if (PathFileExists(path)) {
CString cmd;
cmd.Format("regsvr32 /s \"%s\"", path);
int retc = system(cmd);
if (retc)
AfxMessageBox(IDS_MEX_BTA_CANT_REG);
else
goto retry;
} else {
CString s;
s.Format(IDS_MEX_BTA_NOT_FOUND, BmpToAviName);
AfxMessageBox(s);
}
}
}

no more 2 GB limit

I took a look at the OpenDML stuff, but in the end I decided to solve this the MS way: I wrote my own DirectShow show source filter that inserts frames (as bitmaps) into a video stream.

That turned out to be the *easy* part! The SDK's "ball" example was a pretty good starting part for writing a DirectShow source filter. The only real problem is that the ball filter draws the frames itself, whereas I needed to draw the frames in the application, and then pass them to the source filter. Turns out MS thought of that: you can override the DoBufferProcessingLoop function, cool.

There's also the minor detail of how to call my filter's "add frame" function from the application: turns out that requires creating a new COM interface. A bit of research, but not too bad. And of course I need some application code to create a filter graph, connect all the "pins" together and run the graph. There are examples of this all over the place, nothing new here.

The real problem came from an unexpected direction: how to set the video compression options? The Vfw AVIFile API had a wonderful function called AVISaveOptions: it displayed a dialog listing all your video compressors, and allowed you to select one and configure it. And in DirectShow? Nothing like that exists. Insane but true.

So I wound up writing a DirectShow Video Compression dialog object. You pass it your source and destination filters, and it displays the dialog, and returns a fully-configured compressor filter.

The bottom line? I have developed two reusable technologies:
1) A DirectShow BMP to AVI converter.
2) A DirectShow Video Compression dialog

I suspect both could be useful to other developers, so I'm going to submit them to CodeProject later. Right now my priority is integrating them into a new version of Whorld.

Wednesday, February 01, 2006

data rates

In AVIFile's Video Compression dialog, tried setting data rate for a few encoders:
indeo video 5.1
Intel indeo video R3.2
used steve1, crop, 320x240, frames 5000-5200
In both cases, checking the box caused the data rate in the file to drop by almost half REGARDLESS of what number was typed for data rate. crazy!

Things that weren't obvious

1) IAMVfwCompressDialogs must be used AFTER THE COMPRESSOR IS CONNECTED, otherwise Configure ignores SetState and reinitializes the dialog every time
2) IAMVideoCompression must be created on the OUTPUT PIN of the compressor, not the on compressor itself
3) any size other than 320 x 240 causes first-chance exception in QCAP.DLL (debug only)

more problems: can't seem to set output bit rate, maybe that just doesn't work

IPin *pComprOut = CDSBmpToAvi::GetPin(ip->pCompr, PINDIR_OUTPUT);
if (pComprOut != NULL) { // if we got compressor's output pin
IAMStreamConfig *pStreamCfg = NULL;
m_hr = pComprOut->QueryInterface( // get IAMVideoCompression
IID_IAMStreamConfig, (void **)&pStreamCfg);
if (pStreamCfg != NULL) { // do GetFormat after input pin is connected
AM_MEDIA_TYPE *pmt;
m_hr = pStreamCfg->GetFormat(&pmt);
if (SUCCEEDED(m_hr)) {
printf("get format ok\n");
if (pmt->formattype == FORMAT_VideoInfo) {
VIDEOINFOHEADER *pvh = (VIDEOINFOHEADER *)pmt->pbFormat;
printf("%d\n", pvh->dwBitRate);
pvh->dwBitRate = 10000;
m_hr = pStreamCfg->SetFormat(pmt);
if (SUCCEEDED(m_hr)) {
printf("set format ok\n");
}
// DeleteMediaType(pmt);
}
}
}
}