<commit_before>#include "ReymentaHapPlayerApp.h"

// -------- SPOUT -------------
void ReymentaHapPlayerApp::prepareSettings(Settings *settings)
{
	g_Width = 640;
	g_Height = 480;
	// parameters
	mParameterBag = ParameterBag::create();
	// utils
	mBatchass = Batchass::create(mParameterBag);
	// if AutoLayout, try to position the window on the 2nd screen
	if (mParameterBag->mAutoLayout)
	{
		mBatchass->getWindowsResolution();
	}

	settings->setWindowSize(mParameterBag->mRenderWidth, mParameterBag->mRenderHeight);
	settings->setWindowPos(ivec2(mParameterBag->mRenderX, mParameterBag->mRenderY));

	settings->setFullScreen(false);
	settings->setResizable(false); // keep the screen size constant for a sender
	settings->enableHighDensityDisplay();
}
// ----------------------------

void ReymentaHapPlayerApp::setup()
{
	setFrameRate(60);
	setFpsSampleInterval(0.25);
	mBatchass->setup();
	mLoopVideo = false;
	// -------- SPOUT -------------
	// Set up the texture we will use to send out
	// We grab the screen so it has to be the same size
	bInitialized = false;
	spoutTexture = gl::Texture::create(g_Width, g_Height);
	strcpy_s(SenderName, "Reymenta Hap Spout Sender"); // we have to set a sender name first
	// Optionally test for texture share compatibility
	// bMemoryMode informs us whether Spout initialized for texture share or memory share
	bMemoryMode = spoutsender.GetMemoryShareMode();
	// Initialize a sender
	bInitialized = spoutsender.CreateSender(SenderName, g_Width, g_Height);
	// Arguments
	for (vector<string>::const_iterator argIt = getArgs().begin(); argIt != getArgs().end(); ++argIt) loadMovieFile(argIt[0]);
}
void ReymentaHapPlayerApp::keyDown(KeyEvent event)
{
	fs::path moviePath;
	switch (event.getCode())
	{
	case ci::app::KeyEvent::KEY_o:
		moviePath = getOpenFilePath();
		if (!moviePath.empty())
			loadMovieFile(moviePath);
		break;
	case ci::app::KeyEvent::KEY_r:
		mMovie.reset();
		break;
	case ci::app::KeyEvent::KEY_p:
		if (mMovie) mMovie->play();
		break;
	case ci::app::KeyEvent::KEY_s:
		if (mMovie) mMovie->stop();
		break;
	case ci::app::KeyEvent::KEY_SPACE:
		if (mMovie->isPlaying()) mMovie->stop(); else mMovie->play();
		break;
	case ci::app::KeyEvent::KEY_ESCAPE:
		shutdown();
		break;
	case ci::app::KeyEvent::KEY_l:
		mLoopVideo = !mLoopVideo;
		if (mMovie) mMovie->setLoop(mLoopVideo);
		break;

	default:
		break;
	}
}
void ReymentaHapPlayerApp::loadMovieFile(const fs::path &moviePath)
{
	try {
		mMovie.reset();
		// load up the movie, set it to loop, and begin playing
		mMovie = qtime::MovieGlHap::create(moviePath);
		mMovie->setLoop(mLoopVideo);
		mMovie->play();
	}
	catch (...) {
		console() << "Unable to load the movie." << std::endl;
		mInfoTexture.reset();
	}
<commit_msg>autoloop on <30sec clips<commit_after>#include "ReymentaHapPlayerApp.h"

// -------- SPOUT -------------
void ReymentaHapPlayerApp::prepareSettings(Settings *settings)
{
	g_Width = 640;
	g_Height = 480;
	// parameters
	mParameterBag = ParameterBag::create();
	// utils
	mBatchass = Batchass::create(mParameterBag);
	// if AutoLayout, try to position the window on the 2nd screen
	if (mParameterBag->mAutoLayout)
	{
		mBatchass->getWindowsResolution();
	}

	settings->setWindowSize(mParameterBag->mRenderWidth, mParameterBag->mRenderHeight);
	settings->setWindowPos(ivec2(mParameterBag->mRenderX, mParameterBag->mRenderY));

	settings->setFullScreen(false);
	settings->setResizable(false); // keep the screen size constant for a sender
	settings->enableHighDensityDisplay();
}
// ----------------------------

void ReymentaHapPlayerApp::setup()
{
	setFrameRate(60);
	setFpsSampleInterval(0.25);
	mBatchass->setup();
	mLoopVideo = false;
	// -------- SPOUT -------------
	// Set up the texture we will use to send out
	// We grab the screen so it has to be the same size
	bInitialized = false;
	spoutTexture = gl::Texture::create(g_Width, g_Height);
	strcpy_s(SenderName, "Reymenta Hap Spout Sender"); // we have to set a sender name first
	// Optionally test for texture share compatibility
	// bMemoryMode informs us whether Spout initialized for texture share or memory share
	bMemoryMode = spoutsender.GetMemoryShareMode();
	// Initialize a sender
	bInitialized = spoutsender.CreateSender(SenderName, g_Width, g_Height);
	// Arguments
	for (vector<string>::const_iterator argIt = getArgs().begin(); argIt != getArgs().end(); ++argIt) loadMovieFile(argIt[0]);
}
void ReymentaHapPlayerApp::keyDown(KeyEvent event)
{
	fs::path moviePath;
	switch (event.getCode())
	{
	case ci::app::KeyEvent::KEY_o:
		moviePath = getOpenFilePath();
		if (!moviePath.empty())
			loadMovieFile(moviePath);
		break;
	case ci::app::KeyEvent::KEY_r:
		mMovie.reset();
		break;
	case ci::app::KeyEvent::KEY_p:
		if (mMovie) mMovie->play();
		break;
	case ci::app::KeyEvent::KEY_s:
		if (mMovie) mMovie->stop();
		break;
	case ci::app::KeyEvent::KEY_SPACE:
		if (mMovie->isPlaying()) mMovie->stop(); else mMovie->play();
		break;
	case ci::app::KeyEvent::KEY_ESCAPE:
		shutdown();
		break;
	case ci::app::KeyEvent::KEY_l:
		mLoopVideo = !mLoopVideo;
		if (mMovie) mMovie->setLoop(mLoopVideo);
		break;

	default:
		break;
	}
}
void ReymentaHapPlayerApp::loadMovieFile(const fs::path &moviePath)
{
	try {
		mMovie.reset();
		// load up the movie, set it to loop, and begin playing
		mMovie = qtime::MovieGlHap::create(moviePath);
		mLoopVideo = (mMovie->getDuration() < 30.0f);
		mMovie->setLoop(mLoopVideo);
		mMovie->play();
	}
	catch (...) {
		console() << "Unable to load the movie." << std::endl;
		mInfoTexture.reset();
	}

{'fraction_non_alphanumeric': 0.16315125292951144, 'fraction_numerical': 0.005949161709031909, 'mean_word_length': 4.4232649071358745, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2202075', 'n_tokens_mistral': 2021, 'n_tokens_neox': 1907, 'n_words': 430}