Esempio n. 1
0
void ALSound::CleanUp()
{
    if (m_enabled)
    {
        GetLogger()->Info("Unloading files and closing device...\n");
        StopAll();
        StopMusic();

        m_channels.clear();

        m_currentMusic.reset();

        m_oldMusic.clear();

        m_previousMusic.music.reset();

        m_sounds.clear();

        m_music.clear();

        m_enabled = false;

        alcDestroyContext(m_context);
        alcCloseDevice(m_device);
    }
}
Esempio n. 2
0
// ******************************************************************
// Destruktor der tbSound-Klasse
tbSound::~tbSound()
{
	// Alle Puffer stoppen
	StopAll();

	// Alle Puffer freigeben
	for(DWORD dwBuffer = 0; dwBuffer < m_dwNumBuffers; dwBuffer++)
	{
		if(m_dwFlags & DSBCAPS_CTRLFX) TB_SAFE_RELEASE(m_ppSoundBuffers8[dwBuffer]);
		if(m_dwFlags & DSBCAPS_CTRL3D) TB_SAFE_RELEASE(m_pp3DSoundBuffers[dwBuffer]);
		TB_SAFE_RELEASE(m_ppSoundBuffers[dwBuffer]);
	}

	// Die Listen löschen
	TB_SAFE_MEMFREE(m_ppSoundBuffers);
	TB_SAFE_MEMFREE(m_pdwTimeStamps);
	if(m_dwFlags & DSBCAPS_CTRLFX) TB_SAFE_MEMFREE(m_ppSoundBuffers8);
	if(m_dwFlags & DSBCAPS_CTRL3D)
	{
		TB_SAFE_MEMFREE(m_pp3DSoundBuffers);
		TB_SAFE_MEMFREE(m_pllTimeStamps);
		TB_SAFE_MEMFREE(m_pvStartVelocities);
		TB_SAFE_MEMFREE(m_pvOldPositions);
	}
}
Esempio n. 3
0
/* Shut down audio */
void CAudio::Close (void)
{
if (!m_info.bInitialized) 
	return;
m_info.bInitialized =
m_info.bAvailable = 0;
#if defined (__MINGW32__) || defined (__macosx__)
SDL_Delay (500); // CloseAudio hangs if it's called too soon after opening?
#endif
#if USE_OPENAL
if (gameOpts->sound.bUseOpenAL) {
	alcMakeContextCurrent (NULL);
	alcDestroyContext (gameData.pig.sound.openAL.context);
	alcCloseDevice (gameData.pig.sound.openAL.device);
	gameData.pig.sound.openAL.device = NULL;
	}
else
#endif
StopAll ();
songManager.StopAll ();
#if USE_SDL_MIXER
if (gameOpts->sound.bUseSDLMixer) {
	Mix_CloseAudio ();
	}
else
#endif
	SDL_CloseAudio ();
}
Esempio n. 4
0
CPyCOMTest::~CPyCOMTest()
{
	if (pLastArray) {
		SafeArrayDestroy(pLastArray);
		pLastArray = NULL;
	}
	StopAll();
}
Esempio n. 5
0
    void Ignition::StopAll(const bool cancel)
    {
        IgniteError err;

        StopAll(cancel, &err);

        IgniteError::ThrowIfNeeded(err);
    }
