当前位置: 首页>>代码示例>>C++>>正文


C++ Sound::DecRef方法代码示例

本文整理汇总了C++中Sound::DecRef方法的典型用法代码示例。如果您正苦于以下问题:C++ Sound::DecRef方法的具体用法?C++ Sound::DecRef怎么用?C++ Sound::DecRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sound的用法示例。


在下文中一共展示了Sound::DecRef方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SDLSound

Sound *Sound::Create(float *inData, int len, bool inForceMusic) {
   if (!Init())
      return 0;
   Sound *sound = inForceMusic ? 0 :  new SDLSound(inData, len);
   if (!sound || !sound->ok())
   {
      if (sound) sound->DecRef();
      sound = new SDLMusic(inData, len);
   }
   return sound;
}
开发者ID:DanielUranga,项目名称:NME,代码行数:11,代码来源:SDLSound.cpp

示例2: SDLSound

Sound *Sound::Create(const std::string &inFilename,bool inForceMusic)
{
   if (!Init())
      return 0;
   Sound *sound = inForceMusic ? 0 :  new SDLSound(inFilename);
   if (!sound || !sound->ok())
   {
      if (sound) sound->DecRef();
      sound = new SDLMusic(inFilename);
   }
   return sound;
}
开发者ID:deltaluca,项目名称:Haxe-NME--fork-,代码行数:12,代码来源:SDLSound.cpp

示例3: ReadAndCreate

Sound *Sound::FromFile(const std::string &inFilename, bool inForceMusic, const std::string &inEngine)
{
   Sound *result = 0;

   #ifdef HX_ANDROID

   if (inEngine=="opensl")
      result = ReadAndCreate(inFilename, inForceMusic, CreateOpenSlSound);
   else
      result = CreateAndroidSound(inFilename,inForceMusic);

   #elif defined(IPHONE)

   AudioFormat format = determineFormatFromFile(inFilename);

   if (format==eAF_mp3 || (inForceMusic && format!=eAF_ogg && format!=eAF_mid ) || inEngine=="avplayer"  )
      result = CreateAvPlayerSound(inFilename);
   else
      result = ReadAndCreate(inFilename, inForceMusic, CreateOpenAlSound);

   #elif defined(EMSCRIPTEN)
      result = ReadAndCreate(inFilename, inForceMusic, CreateOpenAlSound);
   #else

     #ifdef HX_MACOS
     if (inEngine=="openal")
        result = ReadAndCreate(inFilename, inForceMusic, CreateOpenAlSound);
     else
     #endif
   result = CreateSdlSound(inFilename,inForceMusic);

   #endif

   if (result && !result->ok())
   {
      result->DecRef();
      result = 0;
   }

   if (!result)
      ELOG("Error creating sound from filename %s", inFilename.c_str() );
   return result;
}
开发者ID:madrazo,项目名称:nme,代码行数:43,代码来源:Sound.cpp

示例4: CreateOpenSlSound

Sound *Sound::FromEncodedBytes(const unsigned char *inData, int inLen, bool inForceMusic, const std::string &inEngine)
{
   Sound *result = 0;

   #ifdef HX_ANDROID

   // Maybe use opensl here ....
   if (inEngine=="opensl")
      result = CreateOpenSlSound(inData, inLen, inForceMusic);
   else
      result = CreateAndroidSound(inData, inLen, inForceMusic);

   #elif defined(IPHONE)

   // AVPlayer must be used to play mp3 files
   // OpenAl must be used to play ogg and mid

   // OpenAl allows small files to be cached in buffers
   // AVPlayer as better hardware pathways

   AudioFormat format = determineFormatFromBytes(inData, inLen);

   if (format==eAF_mp3 || (inForceMusic && format!=eAF_ogg && format!=eAF_mid ) )
      result = CreateAvPlayerSound(inData,inLen);
   else
      result = CreateOpenAlSound(inData, inLen, inForceMusic);

   #elif defined(EMSCRIPTEN)
      result = CreateOpenAlSound(inData, inLen, inForceMusic);
      if (!result || !result->ok())
      {
         if (result)
            result->DecRef();
         result = CreateSdlSound(inData, inLen, inForceMusic);
      }
   #else


    #ifdef HX_MACOS
    // Openal can be tested on mac
    if (inEngine=="openal")
    {
      result = CreateOpenAlSound(inData, inLen, inForceMusic);
    }
    else
    #endif

   result = CreateSdlSound(inData, inLen, inForceMusic);

   #endif

   if (result && !result->ok())
   {
      result->DecRef();
      result = 0;
   }

   if (!result)
      ELOG("Error creating sound from  %d bytes", inLen);

   return result;
}
开发者ID:madrazo,项目名称:nme,代码行数:62,代码来源:Sound.cpp


注:本文中的Sound::DecRef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。