コード例 #1
0
ファイル: sound_openal.cpp プロジェクト: nikkuang/minetest
	// Remove stopped sounds
	void maintain()
	{
		verbosestream<<"OpenALSoundManager::maintain(): "
				<<m_sounds_playing.size()<<" playing sounds, "
				<<m_buffers.size()<<" sound names loaded"<<std::endl;
		std::set<int> del_list;
		for(std::map<int, PlayingSound*>::iterator
				i = m_sounds_playing.begin();
				i != m_sounds_playing.end(); ++i)
		{
			int id = i->first;
			PlayingSound *sound = i->second;
			// If not playing, remove it
			{
				ALint state;
				alGetSourcei(sound->source_id, AL_SOURCE_STATE, &state);
				if(state != AL_PLAYING){
					del_list.insert(id);
				}
			}
		}
		if(!del_list.empty())
			verbosestream<<"OpenALSoundManager::maintain(): deleting "
					<<del_list.size()<<" playing sounds"<<std::endl;
		for(std::set<int>::iterator i = del_list.begin();
				i != del_list.end(); ++i)
		{
			deleteSound(*i);
		}
	}
コード例 #2
0
ファイル: sound_openal.cpp プロジェクト: EXio4/minetest
	// Remove stopped sounds
	void maintain()
	{
		verbosestream<<"OpenALSoundManager::maintain(): "
				<<m_sounds_playing.size()<<" playing sounds, "
				<<m_buffers.size()<<" sound names loaded"<<std::endl;
		std::set<int> del_list;
		for (auto &sp : m_sounds_playing) {
			int id = sp.first;
			PlayingSound *sound = sp.second;
			// If not playing, remove it
			{
				ALint state;
				alGetSourcei(sound->source_id, AL_SOURCE_STATE, &state);
				if(state != AL_PLAYING){
					del_list.insert(id);
				}
			}
		}
		if(!del_list.empty())
			verbosestream<<"OpenALSoundManager::maintain(): deleting "
					<<del_list.size()<<" playing sounds"<<std::endl;
		for (int i : del_list) {
			deleteSound(i);
		}
	}
コード例 #3
0
void SoundButton::addActions(){
    editAction = new QAction(tr("&Edit"), this);
    connect(editAction, SIGNAL(triggered()), this, SLOT(edit()));

    deleteAction = new QAction(tr("&Delete"), this);
    connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteSound()));
}
コード例 #4
0
ファイル: Audio.cpp プロジェクト: MagnusTiberius/humus3
void Audio::clear(){
	int index = sounds.getCount();
	while (index--){
		deleteSound(index);
	}

	index = soundSources.getCount();
	while (index--){
		deleteSoundSource(index);
	}
}
コード例 #5
0
ファイル: sound.cpp プロジェクト: carriercomm/monster
static void deleteOldest()
{
	if (cacheSize <= 0)
		return;

	long oldestTime = currentTimeMillis();
	std::list<Sound*>::iterator it = cache.begin();
	std::list<Sound*>::iterator oldest;

	while (it != cache.end()) {
		Sound* s = *it;
		if (s->lastPlayedTime < oldestTime) {
			oldestTime = s->lastPlayedTime;
			oldest = it;
		}
		it++;
	}

	deleteSound(*oldest);
	cache.erase(oldest);
}
コード例 #6
0
ファイル: soundeditwidget.cpp プロジェクト: lenggi/kcalcore
void SoundEditWidget::contextMenuEvent( QContextMenuEvent *event )
{
  QMenu menu;

  if ( mHasSound ) {
    menu.addAction( i18n( "Play" ), this, SLOT(playSound()) );
  }

  if ( !mReadOnly ) {
    menu.addAction( i18n( "Change..." ), this, SLOT(changeSound()) );
  }

  if ( mHasSound ) {
    menu.addAction( i18n( "Save..." ), this, SLOT(saveSound()) );

    if ( !mReadOnly ) {
      menu.addAction( i18n( "Remove" ), this, SLOT(deleteSound()) );
    }
  }

  menu.exec( event->globalPos() );
}
コード例 #7
0
ファイル: sound_openal.cpp プロジェクト: nikkuang/minetest
	void stopSound(int sound)
	{
		maintain();
		deleteSound(sound);
	}