Esempio n. 6
0
void LanguageServerCluster::Reload()
{
    StopAll();

    // If we are not enabled, stop here
    if(!LanguageServerConfig::Get().IsEnabled()) { return; }

    StartAll();
}
void CController::CDebugger::Stop( ProcID nID ) const
{
	if ( -1 == nID )
		StopAll();

	CProcessor* pProcessor = m_pController->GetProcessor( nID );
	SIS_CHECKPTR( pProcessor );
	CProcEvent* pEvent = new CBreakEvent;
	pProcessor->AddEvent( pEvent );
}
Esempio n. 8
0
CXlClient::~CXlClient()
{
	StopAll();

	delete m_readBuff;
	delete m_writeBuff;
	delete m_dataBuff;
	delete m_alarmBuff;
	delete m_rcdBuff;
	JoClientManager->Logout(m_userName, this);
	J_OS::LOGINFO("CXlClient::~CXlClient() %d", this);
}
Esempio n. 9
0
DSPThreadPool::~DSPThreadPool()
{
    StopAll();
    
    for (int i = 0; i < fThreadCount; i++) {
        delete(fThreadPool[i]);
        fThreadPool[i] = NULL;
    }
    
    fThreadCount = 0;
    delete[] fThreadPool;
}
Esempio n. 10
0
  BagOfRunnablesBySteps::~BagOfRunnablesBySteps()
  {
    StopAll();

    // Stop the finish listener
    pimpl_->stopFinishListener_ = true;
    pimpl_->oneThreadIsStopped_.notify_one();  // Awakens the listener

    if (pimpl_->finishListener_->joinable())
    {
      pimpl_->finishListener_->join();
    }
  }
