Пример #1
0
xncv::VideoSource::~VideoSource()
{
	stopRecording();
	imgGen.Release();
	depthGen.Release();
	player.Release();
}
Пример #2
0
bool KeySequenceWidget::event(QEvent* event)
{
	if (status() == Recording)
	{
		switch(event->type())
		{
			case QEvent::KeyPress:
				keyPressEvent(static_cast<QKeyEvent*>(event));
				return true;

			case QEvent::MouseButtonRelease:
				event->accept();
				return true;

			case QEvent::ShortcutOverride:
				event->accept();
				return true;

			case QEvent::FocusOut:
				stopRecording();
				if (!valid())
				{
					keySequence() = backupSequence();
					updateOutput();
				}
				break;

			default:
				break;
		}
	}

	return QPushButton::event(event);
}
bool TaskRecorderManagerClient::stopRecording(const ros::Time& start_time,
                                              const std::vector<std::string>& message_names,
                                              std::vector<task_recorder2_msgs::DataSample>& messages,
                                              const bool stop_recording)
{
  bool is_recording;
  ros::Time first;
  ros::Time last;
  double sampling_rate;
  if(!getInfo(is_recording, first, last, sampling_rate))
  {
    ROS_ERROR("Could not stop recording.");
    return false;
  }
  if(!is_recording)
  {
    ROS_ERROR("Task recorders are not recording, cannot stop.");
    return false;
  }
  if(start_time < first)
  {
    ROS_ERROR("Requested start time >%f< is invalid. First recorded sample has time stamp is >%f<.", start_time.toSec(), first.toSec());
    return false;
  }
  ros::Duration duration = last - start_time;
  const int num_samples = static_cast<int>(duration.toSec() * sampling_rate);
  ROS_INFO("Recorded >%f< seconds and asking for >%i< samples.", duration.toSec(), num_samples);
  return stopRecording(start_time, last, num_samples, message_names, messages, stop_recording);
}
void RecorderSlaveBlock::eachFrame() {
    if (m_recording) {
        // recording
        if (m_linkNode->getValue() < LuminosusConstants::triggerThreshold) {
            stopRecording();
            return;
        }

        double value = m_inputNode->getValue();
        m_data.append(value);
        m_outputNode->setValue(value);
        emit dataChanged();
        return;
    }

    if (m_playing && !m_data.isEmpty()) {
        // playing
        double value = m_data[m_playbackPosition % m_data.size()];
        m_outputNode->setValue(value);

        // either progress frame or stop:
        if (m_playbackPosition + 1 >= m_data.size() || m_linkNode->getValue() < LuminosusConstants::triggerThreshold) {
            m_playing.setValue(false);
            m_playbackPosition = 0;
            emit playbackPositionChanged();
        } else {
            m_playbackPosition = (m_playbackPosition + 1) % m_data.size();
            emit playbackPositionChanged();
        }
    }
}
Пример #5
0
void LoopLayer::toggleRecording(uint64_t clockFrame)
{
  if (recording) {
    stopRecording(clockFrame);
  } else {
    startRecording(clockFrame);
  }
}
Пример #6
0
/////////////////////////////////////////////////////////
// recordMess
//
/////////////////////////////////////////////////////////
void pix_record :: recordMess(bool on)
{
  if (on) {
    startRecording();
  }else{
    stopRecording();
  }
}
Пример #7
0
void VideoRecorder::videoDurationChanged(qint64 duration)
{
    if (!shouldContinueRecording(duration)) {
        stopRecording();
    }
    m_duration = duration/1000;
    emit durationChanged();
}
Пример #8
0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventStreamer::~EventStreamer()
{
  stopRecording();

  myEventHistory.clear();
  myStreamReader.close();
  myStreamWriter.close();
}
Пример #9
0
int processEvent(GameEvent* e) {
  int value = 0;
  Data *data;

  if(game2->mode == GAME_SINGLE_RECORD) {
    writeEvent(e);
  }
  switch(e->type) {
  case EVENT_TURN_LEFT:
    data = game->player[e->player].data;
    if(data->speed > 0) {
      data->iposx = e->x;
      data->iposy = e->y;
      data->turn = TURN_LEFT;
      doTurn(data, e->timestamp);
    }
    break;
  case EVENT_TURN_RIGHT:
    data = game->player[e->player].data;
    if(data->speed > 0) {
      data->iposx = e->x;
      data->iposy = e->y;
      data->turn = TURN_RIGHT;
      doTurn(data, e->timestamp);
    }
    break;
  case EVENT_CRASH: 
    data = game->player[e->player].data;
    data->posx = data->iposx = e->x;
    data->posy = data->iposy = e->y;
    sprintf(messages, "player %d crashed", e->player + 1);
    fprintf(stderr, "%s\n", messages);
    consoleAddLine(messages);
    crashPlayer(e->player);
    break;
  case EVENT_STOP:
    fprintf(stderr, "game stopped\n");
    if(game2->mode == GAME_SINGLE_RECORD) {
      stopRecording();
      game2->mode = GAME_SINGLE;
    } else if(game2->mode == GAME_PLAY) {
      stopPlaying();
      game2->mode = GAME_SINGLE;
    }
    game->winner = e->player;
    sprintf(messages, "winner: %d", game->winner + 1);
    printf("%s\n", messages);
    consoleAddLine(messages);
    switchCallbacks(&pauseCallbacks);
    /* screenSaverCheck(0); */
    stoptime = SystemGetElapsedTime();
    game->pauseflag = PAUSE_GAME_FINISHED;
    value = 1;
    break;
  }
  free(e);
  return value;
}
Пример #10
0
std::string Driver::minidump(const std::string& prefix)
{
  if (!log_enabled_)
  {
    const std::string& err = "Log is not enabled, please enable logging before calling minidump";
    std::cout << BOLDRED << err << std::endl
              << RESETCOLOR << std::endl;
    return err;
  }

  // CHECK SIZE IN FOLDER
  long files_size = 0;
  boost::filesystem::path folderPath(boost::filesystem::current_path());
  helpers::filesystem::getFilesSize(folderPath, files_size);
  if (files_size > helpers::filesystem::folderMaximumSize)
  {
    std::cout << BOLDRED << "No more space on robot. You need to upload the presents bags and remove them to make new ones."
                 << std::endl << "To remove all the presents bags, you can run this command:" << std::endl
                    << "\t$ qicli call ROS-Driver.removeFiles" << RESETCOLOR << std::endl;
    return "No more space on robot. You need to upload the presents bags and remove them to make new ones.";
  }

  // IF A ROSBAG WAS OPENED, FIRST CLOSE IT
  if (record_enabled_)
  {
    stopRecording();
  }

  // STOP BUFFERIZING
  log_enabled_ = false;
  for(EventIter iterator = event_map_.begin(); iterator != event_map_.end(); iterator++)
  {
    iterator->second.isDumping(true);
  }
  ros::Time time = ros::Time::now();

  // START A NEW ROSBAG
  boost::mutex::scoped_lock lock_record( mutex_record_ );
  recorder_->startRecord(prefix);

  // WRITE ALL BUFFER INTO THE ROSBAG
  for(EventIter iterator = event_map_.begin(); iterator != event_map_.end(); iterator++)
  {
    iterator->second.writeDump(time);
  }
  for(RecIter iterator = rec_map_.begin(); iterator != rec_map_.end(); iterator++)
  {
    iterator->second.writeDump(time);
  }

  // RESTART BUFFERIZING
  log_enabled_ = true;
  for(EventIter iterator = event_map_.begin(); iterator != event_map_.end(); iterator++)
  {
    iterator->second.isDumping(false);
  }
  return recorder_->stopRecord(::naoqi::ros_env::getROSIP("eth0"));
}
Пример #11
0
void kommuHandler(void){
	int i;
	while(buildCommand(input_buf,command)){
		switch(command[0]){
		case 'a':
			if(kommuConnected){
				sendCommand("a",1);
				kommuNoPing = 0;
			}
			break;
		case 'b':
			sendCommand("c",1);
			kommuConnected = 1;
			kommuNoPing = 0;
			HAL_GPIO_WritePin(GPIOD,GPIO_PIN_12,GPIO_PIN_SET);
			break;
		case 's':
			stopRecording(command[1]);
			break;
		case 'r':
			if(kommuConnected){
				startRecording(command[1]);
			}
			break;
		case 'q':
			stopRecordingAll();
			break;
		case 'x':
			if(kommuConnected){
				changeValue(command+1);
			}
			break;
		}		
	}
	if(kommuConnected){
		for(i = 0; i < sendingCodesCurrent; i++){
			sendCode(sendingCodes[i],buffer);
		}
	}
	if(kommuNoPing > maxPingsMissed){ //Max ping loss?
		kommuConnected = 0;
		HAL_GPIO_WritePin(GPIOD,GPIO_PIN_12,GPIO_PIN_RESET);
	}else{
		kommuNoPing++;
	}

	if((output_currentPos>0) && !ptrUSART->GetStatus().tx_busy){
		ptrUSART->Send(output_currentBuffer,output_currentPos);
		if(output_currentBufferNr == 1){
			output_currentBuffer = output_buffer2;
			output_currentBufferNr = 2;
		}else{
			output_currentBuffer = output_buffer1;
			output_currentBufferNr = 1;
		}
		output_currentPos = 0;
	}
}
Пример #12
0
void Display::OnChange(int id)
{
CString bmesg;

	if(cbox->GetCount()<=0)
	return;
	
	if(id==IDC_RADIO1 && radio1->GetCheck())    //Send to client
	{
		cbox->EnableWindow(TRUE);
		
		if(cbox->GetCount()>=1)
		{
		curuser.Empty();
		cbox->GetLBText(cbox->GetCurSel(),curuser);
		log.WriteString("\nConnected to user "+curuser);
		selectflag=1;
		startRecording();
		}
		else
		{
		curuser.Empty();
		selectflag=0;
		stopRecording();
		 //stopPlaying();         //****** REMOVED ******//
		}	
	}
	
	if(id==IDC_RADIO2 && radio2->GetCheck())				//Send to All 
	{
	
	curuser="******";

	if(isstart==0)    //Stop the record and play 
	OnStop();
	
	log.WriteString("\n Broadcasting message");
	
	Broadcast bd(IDD_DIALOG5,this);
	bd.DoModal();
	bmesg="OVER:";
	selectflag=1;
	
	
	if(sockclt.Send(bmesg,bmesg.GetLength()))
	log.WriteString("\n Over Mesg sent to Server");
	else
	log.WriteString("\n Unable to send over mesg to Server");
	
	curuser.Empty();
	radio1->SetCheck(1);
	radio2->SetCheck(0);
	
		

	}

}
Пример #13
0
bool ASimModeBase::toggleRecording()
{
    if (isRecording())
        stopRecording();
    else
        startRecording();

    return isRecording();
}
Пример #14
0
void DemodulatorInstance::setRecording(bool recording_in)
{
    if (recording_in) {
        startRecording();
    }
    else {
        stopRecording();
    }
}
Пример #15
0
void RecordingManager::slotToggleRecording(double v) {
    if (v > 0) {
        if (isRecordingActive()) {
            stopRecording();
        } else {
            startRecording();
        }
    }
}
Пример #16
0
void MediaRecorder::stop(ExceptionState& exceptionState)
{
    if (m_state == State::Inactive) {
        exceptionState.throwDOMException(InvalidStateError, "The MediaRecorder's state is '" + stateToString(m_state) + "'.");
        return;
    }

    stopRecording();
}
bool TaskRecorderManagerClient::stopRecording(const ros::Time& start_time,
                                              const ros::Time& end_time,
                                              const int num_samples,
                                              std::vector<task_recorder2_msgs::DataSample>& messages,
                                              const bool stop_recording)
{
  std::vector<std::string> no_message_names;
  return stopRecording(start_time, end_time, num_samples, no_message_names, messages, stop_recording);
}
Пример #18
0
void RecordBox::buttonRelease(u16 button)
{
    if((button & KEY_A) && recording)
    {
        stopRecording();
#ifdef DEBUG
        printf("it worked 2\n");
#endif
    }
}
void testApp::startPlayback() {
	stopRecording();
	kinect.close();
	
	// set record file and source
	kinectPlayer.setup(ofToDataPath("recording.dat"), true);
	kinectPlayer.loop();
	kinectSource = &kinectPlayer;
	playback = true;
}
Пример #20
0
static void processEvent(SDL_Event* e, InputContext* inputState, PlatformState* state) {
    ControllerInput* keyboardController = getContoller(inputState, 0);
    switch (e->type) {
        case SDL_QUIT:
            state->running = false;
            break;
        case SDL_WINDOWEVENT:
            processWindowEvent(&e->window);
            break;

        case SDL_KEYDOWN:
        case SDL_KEYUP:
            bool isDown = e->key.state == SDL_PRESSED;
            isDown &= e->key.state != SDL_RELEASED;
            if(e->key.repeat == 0) {
                switch(e->key.keysym.sym) {
                    case SDLK_w:
                        processKeyPress(&keyboardController->directionUp, isDown);
                        break;
                    case SDLK_s:
                        processKeyPress(&keyboardController->directionDown, isDown);
                        break;
                    case SDLK_a:
                        processKeyPress(&keyboardController->directionLeft, isDown);
                        break;
                    case SDLK_d:
                        processKeyPress(&keyboardController->directionRight, isDown);
                        break;
                    case SDLK_l: //start/stop recording
                        if(isDown && !state->isPlayingBack) {
                            if(state->isRecording) {
                                stopRecording(state);
                            }
                            else {
                                beginRecording(state);
                            }
                        }
                        break;
                    case SDLK_p: //start/stop playback
                        if(isDown && !state->isRecording) {
                            if(state->isPlayingBack) {
                                stopPlayback(state);
                                *inputState = {};
                            }
                            else {
                                beginPlayback(state);
                            }
                        }
                        break;
                }
            }
            break;
    }

}
Пример #21
0
void KeySequenceWidget::keyPressEvent(QKeyEvent* event)
{
	event->accept();

	if (status() == Stopped)
		return;

	if (m_KeySequence.appendKey(event->key(), event->modifiers()))
		stopRecording();

	updateOutput();
}
Пример #22
0
Call::~Call() {
	debug(QString("Call %1: Call object destructed").arg(id));

	if (isRecording)
		stopRecording();

	delete confirmation;

	setStatus("UNKNOWN");

	// QT takes care of deleting servers and sockets
}
Пример #23
0
void QOpenSLESAudioInput::stop()
{
    if (m_deviceState == QAudio::StoppedState)
        return;

    m_deviceState = QAudio::StoppedState;

    stopRecording();

    m_errorState = QAudio::NoError;
    Q_EMIT stateChanged(m_deviceState);
}
void RecorderSlaveBlock::startAtBegin() {
    if (m_recording) {
        stopRecording();
    }
    m_playbackPosition = 0;
    m_playing.setValue(true);

    if (m_waitingForRecord) {
        m_waitingForRecord.setValue(false);
        startRecording();
    }
}
Пример #25
0
void DccVoiceThread::run()
{
#ifndef COMPILE_DISABLE_DCC_VOICE
    for(;;)
    {
//		m_uSleepTime = 0;

        // Dequeue events
        while(KviThreadEvent * e = dequeueEvent())
        {
            if(e->id() == KVI_THREAD_EVENT_TERMINATE)
            {
                delete e;
                goto exit_dcc;
            } else if(e->id() == KVI_DCC_THREAD_EVENT_ACTION)
            {
                int * act = ((KviThreadDataEvent<int> *)e)->getData();
                if(*act)startRecording();
                else stopRecording();
                delete act;
                delete e;
            } else {
                // Other events are senseless to us
                delete e;
            }
        }

        if(!readWriteStep())goto exit_dcc;
        if(!soundStep())goto exit_dcc;

        m_pInfoMutex->lock();
        m_iInputBufferSize = m_inSignalBuffer.size();
        m_iOutputBufferSize = (m_outFrameBuffer.size() / m_pOpt->pCodec->encodedFrameSize()) * m_pOpt->pCodec->decodedFrameSize();
        m_pInfoMutex->unlock();

        // Actually the maximum that we can sleep here is
        // around 500 usecs... = 0.0005 sec -> 8 bytes at 8 KHz

        //	if(m_uSleepTime)usleep(m_uSleepTime);

        // Start recording if the request was not fulfilled yet
        if(m_bRecordingRequestPending)startRecording();
    }


exit_dcc:

#endif //! COMPILE_DISABLE_DCC_VOICE
    closeSoundcard();
    kvi_socket_close(m_fd);
    m_fd = KVI_INVALID_SOCKET;
}
Пример #26
0
void RecordingMode::deactivate() 
{
	DebugL << "Deactivating" << endl;
	try {
		_isActive = false;
		env().media().RecordingStopped.detach(this);
		if (isRecording())
			stopRecording();
	}
	catch (std::exception& exc) {
		ErrorL << "Deactivation error: " + std::string(exc.what()) << endl;
	}
}
Пример #27
0
//Only called when recording is active
void RecordingManager::slotBytesRecorded(int bytes)
{
    //auto conversion to long
    m_iNumberOfBytesRecored += bytes;
    if(m_iNumberOfBytesRecored >= m_split_size)
    {
        //stop and start recording
        stopRecording();
        //Dont generate a new filename
        //This will reuse the previous filename but appends a suffix
        startRecording(false);
    }
    emit(bytesRecorded(m_iNumberOfBytesRecored));
}
Пример #28
0
bool PulseSensor::deinit()
{
	if( ! mSensor )
		return false;

	stopRecording();

	mDeviceName = NO_DEVICE;
	mCardioid.clear();
	delete mSensor;
	mSensor = 0;

	return true;
}
Пример #29
0
void SSBMessageDialog::recButtons(int id)
{
    int nr=id-1;
    // if this msg was already recording, stop
    if (nowRecording==id) {
        recGroup.button(nowRecording)->setChecked(false);
        nowRecording=0;
        qDebug("id=%d finished",id);
        emit(stopRecording(nr));
    } else if (nowRecording) {
        // some other was recording-cancel it
        qDebug("cancelling %d",nowRecording);
        emit(stopRecording(nowRecording-1));
        recGroup.button(nowRecording)->setChecked(false);
        nowRecording=id;
        emit(startRecording(nr));
    } else {
        qDebug("starting id=%d",id);
        nowRecording=id;
        emit(startRecording(nr));
    }
    qDebug(" ");
}
Пример #30
0
void KeySequenceWidget::mousePressEvent(QMouseEvent* event)
{
	event->accept();

	if (status() == Stopped)
	{
		startRecording();
		return;
	}

	if (m_KeySequence.appendMouseButton(event->button()))
		stopRecording();

	updateOutput();
}