Ejemplo n.º 1
0
BOOL C4SoundInstance::Create(C4SoundEffect *pnEffect, bool fLoop,
                             int32_t inVolume, C4Object *pnObj,
                             int32_t inNearInstanceMax,
                             int32_t iFalloffDistance) {
  // Sound check
  if (!Config.Sound.RXSound || !pnEffect) return FALSE;
  // Already playing? Stop
  if (Playing()) {
    Stop();
    return FALSE;
  }
  // Set effect
  pEffect = pnEffect;
  // Set
  iStarted = timeGetTime();
  iVolume = inVolume;
  iPan = 0;
  iChannel = -1;
  iNearInstanceMax = inNearInstanceMax;
  this->iFalloffDistance = iFalloffDistance;
  pObj = pnObj;
  fLooping = fLoop;
  // Start
  Execute();
  // Safe usage
  pEffect->UsageTime = Game.Time;
  return TRUE;
}
Ejemplo n.º 2
0
void PlaylistListContainer::SetApplication(Application* app) {
  app_ = app;
  PlaylistManager* manager = app_->playlist_manager();
  Player* player = app_->player();

  connect(manager, SIGNAL(PlaylistAdded(int, QString, bool)),
          SLOT(AddPlaylist(int, QString, bool)));
  connect(manager, SIGNAL(PlaylistFavorited(int, bool)),
          SLOT(PlaylistFavoriteStateChanged(int, bool)));
  connect(manager, SIGNAL(PlaylistRenamed(int, QString)),
          SLOT(PlaylistRenamed(int, QString)));
  connect(manager, SIGNAL(CurrentChanged(Playlist*)),
          SLOT(CurrentChanged(Playlist*)));
  connect(manager, SIGNAL(ActiveChanged(Playlist*)),
          SLOT(ActiveChanged(Playlist*)));

  connect(model_, SIGNAL(PlaylistRenamed(int, QString)), manager,
          SLOT(Rename(int, QString)));

  connect(player, SIGNAL(Paused()), SLOT(ActivePaused()));
  connect(player, SIGNAL(Playing()), SLOT(ActivePlaying()));
  connect(player, SIGNAL(Stopped()), SLOT(ActiveStopped()));

  // Get all playlists, even ones that are hidden in the UI.
  for (const PlaylistBackend::Playlist& p :
       app->playlist_backend()->GetAllFavoritePlaylists()) {
    QStandardItem* playlist_item = model_->NewPlaylist(p.name, p.id);
    QStandardItem* parent_folder = model_->FolderByPath(p.ui_path);
    parent_folder->appendRow(playlist_item);
  }
}
Ejemplo n.º 3
0
void RDCueEdit::stateChangedData(int id,RDPlayDeck::State state)
{
  if(id!=RDPLAYDECK_AUDITION_ID) {
    return;
  }
  switch(state) {
      case RDPlayDeck::Playing:
	Playing(id);
	break;

      case RDPlayDeck::Stopping:
	break;

      case RDPlayDeck::Paused:
	Paused(id);
	break;

      case RDPlayDeck::Stopped:
	Stopped(id);
	break;

      case RDPlayDeck::Finished:
	Stopped(id);
	break;
  }
}
Ejemplo n.º 4
0
Remote::Remote(Player* player, QObject* parent)
  : QObject(parent),
    player_(player),
    connection_(new xrme::Connection(this)),
    retry_count_(0)
{
  connection_->SetMediaPlayer(this);
  connection_->SetMediaStorage(this);
  connection_->set_verbose(true);
  connect(connection_, SIGNAL(Connected()), SLOT(Connected()));
  connect(connection_, SIGNAL(Disconnected(QString)), SLOT(Disconnected(QString)));

  connect(player_, SIGNAL(Playing()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(Paused()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(Stopped()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(PlaylistFinished()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(VolumeChanged(int)), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(Seeked(qlonglong)), SLOT(SetStateChanged()));
  connect(player_->playlists(), SIGNAL(CurrentSongChanged(Song)), SLOT(SetStateChanged()));

  connect(connection_,
      SIGNAL(TomahawkSIPReceived(const QVariant&)),
      SLOT(TomahawkSIPReceived(const QVariant&)));

  ReloadSettings();
}
Ejemplo n.º 5
0
static void InternetServer_OnChange(void)
{
/*	if (cv_internetserver.value)
		RegisterServer();
	else
		UnregisterServer(); */
	if(cv_internetserver.value && Playing())
	{
		CV_StealthSetValue(&cv_internetserver, 0);
		CONS_Printf("You cannot register on the Master Server mid-game, please end your current session and re-host if you wish to advertise your server on the Master Server.\n");
		return;
	}
#ifndef NONET
	if (!Playing() && !dedicated)
		M_AlterRoomOptions();
#endif
}
Ejemplo n.º 6
0
//
// Poll
//
// Poll for track advancement
//
Bool TrackPlayer::Poll()
{
  // Do we need to play the next stream
  if (requested && !Playing())
  {
    return (NextTrack());
  }

  return (FALSE);
}
Ejemplo n.º 7
0
void PlaylistView::SetApplication(Application* app) {
  Q_ASSERT(app);
  app_ = app;
  connect(app_->current_art_loader(),
          SIGNAL(ArtLoaded(const Song&, const QString&, const QImage&)),
          SLOT(CurrentSongChanged(const Song&, const QString&, const QImage&)));
  connect(app_->player(), SIGNAL(Paused()), SLOT(StopGlowing()));
  connect(app_->player(), SIGNAL(Playing()), SLOT(StartGlowing()));
  connect(app_->player(), SIGNAL(Stopped()), SLOT(StopGlowing()));
  connect(app_->player(), SIGNAL(Stopped()), SLOT(PlayerStopped()));
}
Ejemplo n.º 8
0
// This is a hack. For some reason, nodes aren't being freed properly.
// This goes through and cleans up what nodes were supposed to be freed.
static void cleanupnodes(void)
{
	SINT8 j;

	if (!Playing())
		return;

	// Why can't I start at zero?
	for (j = 1; j < MAXNETNODES; j++)
		if (!nodeingame[j])
			nodeconnected[j] = false;
}
Ejemplo n.º 9
0
BOOL C4SoundInstance::Stop() {
  if (!pEffect) return FALSE;
  // Stop sound
  BOOL fRet = TRUE;
#ifdef HAVE_LIBSDL_MIXER
  // iChannel == -1 will halt all channels. Is that right?
  if (Playing()) Mix_HaltChannel(iChannel);
#endif
  iChannel = -1;
  iStarted = 0;
  fLooping = false;
  return fRet;
}
Ejemplo n.º 10
0
void C4SoundInstance::ClearPointers(C4Object *pDelete) {
  if (!Playing()) {
    Stop();
    return;
  }
  if (pObj == pDelete) {
    // stop if looping (would most likely loop forever)
    if (fLooping) Stop();
    // otherwise: set volume by last position
    else
      SetVolumeByPos(pObj->x, pObj->y);
    pObj = NULL;
  }
}
Ejemplo n.º 11
0
bool CMain::GameLoop(){
	int dnum;

	StartDemo();

	if (PLAYDATA_NUM>0){
		CLoad PlayDataLoad;
			char path[256]; strcpy_s(path, "tenyu_data/save");
			PlayDataLoad.LoadPlayData(path, PlayData);
	}

	while(1){
		switch(Title()){
		case TITLE_FIRSTSTART:
			Opening();
			return Playing();

		case TITLE_LOADSTART:
			if (PLAYDATA_NUM>0 && (dnum = ChooseData()) != -1){
				return Playing(dnum);
			}
			break;

		case TITLE_SETTING:
			Setting();
			break;
		
		case TITLE_GAMEEND:
			return false;

		default:
			WarningDx("Warning->Unexpected matter happend [back to title]->GameLoop()", __FILE__, __LINE__);
		}
	}

	return true;
}
Ejemplo n.º 12
0
void ChannelInternalState::Devirtualize(ChannelInternalState* other) {
  assert(channel_id_ == kInvalidChannelId);
  assert(other->channel_id_ != kInvalidChannelId);

  // Transfer the real channel id to this channel.
  channel_id_ = other->channel_id_;
  other->channel_id_ = kInvalidChannelId;

  if (Playing()) {
    // Resume playing the audio.
    RealChannelPlay();
  } else if (Paused()) {
    // The audio needs to be playing to pause it.
    RealChannelPlay();
    RealChannelPause();
  }
}