Esempio n. 11
0
FSoundManager::~FSoundManager()
{
    StopAll();
    Clear();
    ReleaseSources();
    free( lpSources );
    lpSources = NULL;
    free( lpSoundHash );
    lpSoundHash = NULL;
    
    alcDestroyContext( lpContext );
    alcCloseDevice( lpDevice );
}
Sabertooth::Sabertooth(USART_t *USART_SaberUsart, PORT_t * SaberPORT)
{
	Sabertooth_USART = USART_SaberUsart;				//Sets the private variable to the USART being used
	Sabertooth_PORT = SaberPORT;						//Sets the private variable for the PORT the USART is on
	
	Sabertooth_PORT->DIRSET = PIN3_bm;					//Sets the TX pin for the USART to an output
	USART_Format_Set(Sabertooth_USART, USART_CHSIZE_8BIT_gc, USART_PMODE_DISABLED_gc, false);	//Sets the Sabertooth USART to run in 8 bit data, no parity, and 1 stop bit, 
	USART_Baudrate_Set(Sabertooth_USART, 207 , 0);		//Sets the Sabertooth baud rate to 9600 when running at 32Mhz system clock
	USART_Tx_Enable(Sabertooth_USART);					//Enable the USART transmit capabilities
	_delay_ms(100);										//Delay to let things settle
	
	USART_PutChar(Sabertooth_USART, AUTOBAUD_BYTE);		//Send the autobaud byte to get the sabertooth communicating
	SendDriveCmd(14, 20);								//Sets the communication watchdog on the sabertooth to (x*100ms) It's currently set to two seconds.
	StopAll();											//Everything is now initialized, stop all motor movement to account for random noise or failed startups
}
Esempio n. 13
0
void JukeBox::End()
{
  if (!m_init)
    return;

  StopAll();
  StopMusic();

  m_cache.Clear();

  m_soundsamples.clear();
  m_profiles_loaded.clear();
  playlist.clear();

  CloseDevice();
}
Esempio n. 14
0
bool CStreamManager::StopStream(t_channel_id channel_id)
{
	bool ret = false;
	mutex.lock();
	if (channel_id) {
		streammap_iterator_t it = streams.find(channel_id);
		if (it != streams.end()) {
			delete it->second;
			streams.erase(channel_id);
			ret = true;
		}
	} else {
		ret = StopAll();
	}
	mutex.unlock();
	return ret;
}
Esempio n. 15
0
void BatchGUI::SetupConnect()
{
    connect( this->ui.addButton, SIGNAL(clicked()), this, SLOT(AddProcess()) );
    //
    connect( this->ui.beginButton, SIGNAL(clicked()), this, SLOT(BeginProcess()) );
    //
    connect( this->ui.appButton, SIGNAL(clicked()), this, SLOT(SelectFile()) );
    //
    connect( this->ui.cleanButton, SIGNAL(clicked()), this, SLOT(CleanAll()) );
    //
    connect( this->ui.stopButton, SIGNAL(clicked()), this, SLOT(StopAll()) );
    //
    connect( this->ui.resumeButton, SIGNAL(clicked()), this, SLOT(Resume()) );
    //
    connect( this->ui.resetButton, SIGNAL(clicked()), this, SLOT(ResetAll()) );
    return;
}
Esempio n. 16
0
void ALSound::CleanUp()
{
    if (m_enabled)
    {
        GetLogger()->Info("Unloading files and closing device...\n");
        StopAll();
        StopMusic();

        for (auto channel : m_channels)
        {
            delete channel.second;
        }

        if (m_currentMusic)
        {
            delete m_currentMusic;
        }
        
        for (auto item : m_oldMusic)
        {
            delete item.music;
        }
        
        if (m_previousMusic.music)
        {
            delete m_previousMusic.music;
        }

        for (auto item : m_sounds)
        {
            delete item.second;
        }

        for (auto item : m_music)
        {
            delete item.second;
        }

        m_enabled = false;

        alcDestroyContext(m_context);
        alcCloseDevice(m_device);
    }
}
Esempio n. 17
0
void CVoiceMgr::Term()
{
	// Stop all sounds...

	StopAll();


	// Terminate all the group managers...

	for (int i = 0; i < VM_MAX_CHARACTERS; i++)
	{
		m_aGroupMgrs[i].Term();
	}


	// Clear everything else...

	Clear();
}
Esempio n. 18
0
void CVoiceMgr::Reset()
{
	// Stop all sounds...

	StopAll();

	m_fNextPlayTime = 0;


	// Clear the play flags for each character...

	for (int i = 0; i < VMC_MAX; i++)
	{
		for (int j = 0; j < VMU_MAX; j++)
		{
			m_aUniquePlayFlags[i][j] = DFALSE;
		}
	}
}
CThreadPoolManager::~CThreadPoolManager()
{
    StopAll();
    if(NULL != m_threadPool)
    {
        delete m_threadPool;
        m_threadPool = NULL;
    }
    if(NULL != m_taskPool)
    {
        delete m_taskPool;
        m_taskPool = NULL;
    }

    pthread_cond_destroy( &m_cond_task);
    pthread_mutex_destroy( &m_mutex_task );

    /*gettimeofday(&time_end, NULL);
    long total = (time_end.tv_sec - time_beg.tv_sec)*1000000 + (time_end.tv_usec - time_beg.tv_usec);
    printf("manager total time = %d\n", total);
    gettimeofday(&time_beg, NULL);*/
}
Esempio n. 20
0
DBOOL CVoiceMgr::PlaySoundNoStream(char* sSound, DFLOAT fTimeAdd)
{
	// Sanity checks...

	if (!sSound) return(DFALSE);


	// Stop any current sounds...

	StopAll();


	// Play the sound...

	m_hCurSound = PlaySoundLocal(sSound, SOUNDPRIORITY_PLAYER_MEDIUM, DFALSE, DTRUE, DFALSE, DFALSE);
	if (!m_hCurSound) return(DFALSE);


	// Set the next sound play time...

	DFLOAT  fSoundTime = 1;
	DRESULT dr         = m_pClientDE->GetSoundDuration(m_hCurSound, &fSoundTime);

	if (dr == DE_OK)
	{
		fSoundTime += fTimeAdd;
	}
	else
	{
		fSoundTime = 1;
	}

	SetNextPlayTime(fSoundTime);


	// All done...

	return(DTRUE);
}
Esempio n. 21
0
TInt CEchoDaemonSession::DispatchMessageL(const RMessage2& aMessage)
	{
	TInt ret = KErrNotSupported;
	
	switch(aMessage.Function())
		{
		case EStartEchoDaemon:
			ret = Start(aMessage);
			break;
		case EStopEchoDaemon:
			ret = Stop(aMessage);
			break;
		case EStopAllEchoDaemons:
			ret = StopAll(aMessage);
			break;
		default:
			// Unknown function number - panic the client
			PanicClient(aMessage, EBadRequest);
		}
		
	return ret;
	}
