void TerminalImageFilterChain::setImage(const Character* const image , int lines , int columns, const QVector<LineProperty>& lineProperties)
{
    if (empty())
        return;

    // reset all filters and hotspots
    reset();

    PlainTextDecoder decoder;
    decoder.setTrailingWhitespace(false);

    // setup new shared buffers for the filters to process on
    QString* newBuffer = new QString();
    QList<int>* newLinePositions = new QList<int>();
    setBuffer( newBuffer , newLinePositions );

    // free the old buffers
    delete _buffer;
    delete _linePositions;

    _buffer = newBuffer;
    _linePositions = newLinePositions;

    QTextStream lineStream(_buffer);
    decoder.begin(&lineStream);

    for (int i=0 ; i < lines ; i++)
    {
        _linePositions->append(_buffer->length());
        decoder.decodeLine(image + i*columns,columns,LINE_DEFAULT);

        // pretend that each line ends with a newline character.
        // this prevents a link that occurs at the end of one line
        // being treated as part of a link that occurs at the start of the next line
        //
        // the downside is that links which are spread over more than one line are not
        // highlighted.
        //
        // TODO - Use the "line wrapped" attribute associated with lines in a
        // terminal image to avoid adding this imaginary character for wrapped
        // lines
        if ( !(lineProperties.value(i,LINE_DEFAULT) & LINE_WRAPPED) )
            lineStream << QChar('\n');
    }
    decoder.end();
}
Exemple #2
0
void OpenGLExample::onInitialize()
{
    // create program

    globjects::init();

#ifdef __APPLE__
    globjects::Shader::clearGlobalReplacements();
    globjects::Shader::globalReplace("#version 140", "#version 150");

    globjects::debug() << "Using global OS X shader replacement '#version 140' -> '#version 150'" << std::endl;
#endif

    m_texture = new globjects::Texture;
    // void image2D(gl::GLint level, gl::GLenum internalFormat, gl::GLsizei width, gl::GLsizei height, gl::GLint border, gl::GLenum format, gl::GLenum type, const gl::GLvoid * data);
    m_texture->image2D(0, gl::GL_RGBA, m_viewportCapability->width(), m_viewportCapability->height(), 0, gl::GL_RGBA, gl::GL_UNSIGNED_BYTE, nullptr);

    m_fbo = new globjects::Framebuffer;
    m_fbo->attachTexture(gl::GL_COLOR_ATTACHMENT0, m_texture, 0);

    m_vertices = new globjects::Buffer;
    m_vertices->setData(std::vector<float>{
        -0.8, -0.8,
        0.8, -0.8,
        0.8, 0.8
    }, gl::GL_STATIC_DRAW);

    m_vao = new globjects::VertexArray;

    auto binding = m_vao->binding(0);
    binding->setAttribute(0);
    binding->setBuffer(m_vertices, 0, 2 * sizeof(float));
    binding->setFormat(2, gl::GL_FLOAT);

    m_vao->enable(0);

    m_program = new globjects::Program;
    m_program->attach(
        globjects::Shader::fromFile(gl::GL_VERTEX_SHADER, "data/openglexample/shader.vert"),
        globjects::Shader::fromFile(gl::GL_FRAGMENT_SHADER, "data/openglexample/shader.frag")
    );

    gl::glClearColor(1.0, 1.0, 1.0, 1.0);

    m_fbo->unbind();
}
Exemple #3
0
BitBlock::BitBlock(BitBlock& block_) : Block (block_) {
	valSorted=block_.valSorted;
	//outPair=new Pair();
	outPair=new IntValPos();
	bfrSize=block_.bfrSize;
	if (block_.bfr!=NULL) {
		memcpy(bfr, block_.bfr, bfrSize);
	}
	else {
		bfr=NULL;
	}

	init=block_.init;
	fieldSize=block_.fieldSize;
	startPos=block_.startPos;
	setBuffer(bfr, bfrSize);
}
Exemple #4
0
CLSTList lz77Compress (
    char* string, unsigned sliding_size, unsigned buffer_size
) {
    CLSTList compress = clstNew();
    int i, str_lenght = strlen(string);
    char sliding[sliding_size + 1];
    char buffer[buffer_size + 1];

    sliding[0] = '\0';
    buffer[0] = '\0';
    for (i = 0; i < str_lenght; i ++) {
        setSliding(sliding, string, i, sliding_size);
        setBuffer(buffer, string, i, buffer_size);
        clstAppend(compress, getTuple(sliding, buffer, &i));
    }

    return compress;
}
Exemple #5
0
bool File::open(Mode mode)
{
	if (mode == CLOSED)
		return true;

	// File must exist if read mode.
	if ((mode == READ) && !PHYSFS_exists(filename.c_str()))
		throw love::Exception("Could not open file %s. Does not exist.", filename.c_str());

	// Check whether the write directory is set.
	if ((mode == APPEND || mode == WRITE) && (PHYSFS_getWriteDir() == 0) && !hack_setupWriteDirectory())
		throw love::Exception("Could not set write directory.");

	// File already open?
	if (file != 0)
		return false;

	this->mode = mode;

	switch (mode)
	{
	case READ:
		file = PHYSFS_openRead(filename.c_str());
		break;
	case APPEND:
		file = PHYSFS_openAppend(filename.c_str());
		break;
	case WRITE:
		file = PHYSFS_openWrite(filename.c_str());
		break;
	default:
		break;
	}

	if (file != 0 && !setBuffer(bufferMode, bufferSize))
	{
		// Revert to buffer defaults if we don't successfully set the buffer.
		bufferMode = BUFFER_NONE;
		bufferSize = 0;
	}

	return (file != 0);
}
void SFMLAudioEngine::playSound(std::string fileName)
{
    if(loadSound(fileName))
    {
        for(auto it = m_sounds.begin(); it != m_sounds.end(); it++)
        {
            if(it->getStatus() != sf::Sound::Playing)
            {
                it->setBuffer(*m_soundBuffers[fileName]);
                it->play();
                return;
            }
        }

        m_sounds.push_back(sf::Sound(*m_soundBuffers[fileName]));
        m_sounds.back().setVolume(m_soundVolume);
        m_sounds.back().play();
    }
}
void SludgeZBufferMaker::postOpen()
{
	gtk_adjustment_set_upper( theSliderAdjustment, backdrop.total-1 );
	gtk_adjustment_set_upper( theYAdjustment, -backdrop.sprites[0].height*2 ); // *2 to allow obscuring characters exiting to the bottom 
	setBuffer(1);
	setBufferY(backdrop.sprites[buffer()].special);
	char buf[5];
	sprintf(buf, "%i", backdrop.total-1);
	gtk_label_set_text(theNumBuffersLabel, buf);

	activateZoomButtons(backdrop.sprites[0].width, -backdrop.sprites[0].height);
	showStatusbar(backdrop.sprites[0].width, -backdrop.sprites[0].height);
	on_zoom_fit_clicked();

	reshape();
	loadZTextures(&backdrop);
	render_timer_event(theDrawingarea);

	setupButtons();
}
SpillOutputStream::SpillOutputStream(
    SharedSegmentFactory pSegmentFactoryInit,
    SharedCacheAccessor pCacheAccessorInit,
    std::string spillFileNameInit)
    : pSegmentFactory(pSegmentFactoryInit),
      pCacheAccessor(pCacheAccessorInit),
      spillFileName(spillFileNameInit)
{
    // REVIEW:  this causes pCacheAccessor to lose its chance to intercept any
    // of the scratch calls
    scratchAccessor = pSegmentFactory->newScratchSegment(
                          pCacheAccessor->getCache(),
                          1);
    scratchPageLock.accessSegment(scratchAccessor);
    scratchPageLock.allocatePage();
    cbBuffer = scratchAccessor.pSegment->getUsablePageSize();
    setBuffer(
        scratchPageLock.getPage().getWritableData(),
        cbBuffer);
}
Exemple #9
0
void Sound::loadWav(const char *filename)
{
   sound = filename;

   buffer = Manager::getInstance().getBuffer(filename);

   // We create a source, binded to our buffer :
   generateSource();
   if (alGetError() != AL_NO_ERROR)
      throw RubyException(rb_eRuntimeError, "Cannot generator source.");

   setBuffer(buffer);

   setPos(0.f, 0.f, 0.f);
   setVelocity(0.f, 0.f, 0.f);
   setDirection(0.f, 0.f, 0.f);
   
   if (alGetError() != AL_NO_ERROR)
      throw RubyException(rb_eRuntimeError, "Cannot set buffer.");
}
/**
 * 	Load the sound parameters from georges' form
 */
