Beispiel #1
0
void ofxTouchBoard::printData(vector<ofxTB::Electrode>& e, float x, float y){
	float charWidth = 11;
	float charHeight = 15;
	float xOffset = x;
	float yOffset = y + charHeight;
	float colWidth = 30;
	float rowHeight = 20;
	ofDrawBitmapString("E", x, yOffset);
	xOffset += 2 * charWidth;
	ofDrawBitmapString("TOUCH", xOffset, yOffset);
	xOffset += 5 * charWidth;
	ofDrawBitmapString("TTHS", xOffset, yOffset);
	xOffset += 4 * charWidth;
	ofDrawBitmapString("RTHS", xOffset, yOffset);
	xOffset += 4 * charWidth;
	ofDrawBitmapString("FDAT", xOffset, yOffset);
	xOffset += 4 * charWidth;
	ofDrawBitmapString("BVAL", xOffset, yOffset);
	xOffset += 4 * charWidth;
	ofDrawBitmapString("DIFF", xOffset, yOffset);
	yOffset += charHeight;

	for(int i = 0; i < e.size(); ++i){
		xOffset = x;
		printDataLine(i, xOffset, yOffset);
		xOffset += 2 * charWidth;
		printDataLine(e[i].touch, xOffset, yOffset);
		xOffset += 5 * charWidth;
		printDataLine(e[i].tths, xOffset, yOffset);
		xOffset += 4 * charWidth;
		printDataLine(e[i].rths, xOffset, yOffset);
		xOffset += 4 * charWidth;
		printDataLine(e[i].fdat, xOffset, yOffset);
		xOffset += 4 * charWidth;
		printDataLine(e[i].bval, xOffset, yOffset);
		xOffset += 4 * charWidth;
		printDataLine(e[i].diff, xOffset, yOffset);
		yOffset += charHeight;
	}
}
Beispiel #2
0
void D2V::index() {
    AVPacket packet;
    av_init_packet(&packet);

    while (av_read_frame(f->fctx, &packet) == 0) {
        if (stop_processing) {
            stop_processing = false;
            result = ProcessingCancelled;
            fclose(d2v_file);
            closeAudioFiles(audio_files, f->fctx);
            return;
        }

        // Apparently we might receive packets from streams with AVDISCARD_ALL set,
        // and also from streams discovered late, probably.
        if (packet.stream_index != video_stream->index &&
            !audio_files.count(packet.stream_index)) {
            av_free_packet(&packet);
            continue;
        }

        bool okay = true;

        if (packet.stream_index == video_stream->index)
            okay = handleVideoPacket(&packet);
        else
            okay = handleAudioPacket(&packet);

        if (!okay) {
            av_free_packet(&packet);
            result = ProcessingError;
            fclose(d2v_file);
            closeAudioFiles(audio_files, f->fctx);
            return;
        }

        av_free_packet(&packet);
    }

    if (!isDataLineNull()) {
        reorderDataLineFlags();
        lines.push_back(line);
        clearDataLine();
    }


    if (!lines.size()) {
        result = ProcessingFinished;
        fclose(d2v_file);
        closeAudioFiles(audio_files, f->fctx);
        return;
    }


    if (!printHeader()) {
        result = ProcessingError;
        fclose(d2v_file);
        closeAudioFiles(audio_files, f->fctx);
        return;
    }

    if (!printSettings()) {
        result = ProcessingError;
        fclose(d2v_file);
        closeAudioFiles(audio_files, f->fctx);
        return;
    }

    for (size_t i = 0; i < lines.size(); i++) {
        if (stop_processing) {
            stop_processing = false;
            result = ProcessingCancelled;
            fclose(d2v_file);
            closeAudioFiles(audio_files, f->fctx);
            return;
        }

        if (!printDataLine(lines[i])) {
            result = ProcessingError;
            fclose(d2v_file);
            closeAudioFiles(audio_files, f->fctx);
            return;
        }
    }

    if (!printStreamEnd()) {
        result = ProcessingError;
        fclose(d2v_file);
        closeAudioFiles(audio_files, f->fctx);
        return;
    }

    result = ProcessingFinished;
    fclose(d2v_file);
    closeAudioFiles(audio_files, f->fctx);
}