Esempio n. 22
0
void ALSound::CleanUp()
{
    if (mEnabled) {
        GetLogger()->Info("Unloading files and closing device...\n");
        StopAll();

        for (auto channel : mChannels) {
            delete channel.second;
        }

        for (auto item : mSounds) {
            delete item.second;
        }

        mEnabled = false;

        mCurrentMusic->FreeBuffer();
        delete mCurrentMusic;
        alcDestroyContext(mContext);
        alcCloseDevice(mDevice);
    }
}
Esempio n. 23
0
void WrapperDLL::Sound_StopAll(void* self){
	auto self_ = (Sound*)self;
	self_->StopAll();
};
Esempio n. 24
0
void CStreamManager::run()
{
	struct sockaddr_in servaddr;
	int clilen = sizeof(servaddr);;

	struct pollfd pfd[128];
	int poll_cnt;

	printf("Starting STREAM thread keeper, tid %ld\n", syscall(__NR_gettid));

	while (running) {
		mutex.lock();
		pfd[0].fd = listenfd;
		pfd[0].events = (POLLIN | POLLPRI);
		pfd[0].revents = 0;
		poll_cnt = 1;
		for (streammap_iterator_t it = streams.begin(); it != streams.end(); ++it) {
			stream_fds_t fds = it->second->GetFds();
			for (stream_fds_t::iterator fit = fds.begin(); fit != fds.end(); ++fit) {
				pfd[poll_cnt].fd = *fit;
				pfd[poll_cnt].events = POLLRDHUP | POLLHUP;
				pfd[poll_cnt].revents = 0;
				poll_cnt++;
			}
		}
		mutex.unlock();
//printf("polling, count= %d\n", poll_cnt);
		int pollres = poll (pfd, poll_cnt, 1000);
		if (pollres < 0) {
			perror("CStreamManager::run(): poll");
			continue;
		}
		if(pollres == 0)
			continue;
		for (int i = poll_cnt - 1; i >= 0; i--) {
			if (pfd[i].revents & (POLLIN | POLLPRI | POLLHUP | POLLRDHUP)) {
				printf("fd %d has events %x\n", pfd[i].fd, pfd[i].revents);
				if (pfd[i].fd == listenfd) {
					int connfd = accept (listenfd, (struct sockaddr *) &servaddr, (socklen_t *) & clilen);
					printf("CStreamManager::run(): connection, fd %d\n", connfd);
					if(connfd < 0) {
						perror("CStreamManager::run(): accept");
						continue;
					}
					stream_pids_t pids;
					t_channel_id channel_id;
					if (Parse(connfd, pids, channel_id)) {
						mutex.lock();
						streammap_iterator_t it = streams.find(channel_id);
						if (it != streams.end()) {
							it->second->AddClient(connfd);
						} else {
							CStreamInstance * stream = new CStreamInstance(connfd, channel_id, pids);
							if (stream->Start())
								streams.insert(streammap_pair_t(channel_id, stream));
							else
								delete stream;
						}
						mutex.unlock();
					} else {
						close(connfd);
					}
				} else {
					if (pfd[i].revents & (POLLHUP | POLLRDHUP)) {
						printf("CStreamManager::run(): POLLHUP, fd %d\n", pfd[i].fd);
						mutex.lock();
						for (streammap_iterator_t it = streams.begin(); it != streams.end(); ++it) {
							if (it->second->HasFd(pfd[i].fd)) {
								CStreamInstance *stream = it->second;
								stream->RemoveClient(pfd[i].fd);
								if (stream->GetFds().empty()) {
									streams.erase(stream->GetChannelId());
									delete stream;
								}
								break;
							}
						}
						mutex.unlock();
					}
				}
				/* this is a cheap check */
				if (streams.empty() &&
				    CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) {
					/* this check is more expensive (goes through the socket) */
					if (g_Zapit->getMode() != 0) {
						printf("CStreamManager::run: put zapit into standby...\n");
						g_Zapit->setStandby(true);
						cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000);
					}
				}
			}
		}
	}
	printf("CStreamManager::run: stopping...\n");
	close(listenfd);
	listenfd = -1;
	StopAll();
}
Esempio n. 25
0
CRandom::~CRandom()
{
	StopAll();
}
Esempio n. 26
0
Scheduler::~Scheduler(){
    StopAll();
}
Esempio n. 27
0
void CController::CDebugger::NotifyBreak() const
{
	StopAll();
	Notify();
}
Esempio n. 28
0
// This now supports gzip or bzip2 to compress with.
long CompressLogFiles( char **logfiles, long n, int type, int deletelog )
{
	long	count,  dataread, dataout, perc;
	char	newlogname[512],
			*logFN;
	long	failed = 1;

	for( count=0; count<n ; count++){
		logFN = logfiles[count];

		if ( strstr( logFN, ".gz" ) && type==0 )
			continue;
		if ( !IsURL(logFN) )
		{
			void *fp;
			void *outfp;
			char *ram, *p;
			long blocksize = 1024*32;

			StopAll( 0 );

			if ( ram = (char*)malloc( blocksize ) ){
				__int64 dataleft, length;

				if ( fp=(void*)LogOpen( logFN, &length ) ){
					int ret;

					sprintf( newlogname, "%s.gz", logFN );

					switch( type ){
						default:
						case COMPRESS_GZIP :
							sprintf( newlogname, "%s.gz", logFN );
							if ( p = strstr( newlogname, ".bz2" ) )
								mystrcpy( p, ".gz" );
							outfp = gzopen( newlogname, "wb6" );
							break;
#ifdef  _BZLIB_H
						// bzip2 is about 15X slower for 1/2 the size files, level6 is the best time-vs-size level roughly
						case COMPRESS_BZIP2 :
							sprintf( newlogname, "%s.bz2", logFN );
							if ( p = strstr( newlogname, ".gz" ) )
								mystrcpy( p, ".bz2" );
							outfp = BZ2_bzopen( newlogname, "wb6" );
							break;
#endif
					}

					dataout = 0;
					if ( outfp ){
						dataleft = length;
						dataread = 1;
						while( dataread>0 && !IsStopped() ){
							//OutDebugs( "dataleft = %d", dataleft );
							perc = (long)(100*((length-dataleft)/(float)length));
							//sprintf( msgtext, "Compressing %s ...", 100*((length-dataleft)/length) );
							ShowProgress( perc, FALSE, NULL );
							StatusSetID( IDS_COMPRESSING, perc, dataout/1024 );

							dataread = LogRead( fp, logFN, ram, blocksize );

							if ( dataread>0 )
							{
								dataleft -= dataread;
	
								if ( type == COMPRESS_GZIP )	dataout+=gzwrite( outfp, ram , dataread );
#ifdef _BZLIB_H
								if ( type == COMPRESS_BZIP2 )	dataout+=BZ2_bzwrite( outfp, ram , dataread );
#endif
							}
						}
						if ( type == COMPRESS_GZIP )	gzclose( outfp );
#ifdef _BZLIB_H
						if ( type == COMPRESS_BZIP2 )	BZ2_bzclose( outfp );
#endif
						if ( !IsStopped() ){
							__int64 newsize;
							FILE *newfp;
							failed = 0;
							if ( (newfp = fopen( newlogname, "ab+" )) ) {
								newsize = GetFPLength( newfp );

								if ( type == COMPRESS_BZIP2 ){
									long value;
									value = 0;
									fwrite( &value, 1, 4, newfp );
									value = (long)length;
									fwrite( &value, 1, 4, newfp );
								}
								fclose(newfp);
							}
							StatusSetID( IDS_COMPRESSDONE, dataout/1024, newsize/1024, 100*newsize/dataout );
						} else
							StatusSet( "Stopped" );

					}
					ret = LogClose( (long)fp, logFN );
					if ( deletelog && !failed){
						remove( logFN );
					}
				}
				free( ram );
			}
		}
	}
	return failed;
}
Esempio n. 29
0
j_result_t CXlClient::Broken()
{
	StopAll();
	JoDataBus->SubscribeMsg("all", xlc_msg_host, this, false);
	return J_OK;
}