ManaPlus
Static Public Member Functions | Data Fields
anonymous_namespace{musicloader.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 39 of file musicloader.cpp.

Member Function Documentation

◆ load()

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

Definition at line 45 of file musicloader.cpp.

46  {
47  if (v == nullptr)
48  return nullptr;
49  const ResourceLoader *const
50  rl = static_cast<const ResourceLoader *>(v);
51  SDL_RWops *const rw = VirtFs::rwopsOpenRead(rl->path);
52  if (rw == nullptr)
53  {
54  reportAlways("Error loading resource: %s",
55  rl->path.c_str())
56  return nullptr;
57  }
58  if (Mix_Music *const music = SDL::LoadMUSOgg_RW(rw))
59  {
60 #ifdef USE_SDL2
61  return new SDLMusic(music, nullptr, rl->path);
62 #else // USE_SDL2
63 
64  return new SDLMusic(music, rw, rl->path);
65 #endif // USE_SDL2
66  }
67 
68  logger->log("Error, failed to load music: %s", SDL_GetError());
69  return nullptr;
70  }
#define reportAlways(...)
Definition: checkutils.h:253
void log(const char *const log_text,...)
Definition: logger.cpp:269
if(!vert) return
Logger * logger
Definition: logger.cpp:89
Definition: sdlhelper.h:45
Mix_Music * LoadMUSOgg_RW(SDL_RWops *const rw)
SDL_RWops * rwopsOpenRead(const std::string &fname)
Definition: rwops.cpp:107

References SDL::LoadMUSOgg_RW(), Logger::log(), logger, path, reportAlways, and VirtFs::rwopsOpenRead().

Field Documentation

◆ path

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

Definition at line 43 of file musicloader.cpp.

Referenced by load().


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