DirectXAudio

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • DirectXAudio

      Hello everyone,

      i hope one of you guys can help me:)

      I am writing a wrapper for Directx Audio and it was going really well so far but when i try to use the ZipFileLoader from the book i cant figure out how to load the soundfiles when they are already in memory.

      here is some code i tried but which didnt work:

      bool FBSSoundManager::Load(bool BGSound, std::string ResourceName, std::string FileName){
      FBSFileLoaderInterface* File = new FBSFileLoaderInterface();
      if(!File->Open(ResourceName.c_str())){
      FBSLogFile::WriteToLog("EngineLog.txt", "Could not open Sound Resource");
      return false;
      }
      int size = File->GetResourceSize(FileName);
      Allocate(size);
      std::string data;
      data = File->GetResource(FileName);

      DMUS_OBJECTDESC objDesc;
      objDesc.dwSize = sizeof(DMUS_OBJECTDESC);
      objDesc.guidClass = CLSID_DirectMusicSegment;
      objDesc.dwValidData = DMUS_OBJ_CLASS | DMUS_OBJ_MEMORY;
      objDesc.pbMemData = (BYTE *) data.c_str();
      objDesc.llMemLength = size;


      FBSSound* temp = new FBSSound();
      temp->SetSize(size);
      temp->SetResourceFileName(ResourceName);
      float Time = timeGetTime()/100;
      temp->SetAccess(Time);



      IDirectMusicSegment8* tempSound;
      m_lpLoader->GetObject(&objDesc, IID_IDirectMusicSegment8, (void**) &tempSound);
      tempSound->Download(m_lpPerformance);

      if(BGSound == false){
      temp->SetSound(tempSound);
      m_PrioMap.insert(PrioValType(Time,FileName));
      m_SoundMap.insert(SoundMapValType(FileName,temp));
      }else{
      m_lpSegBackgroundMusic = tempSound;
      }
      File->Close();
      return true;
      }


      would be great if anyone had a hint for me