コード例 #1
0
ファイル: rixplay.cpp プロジェクト: orionpax/socoolpal
INT
RIX_Init(
   LPCSTR     szFileName
)
/*++
  Purpose:

    Initialize the RIX player subsystem.

  Parameters:

    [IN]  szFileName - Filename of the mus.mkf file.

  Return value:

    0 if success, -1 if cannot allocate memory, -2 if file not found.

--*/
{
   gpRixPlayer = new RIXPLAYER;
   if (gpRixPlayer == NULL)
   {
      return -1;
   }

   gpRixPlayer->opl.settype(Copl::TYPE_OPL2);

   //
   // Load the MKF file.
   //
   if (!gpRixPlayer->rix.load(szFileName, CProvider_Filesystem()))
   {
      delete gpRixPlayer;
      gpRixPlayer = NULL;
      return -2;
   }

   //
   // Success.
   //
   gpRixPlayer->iCurrentMusic = -1;
   gpRixPlayer->dwEndFadeTime = 0;
   gpRixPlayer->pos = NULL;
   gpRixPlayer->fLoop = FALSE;
   gpRixPlayer->fNextLoop = FALSE;

   return 0;
}
コード例 #2
0
ファイル: rixplay.cpp プロジェクト: HappyZ/ChinesePaladinPort
INT
RIX_Init(
   LPCSTR     szFileName
)
/*++
  Purpose:

    Initialize the RIX player subsystem.

  Parameters:

    [IN]  szFileName - Filename of the mus.mkf file.

  Return value:

    0 if success, -1 if cannot allocate memory, -2 if file not found.

--*/
{
   gpRixPlayer = new RIXPLAYER;
   if (gpRixPlayer == NULL)
   {
      return -1;
   }
#if USE_SURROUNDOPL && (PAL_CHANNELS == 2)
#	if USE_DEMUOPL
   gpRixPlayer->opl = new CSurroundopl(new CDemuopl(PAL_SAMPLE_RATE, true, false),
      new CDemuopl(PAL_SAMPLE_RATE, true, false), true);
#	else
   gpRixPlayer->opl = new CSurroundopl(new CEmuopl(PAL_SAMPLE_RATE, true, false),
      new CEmuopl(PAL_SAMPLE_RATE, true, false), true);
#	endif
#else
#	if USE_DEMUOPL
   gpRixPlayer->opl = new CDemuopl(PAL_SAMPLE_RATE, true, false);
#	else
   gpRixPlayer->opl = new CEmuopl(PAL_SAMPLE_RATE, true, false);
#	endif
#endif

   if (gpRixPlayer->opl == NULL)
   {
      delete gpRixPlayer;
      return -1;
   }

   gpRixPlayer->rix = new CrixPlayer(gpRixPlayer->opl);
   if (gpRixPlayer->rix == NULL)
   {
      delete gpRixPlayer->opl;
      delete gpRixPlayer;
      return -1;
   }

   //
   // Load the MKF file.
   //
   if (!gpRixPlayer->rix->load(szFileName, CProvider_Filesystem()))
   {
      delete gpRixPlayer->rix;
      delete gpRixPlayer->opl;
      delete gpRixPlayer;
      gpRixPlayer = NULL;
      return -2;
   }

   //
   // Success.
   //
   gpRixPlayer->iCurrentMusic = -1;
   gpRixPlayer->dwEndFadeTime = 0;
   gpRixPlayer->pos = NULL;
   gpRixPlayer->fLoop = FALSE;
   gpRixPlayer->fNextLoop = FALSE;

   return 0;
}