void				CSimpleSound::importForm(const std::string& filename, NLGEORGES::UFormElm& root)
{
	NLGEORGES::UFormElm *psoundType;
	std::string dfnName;

	// some basic checking.
	root.getNodeByName(&psoundType, ".SoundType");
	nlassert(psoundType != NULL);
	psoundType->getDfnName(dfnName);
	nlassert(dfnName == "simple_sound.dfn");

	// Call the base class
	CSound::importForm(filename, root);

	// Name
	_Filename = CStringMapper::map(filename);

	// Buffername
	std::string bufferName;
	root.getValueByName(bufferName, ".SoundType.Filename");
	bufferName = CFile::getFilenameWithoutExtension(bufferName);
	_Buffername = CStringMapper::map(bufferName);

	setBuffer(NULL);

	// contain % so it need a context to play
	if (bufferName.find ("%") != string::npos)
	{
		_NeedContext = true;
	}

	// MaxDistance
 	root.getValueByName(_MaxDist, ".SoundType.MaxDistance");

	// MinDistance
	root.getValueByName(_MinDist, ".SoundType.MinDistance");

	// Alpha
	root.getValueByName(_Alpha, ".SoundType.Alpha");

}
void PlayDrillCommandClass::parse()
{
    LOGF("Parsing PlayDrill commmand");
    
    StringArray steps;
    String unparsed(getBuffer()); 
    
    int commaIdx = unparsed.indexOf(',');
    String pausePercentage = unparsed.substring(0, commaIdx);
    unparsed= unparsed.substring(commaIdx + 1);

    m_execData.pauseFactor= pausePercentage.toFloat() / 100.0;

    split(unparsed, EOF_STEP, steps);
    
    int stepIndex= 0;

    parse(*this, steps, stepIndex);

	setBuffer("");
}
Exemple #12
0
void TransferRequest::setDefaults( ATP_TransferRequest_t * header, int id ){
	
	setFrameID( header, "ATP" );
	setFrameType( header, ATP_TRANSFER_REQUEST );
	setMeshAddress( header, 0 );			// Pan address for XBee radios
	setDatetime( header, (unsigned long) millis() );
	setAtpID( header, id );
	setVersion( header, 1 );
	setStatus( header, ATP_UNSENT );
	// Do not change the above members of the struct. The app.cpp dispatcher requires these.
	
	setTopChunk( header, 0 );
	setChunkCount( header, 0 );
	setSize( header, 0 );
	setExpires( header, 0 );
	setDescriptor( header, "CC");	
	setSource( header, 0 );		//todo Implement for Pinoccio Scouts, right now we're using XBee radios in direct connect mode
	setDestination( header, 0 );
	setFileName( header, "" );
	setBuffer( header, 0 );
}
ICalcPU & ICalcPU ::
  setDisplayFromAccumulator (double iAccumulator)
{
  char tempString[20];
  signed long tempAccum = iAccumulator;

  //
  // Convert the accumulator value to a string and display it
  //

  if (iAccumulator != tempAccum)
     sprintf(tempString, "%f", iAccumulator);

  else
     sprintf(tempString, "%d", tempAccum);

  setBuffer ( tempString );             //want the event, bufferId(),
                                        //to be signalled, so call set
  return *this;

}
Exemple #14
0
void Image::initializeParent()
{
    stromx::runtime::Image::PixelType pixelType = stromx::runtime::Image::MONO_8;
    
    switch(m_image.format())
    {
    case QImage::Format_Indexed8:
        pixelType = stromx::runtime::Image::MONO_8;
        break;
    case QImage::Format_RGB888:
        pixelType = stromx::runtime::Image::RGB_24;
        break;
    default:
        m_image = QImage();
    }
    
    setBuffer(reinterpret_cast<uint8_t*>(m_image.bits()), m_image.byteCount());
    
    initializeImage(m_image.width(), m_image.height(), m_image.bytesPerLine(),
                    m_image.bits(), pixelType);
}
Exemple #15
0
void ts::scene::Engine_sound_controller::register_car(const world::Car* car)
{
    const auto& car_definition = car->car_definition();
    auto audio_buffer = engine_sound_store_.load_from_file(car_definition.engine_sample);

    engine_sounds_.push_back({ car, nullptr });
    if (audio_buffer)
    {
        Vector2<float> position = car->position();

        auto& entry = engine_sounds_.back();
        auto sound_ptr = std::make_unique<sf::Sound>();
        sound_ptr->setLoop(true);
        sound_ptr->setPitch(base_pitch);
        sound_ptr->setBuffer(*audio_buffer);
        sound_ptr->setMinDistance(200.0f);
        sound_ptr->setRelativeToListener(false);
        entry.second = std::move(sound_ptr);

        sorting_required_ = true;
    }
}
Exemple #16
0
void Display::write(uint32_t w) {

	if (lastWrite == w)
		return;
	
	lastWrite = w;

	uint8_t pos = parseInt(w, parse);				// Parsed number

	if (pos >= digits)								// Check if digit was not overflow
		return overflowDisp();

	update(pos);									// Update display

	for (; pos >=0; pos--) {
		setBuffer(decodMap[digits - pos - 1]);		// Set buffer for display
		set(parse[pos]);							// Set the number
		if (pos == 0)
			return;
	}

}				
Exemple #17
0
void loadIndex(void)
{ setBuffer(frmBuffer);
  int **line = frmIndex.line, color[256], colorNb=1 ;
  int  c=4 ; while(--c) if(line[c]) free(line[c]);
       c=2 ; while(c) line[--c] = (int*)malloc((frmIndex.szx)*4);
       c=2 ; while(c) line[(--c)+2] = (int*)malloc((frmIndex.szy)*4);
  int *ptr = (int*)(Form1->lastFrmImg->Picture->Bitmap->ScanLine[frmIndex.y]) ;
       ptr+= frmIndex.x ;
        for(c=0;c<frmIndex.szx;c++) (line[0])[c]=*ptr++ ; // fill up index
       ptr = (int*)(Form1->lastFrmImg->Picture->Bitmap->ScanLine[frmIndex.y+frmIndex.szy-1]) ;
       ptr+= frmIndex.x ;
        for(c=0;c<frmIndex.szx;c++) (line[1])[c]=*ptr++ ; // fill down index

       for(c=0;c<frmIndex.szy;c++)
        { ptr = (int*)(Form1->lastFrmImg->Picture->Bitmap->ScanLine[frmIndex.y+c]) ;
          (line[2])[c]= ptr[frmIndex.x] ; // fill left
          (line[3])[c]= ptr[frmIndex.x+frmIndex.szx-1] ; // and right
        };
      int n,found=0 ; *color=**line ;
      for(c=0;c<frmIndex.szx;c++) // count and get colors of up and down index line
        { for(n=0;n<colorNb;n++)
           if((line[0])[c] == color[n]) { found=1 ; break ; }
          if(!found) color[colorNb++] = (line[0])[c] ; else found=0 ;
          for(n=0;n<colorNb;n++)
           if((line[1])[c] == color[n]) { found=1 ; break ; }
          if(!found) color[colorNb++] = (line[1])[c] ; else found=0 ;
        };
      for(c=0;c<frmIndex.szy;c++) // and do the same for left & right
        { for(n=0;n<colorNb;n++)
           if((line[2])[c] == color[n]) { found=1 ; break ; }
          if(!found) color[colorNb++] = (line[2])[c] ; else found=0 ;
          for(n=0;n<colorNb;n++)
           if((line[3])[c] == color[n]) { found=1 ; break ; }
          if(!found) color[colorNb++] = (line[3])[c] ; else found=0 ;
        };
      frmIndex.colorNb = colorNb;
      frmIndex.color = (int*)malloc(colorNb*4);
      memcpy(frmIndex.color,color,colorNb*4);
}
Exemple #18
0
void Reader::IoSmartCardPower(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize) {
	UNREFERENCED_PARAMETER(inBufSize);
	UNREFERENCED_PARAMETER(outBufSize);
	OutputDebugString(L"[BixVReader][POWR]IOCTL_SMARTCARD_POWER");
	DWORD code=getInt(pRequest);
	if (code==SCARD_COLD_RESET) {
		OutputDebugString(L"[BixVReader][POWR]SCARD_COLD_RESET");
		protocol=0;
		powered=1;
		state=SCARD_NEGOTIABLE;
	}
	else if (code==SCARD_WARM_RESET) {
		OutputDebugString(L"[BixVReader][POWR]SCARD_WARM_RESET");
		protocol=0;
		powered=1;
		state=SCARD_NEGOTIABLE;
	}
	else if (code==SCARD_POWER_DOWN) {
		OutputDebugString(L"[BixVReader][POWR]SCARD_POWER_DOWN");
		protocol=0;
		powered=0;
		state=SCARD_SWALLOWED;
	}
	if (code==SCARD_COLD_RESET || code==SCARD_WARM_RESET) {
		BYTE ATR[100];
		DWORD ATRsize;
		if (!QueryATR(ATR,&ATRsize,true))
		{
			pRequest->CompleteWithInformation(STATUS_NO_MEDIA, 0);
			return;
		}
		setBuffer(device,pRequest,ATR,ATRsize);
	}
	else {
		SectionLocker lock(device->m_RequestLock);
		pRequest->CompleteWithInformation(STATUS_SUCCESS, 0);
	}

}
Exemple #19
0
void Box::setBoxWithRandomColor(float width, float height, float depth)
{
	float w2 = width / 2;
	float h2 = height / 2;
	float d2 = depth / 2;

	std::vector<FigureVertex> vertices;
	std::vector<UINT> indices;

	GeometryGenerator::createBox(width, height, depth, vertices, indices);

	setBuffer(vertices, indices);

	auto material = Material();
	material.m_Ambient = XMFLOAT4(0.01f * (rand() % 100), 0.01f * (rand() % 100), 0.01f * (rand() % 100), 1.0f);
	material.m_Diffuse = XMFLOAT4(0.01f * (rand() % 100), 0.01f * (rand() % 100), 0.01f * (rand() % 100), 0.5f);
	material.m_Specular = XMFLOAT4(0.01f * (rand() % 100), 0.01f * (rand() % 100), 0.01f * (rand() % 100), 16.0f);

	setMaterial(material);

	
}
Exemple #20
0
	std::shared_ptr<sf::Sound> SoundSystem::GetSound(const std::string& name) {
		auto s = CurrentSounds.GetItem(name);
		if (s)
		{
			return s;
		} else
		{
			std::shared_ptr<sf::Sound> s;
			std::shared_ptr<sf::SoundBuffer> sb = Engine::GetResMgr()->get<sf::SoundBuffer>(name);

			if (!sb) return s;

			s.reset(new sf::Sound());
			s->setBuffer(*sb);

			return s;
		}

		Engine::out(Engine::ERROR) << "SoundSYS: Unable to play or load sound: " << name << std::endl;

		return s;
	}
