Rc<Gosu::Song> genSong(const std::string& name) { Unique<Resource> r = Resources::instance().load(name); if (!r) { // Error logged. return Rc<Gosu::Song>(); } GosuCBuffer buffer(r->data(), r->size()); TimeMeasure m("Constructed " + name + " as music"); return Rc<Gosu::Song>(new Gosu::Song(buffer.front_reader())); }