Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include "IntelSoundComponent.h"
  2. #include "Paths.h"
  3. #include "FileManager.h"
  4. #include "Runtime/Engine/Classes/Sound/SoundWave.h"
  5.  
  6. bool exists;
  7. FString dir, soundDir;
  8. TArray<FString> soundFiles;
  9.  
  10. // Sets default values for this component's properties
  11. UIntelSoundComponent::UIntelSoundComponent()
  12. {
  13.     // Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
  14.     // off to improve performance if you don't need them.
  15.     PrimaryComponentTick.bCanEverTick = true;
  16.    
  17.     //Empty soundFiles TArray. Easiest way if new wave files are added.
  18.     soundFiles.Empty();
  19.    
  20.     //the way Unreal Engine calls the project's root directory
  21.     dir = FPaths::ProjectDir();
  22.  
  23.     //Combining Root with the folder location for the sounds.
  24.     //This could probably be an external folder if needed with the help of ( IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile(); )
  25.     soundDir = dir + "Content/Sounds";
  26.  
  27.     //UE4 returns a bool if the directory exists or not.
  28.     exists = FPaths::DirectoryExists(soundDir);
  29.    
  30. }