Exemple #21
0
void Reader::IoSmartCardTransmit(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize) {
	UNREFERENCED_PARAMETER(inBufSize);
	UNREFERENCED_PARAMETER(outBufSize);
	OutputDebugString(L"[BixVReader][TRSM]IOCTL_SMARTCARD_TRANSMIT");
	SCARD_IO_REQUEST *scardRequest=NULL;
	int scardRequestSize=0;
	BYTE *RAPDU=NULL;
	int RAPDUSize=0;
	if (!getBuffer(pRequest,(void **)&scardRequest,&scardRequestSize)
			|| scardRequestSize<sizeof *scardRequest
			|| scardRequest->dwProtocol!=protocol) {
		SectionLocker lock(device->m_RequestLock);
        pRequest->CompleteWithInformation(STATUS_INVALID_DEVICE_STATE, 0);
		goto end;
	}
	if (!QueryTransmit((BYTE *)(scardRequest+1),
				scardRequestSize-sizeof(SCARD_IO_REQUEST),
				&RAPDU,&RAPDUSize))
	{
		SectionLocker lock(device->m_RequestLock);
		pRequest->CompleteWithInformation(STATUS_NO_MEDIA, 0);					
		goto end;
	}
	SCARD_IO_REQUEST *p=(SCARD_IO_REQUEST *)realloc(scardRequest,RAPDUSize+sizeof(SCARD_IO_REQUEST));
	if (p==NULL) {
		SectionLocker lock(device->m_RequestLock);
        pRequest->CompleteWithInformation(STATUS_INVALID_DEVICE_STATE, 0);
		goto end;
	}
	scardRequest = p;
	scardRequest->cbPciLength=sizeof(SCARD_IO_REQUEST);
	scardRequest->dwProtocol=protocol;
	memcpy(scardRequest+1,RAPDU,RAPDUSize);
	setBuffer(device,pRequest,scardRequest,RAPDUSize+sizeof(SCARD_IO_REQUEST));
end:
	free(scardRequest);
	free(RAPDU);
}
void Cc3dALSource::initSource(Cc3dALBuffer*buffer){
    
    assert(buffer);
    setBuffer(buffer);
    //  //记录buffer和isPermanent
    //  m_buffer=(Cc3dALBuffer*)pBuffer;
    //创建source
    ALenum			error;
    alGenSources(1, &m_source);
    if(alGetError() != AL_NO_ERROR)
    {
        printf("Error generating sources! %x\n", error);
        exit(1);
    }
    //初始化source
    alSourcei(m_source, AL_BUFFER, buffer->getBuffer());
    alSourcef(m_source, AL_PITCH, 1.0f);
    alSourcef(m_source, AL_GAIN, 1.0f);
    alSourcei(m_source, AL_LOOPING, AL_FALSE);
    // 设定距离模型参数
    alSourcef(m_source, AL_REFERENCE_DISTANCE, 30);
    alSourcef(m_source, AL_ROLLOFF_FACTOR,0.25);
}
void SpillOutputStream::flushBuffer(uint cbRequested)
{
    if (scratchPageLock.isLocked()) {
        assert(!pSegOutputStream);
        // grow from short to long
        spill();
    } else {
        assert(pSegOutputStream);
        assert(!scratchPageLock.isLocked());
        // already long
        assert(cbBuffer >= getBytesAvailable());
        pSegOutputStream->consumeWritePointer(cbBuffer - getBytesAvailable());
    }
    assert(pSegOutputStream);
    if (cbRequested) {
        PBuffer pBuffer =
            pSegOutputStream->getWritePointer(cbRequested,&cbBuffer);
        setBuffer(pBuffer, cbBuffer);
    } else {
        pSegOutputStream->hardPageBreak();
        cbBuffer = 0;
    }
}
gboolean SludgeZBufferMaker::init(gboolean calledFromConstructor) 
{
	currentFilename[0] = 0;
	sprintf(currentShortname, "%s", getUntitledFilename());

	setBuffer(1);

	if (calledFromConstructor) {
		backdrop.total=0;
		backdrop.type=2;
		backdrop.sprites=NULL;
		backdrop.myPalette.pal=NULL;
		backdrop.myPalette.r=NULL;
		backdrop.myPalette.g=NULL;
		backdrop.myPalette.b=NULL;

		if (!reserveSpritePal(&backdrop.myPalette, 0)) {
			return TRUE;
		}
	}

    return FALSE;
}
Exemple #25
0
CBin::t_size CBin::Share( CBin *x_p )
{_STT();

	if ( !x_p || !x_p->getUsed() )
	{	Destroy();
		return 0;
	} // end if

	// Lose any Ptr buffer
	FreePtr();

	// Ptr buffer?
	if ( x_p->m_ptr )
		setBuffer( x_p->m_ptr, x_p->m_nUsed, x_p->m_nOffset, x_p->m_bFree );

	// Share native buffer
	else
		m_nUsed = x_p->m_nUsed,
		m_nOffset = x_p->m_nOffset,
		m_buf.Share( x_p->m_buf );

	return m_nUsed;
}
ICalcPU & ICalcPU :: processDigit (IString iCurrentDigit)
{
  IString tempString;

  //
  // If expecting a new input number or if the display has been cleared,
  // start a new number. Otherwise get the current buffer contents and
  // add the new digit to what is already there.
  //

  if (dExpectNewOperand || dBuffer == "")
  {
     tempString = "";
     dExpectNewOperand = false;
  }

  else tempString = dBuffer;

  tempString += iCurrentDigit;   // Add to the current buffer contents
  setBuffer(tempString);         // Want event, bufferId(), to get
                                 //   signalled, so call set to display.
  return *this;

}
Exemple #27
0
Sound& Sound::operator =(const Sound& right)
{
    // Here we don't use the copy-and-swap idiom, because it would mess up
    // the list of sound instances contained in the buffers and unnecessarily
    // destroy/create OpenAL sound sources

    // Delegate to base class, which copies all the sound attributes
    SoundSource::operator=(right);

    // Detach the sound instance from the previous buffer (if any)
    if (m_buffer)
    {
        stop();
        m_buffer->detachSound(this);
        m_buffer = NULL;
    }

    // Copy the remaining sound attributes
    if (right.m_buffer)
        setBuffer(*right.m_buffer);
    setLoop(right.getLoop());

    return *this;
}
Exemple #28
0
void Reader::IoSmartCardTransmit(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize) {
	UNREFERENCED_PARAMETER(inBufSize);
	UNREFERENCED_PARAMETER(outBufSize);
	OutputDebugString(L"[BixVReader][TRSM]IOCTL_SMARTCARD_TRANSMIT");
	BYTE APDU[1000];
	int APDUSize;
	getBuffer(pRequest,APDU,&APDUSize);
	if (((SCARD_IO_REQUEST*)APDU)->dwProtocol!=protocol) {
		SectionLocker lock(device->m_RequestLock);
        pRequest->CompleteWithInformation(STATUS_INVALID_DEVICE_STATE, 0);
		return;
	}
	BYTE Resp[1000];
	int RespSize;
	if (!QueryTransmit(APDU+sizeof(SCARD_IO_REQUEST),APDUSize-sizeof(SCARD_IO_REQUEST),Resp+sizeof(SCARD_IO_REQUEST),&RespSize))
	{
		SectionLocker lock(device->m_RequestLock);
		pRequest->CompleteWithInformation(STATUS_NO_MEDIA, 0);					
		return;
	}
	((SCARD_IO_REQUEST*)Resp)->cbPciLength=sizeof(SCARD_IO_REQUEST);
	((SCARD_IO_REQUEST*)Resp)->dwProtocol=protocol;
	setBuffer(device,pRequest,Resp,RespSize+sizeof(SCARD_IO_REQUEST));
}
 OscMessage(uint8_t* data, int size) {
   setBuffer(data, size);
   // parse();
 }
Exemple #30
0
IntDecoder::IntDecoder(byte* buffer_, bool valSorted_) : Decoder(buffer_) {
	outBlock = new MultiBlock(valSorted_, true, true, ValPos::INTTYPE);
	setBuffer(buffer_);
	outPair = outBlock->vp;
}