示例#1
0
文件: alutLoader.c 项目: Risca/sgct
static BufferData *
loadFile (InputStream *stream)
{
    const char *fileName;
    Int32BigEndian magic;

    /* Raw files have no magic number - so use the fileName extension */

    fileName = _alutInputStreamGetFileName (stream);
    if (fileName != NULL && hasSuffixIgnoringCase (fileName, ".raw"))
    {
        return loadRawFile (stream);
    }

    /* For other file formats, read the quasi-standard four byte magic number */
    if (!_alutInputStreamReadInt32BE (stream, &magic))
    {
        return AL_FALSE;
    }

    /* Magic number 'RIFF' == Microsoft '.wav' format */
    if (magic == 0x52494646)
    {
        return loadWavFile (stream);
    }

    /* Magic number '.snd' == Sun & Next's '.au' format */
    if (magic == 0x2E736E64)
    {
        return loadAUFile (stream);
    }

    _alutSetError (ALUT_ERROR_UNSUPPORTED_FILE_TYPE);
    return AL_FALSE;
}
示例#2
0
int main(int argc, char* argv[])
{

   vrj::Kernel* kernel = vrj::Kernel::instance();  // Get the kernel
   OsgNavGrab* application = new OsgNavGrab(kernel, argc, argv);             // Instantiate an instance of the app

   if ( argc <= 1 )
   {
      // display some usage info (holding the user by the hand stuff)
      //  this will probably go away once the kernel becomes separate
      //  and can load application plugins.
      std::cout<<"\n"<<std::flush;
      std::cout<<"\n"<<std::flush;

      std::cout << "Usage: " << argv[0]
         << " vrjconfigfile[0] vrjconfigfile[1] ... vrjconfigfile[n]\n"
         << std::endl << std::endl;

      std::exit(1);
   }



// Fin de la partie OpenAL

   //application->setModelFileName(std::string(argv[1]));

   // Load any config files specified on the command line
   for ( int i = 1; i < argc; ++i )
   {
      kernel->loadConfigFile(argv[i]);
   }


   kernel->start();

   kernel->setApplication(application);
   if(loadWavFile("wavdata/powerup.wav")) {
   	  atexit(KillALData);

   	  alSourcePlay(Source);
   }

   kernel->waitForKernelStop();
   
   delete application;
   return 0;
}
bool x_load_wav(const char* _Path, unsigned char** _outDataBuffer, unsigned int & _outFileSize,  OASound & _sound  )
{
   
   return  loadWavFile(_Path,_outDataBuffer,&_outFileSize,&_sound.frequency,&_sound.depth,&_sound.nbchannel);
   }