Skip to content

Instantly share code, notes, and snippets.

@ofTheo
ofTheo / ofApp.cpp
Created July 10, 2023 20:25
Dawn / webGPU test
#include "ofApp.h"
//-------------------------------------------------------------------------------------------
//mostly pulled from CppHelloTriangle.cpp example - void initTextures()
//note the code in this seems to have changed a lot in the last few months - so a more up to date Dawn might need some language changes in here
void ofApp::makeTextureFromOFPixels( ofPixels & pix ) {
auto & device = dawnWindow->mDevice;
dawn::TextureDescriptor descriptor;
var LibraryHTML5Audio = {
$AUDIO: {
players: [],
lastSoundID: 0,
},
html5audio_list_devices: function(){
console.log("list devices")
const constraints = {audio: true};
#include "ofSoundStream.h"
#include "ofAppRunner.h"
#include "ofLog.h"
#if defined(OF_SOUND_PLAYER_FMOD)
#include "ofSoundPlayer.h"
#endif
#ifdef OF_SOUNDSTREAM_RTAUDIO
#include "ofRtAudioSoundStream.h"
@ofTheo
ofTheo / gist:0784930c829d8cae8e1dca1f618227a9
Last active October 11, 2022 20:15
pseudo code for adding audio to a video file
float audioDuration = (1.0/1000.0) * (float)(lastTimestampMillis-firstTimestampMillis);
string audioCommands;
if( audioPath.length() ){
audioCommands = " -ss "+ofToString(timelineOffset, 3)+" -t " + ofToString(audioDuration, 3)+ " -i "+ ofToDataPath(audioPath, true);
@ofTheo
ofTheo / gstreamer-output.sh
Last active August 16, 2022 21:59
gstreamer output working graph
0:00:00.000038000 50075 0x7fc196f05e00 INFO   GST_INIT gst.c:586:init_pre: Initializing GStreamer Core Library version 1.18.6
0:00:00.000064000 50075 0x7fc196f05e00 INFO   GST_INIT gst.c:587:init_pre: Using library installed in /Library/Frameworks/GStreamer.framework/Versions/1.0/lib
0:00:00.000082000 50075 0x7fc196f05e00 INFO   GST_INIT gst.c:607:init_pre: Darwin DesignIOLaptop.local 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64
0:00:00.000345000 50075 0x7fc196f05e00 INFO   GST_INIT gstmessage.c:129:_priv_gst_message_initialize: init messages
0:00:00.000971000 50075 0x7fc196f05e00 INFO   GST_INIT gstcontext.c:85:_priv_gst_context_initialize: init contexts
0:00:00.001255000 50075 0x7fc196f05e00
#include "ofApp.h"
#include "SampleUtils.h"
#include "utils/ComboRenderPipelineDescriptor.h"
#include "utils/DawnHelpers.h"
#include "utils/SystemUtils.h"
#include "GLFW/glfw3.h"
static vector <int> getPeaks( ofPolyline & l, float angleThresh, int numToLook, bool bInvert, bool bGroup, int numToSkip = 0 ){
vector <int> results;
if( l.size() >= 3 ){
for(int k = 0; k < l.size(); k++){
ofPoint normal;
bool bPeak = true;
for(int j = 1; j < numToLook; j++){
void findHomogrpahy( vector <ofVec2f> inPts, vector <ofVec2f> outPts, CvMat * homography){
homography = cvCreateMat(3,3,CV_32FC1);
CvPoint2D32f * srcPts = new CvPoint2D32f[ inPts.size() ];
CvPoint2D32f * dstPts = new CvPoint2D32f[ outPts.size() ];
for(int i = 0; i < inPts.size(); i++){
//--------------------------------------------------------------
void testApp::setup(){
vector <AlliedCamera::CameraInfo> cameras = AlliedCamera::ListDevices();
if( cameras.size() ){
//true means block until the camera is opened and frames are coming in.
if( camera.openCamera(0, true) ){
cout << " camera opened " << endl;
}
@ofTheo
ofTheo / UDPImageTransfer.cpp
Created October 4, 2014 22:35
UDPImageTransfer
//
// UDPImageTransfer.cpp
//
// Created by Theodore Watson on 9/16/14.
//
//
#include "UDPImageTransfer.h"
UDPImageTransfer::UDPImageTransfer(){