ManaPlus
Static Public Member Functions | Data Fields
anonymous_namespace{soundloader.cpp}::ResourceLoader Struct Reference

Static Public Member Functions

static Resourceload (const void *const v)
 

Data Fields

const std::string path
 

Detailed Description

Definition at line 38 of file soundloader.cpp.

Member Function Documentation

◆ load()

static Resource* anonymous_namespace{soundloader.cpp}::ResourceLoader::load ( const void *const  v)
inlinestatic

Definition at line 44 of file soundloader.cpp.

45  {
46  if (v == nullptr)
47  return nullptr;
48  const ResourceLoader *const
49  rl = static_cast<const ResourceLoader *>(v);
50  SDL_RWops *const rw = VirtFs::rwopsOpenRead(rl->path);
51  if (rw == nullptr)
52  {
53  reportAlways("Error loading resource: %s",
54  rl->path.c_str())
55  return nullptr;
56  }
57  // Load the music data and free the RWops structure
58  Mix_Chunk *const tmpSoundEffect = Mix_LoadWAV_RW(rw, 1);
59 
60  if (tmpSoundEffect != nullptr)
61  {
62  return new SoundEffect(tmpSoundEffect, rl->path);
63  }
64  reportAlways("Error, failed to load sound effect: %s",
65  SDL_GetError())
66  return nullptr;
67  }
#define reportAlways(...)
Definition: checkutils.h:253
if(!vert) return
SDL_RWops * rwopsOpenRead(const std::string &fname)
Definition: rwops.cpp:107

References path, reportAlways, and VirtFs::rwopsOpenRead().

Field Documentation

◆ path

const std::string anonymous_namespace{soundloader.cpp}::ResourceLoader::path

Definition at line 42 of file soundloader.cpp.

Referenced by load().


The documentation for this struct was generated from the following file: