Example #1
0
G_MODULE_EXPORT void
on_showPoints_toggled( GtkToggleButton *button,
               gpointer      data )
{
    // Show points toggled. Redraw will be needed either way.
    showPoints = gtk_toggle_button_get_active(button);
    redrawFrame();
}
Example #2
0
G_MODULE_EXPORT void
on_currentFrame_value_changed( GtkSpinButton *button,
               void *      data )
{
    gdouble val = 0.0;
    currentFrame = gtk_spin_button_get_value(button);
    // Move the video to the new current frame; redraw it.
    redrawFrame();
}
Example #3
0
G_MODULE_EXPORT void
on_threshold_value_changed( GtkSpinButton *button,
               void *      data )
{
    // threshold value changed
    gdouble val = 0.0;
    val = gtk_spin_button_get_value(button);
    thresholdValue = val;
    redrawFrame();
}
Example #4
0
G_MODULE_EXPORT void
on_boxSize_value_changed( GtkSpinButton *button,
               void *      data )
{
    // ROI size changed. Redraw needed if points are displayed.
    gdouble val = 0.0;
    val = gtk_spin_button_get_value(button);
    ROIsize = val;
    if (showPoints)
    {
        redrawFrame();
    }
}
Example #5
0
void FlexHelperImplWin::updateStyle(HWND hwnd)
{
    if (_dwmEnabled)
    {
        DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
        DWORD rsStyle = WS_THICKFRAME | WS_DLGFRAME | WS_VSCROLL | WS_HSCROLL;
        if (dwStyle & rsStyle)
        {
            RECT rc;
            _lock = TRUE;
            SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~rsStyle);
            GetWindowRect(hwnd, &rc);
            SendMessage(hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rc);
            if (_windowFlags & Qt::WindowMinimizeButtonHint)
            {
                dwStyle |= WS_MINIMIZEBOX;
            }
            if (_windowFlags & Qt::WindowMaximizeButtonHint)
            {
                dwStyle |= WS_MAXIMIZEBOX;
            }
            if (_windowFlags & Qt::WindowSystemMenuHint)
            {
                dwStyle |= WS_SYSMENU;
            }
            SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle | WS_CAPTION);
            _lock = FALSE;
            notifyFrame(hwnd);
        }
    }
    else
    {
        DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
        DWORD rsStyle = WS_DLGFRAME | WS_VSCROLL | WS_HSCROLL;
        if (dwStyle & rsStyle)
        {
            RECT rc;
            _lock = TRUE;
            SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~rsStyle);
            GetWindowRect(hwnd, &rc);
            SendMessage(hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rc);
            SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle);
            _lock = FALSE;
            redrawFrame(hwnd);
        }
    }
}
Example #6
0
G_MODULE_EXPORT void
on_doIt_clicked( GtkButton *button,
               gpointer      data )
{
    printf("button clicked\n");

    smf_t* smf = smf_new();
    smf_track_t* track = smf_track_new();
    smf_add_track(smf, track);

    smf_event_t* event;

    gboolean prevFrame[NUMBER_OF_KEYS] = { FALSE };
    
    // Start video from beginning
    currentFrame = startFrame;

//upper 9 notes have lyrics
//2920 start
    while (currentFrame <= stopFrame)
    {
        int i = 0;
        if ( currentFrame == stopFrame )
        {
            for (i = 0; i < NUMBER_OF_KEYS; i++ )
            {
                noteOn[i] = FALSE;
            }
        }
        else
        {
            redrawFrame();
        }
        // Why NUMBER_OF_KEYS - 10? Well, the lyrics in my example are printed across
        // the upper 10 notes and were being detected as notes themselves, causing odd
        // trilling when they scrolled past. This was a quick hack to make that stop.
        for ( i = 0; i < NUMBER_OF_KEYS - 10; i++ )
        {
            char note = 0xd + i;
            char eventBytes[3] = { 0 };
            eventBytes[1] = note; // which note to play
            eventBytes[2] = 0x7f; // full velocity (may toy with later)
            if (prevFrame[i] && (!noteOn[i]))
            {
                // Time to generate a note-off
                eventBytes[0] = 0x80;
                printf("note-off: %x, at frame %f\n", i + 0xd, currentFrame);
            }
            if ((!prevFrame[i]) && noteOn[i])
            {
                // Time to generate a note-on
                eventBytes[0] = 0x90;
                printf("note-on: %x, at frame %f\n", i + 0xd, currentFrame);
            }

            prevFrame[i] = noteOn[i];

            if ( eventBytes[0] )
            {
                event = smf_event_new_from_pointer(eventBytes, 3);
                smf_track_add_event_seconds(track, event, currentFrame / 30.0);
            }
        }
        currentFrame++;
        gtk_main_iteration_do( FALSE );
    }
    smf_save(smf, "output.mid");
}