void HEventList::SetType(const char* type) { RemoveAll(); BMediaFiles mfiles; mfiles.RewindRefs(type); delete fType; fType = strdup(type); BString name; entry_ref ref; while (mfiles.GetNextRef(&name,&ref) == B_OK) { BPath path(&ref); if (path.InitCheck() != B_OK || ref.name == NULL || strcmp(ref.name, "") == 0) AddRow(new HEventRow(name.String(), NULL)); else AddRow(new HEventRow(name.String(), path.Path())); } }
status_t SoundsThemesAddon::MakeTheme(BMessage &theme, uint32 flags) { BMessage sounds; status_t err; BMediaFiles bmfs; BString item; entry_ref entry; BEntry ent; BPath path; float gain; (void)flags; err = MyMessage(theme, sounds); if (err) sounds.MakeEmpty(); bmfs.RewindRefs(BMediaFiles::B_SOUNDS); while (bmfs.GetNextRef(&item, &entry) == B_OK) { BMessage msg('SndI'); path.Unset(); ent.SetTo(&entry); ent.GetPath(&path); //printf("\t%s: %s\n", item.String(), path.Path()); if (path.Path()) { msg.AddString("sounds:file", path.Path()); gain = 1.0; #if defined(__ANTARES__) || defined(B_BEOS_VERSION_DANO) bmfs.GetAudioGainFor(BMediaFiles::B_SOUNDS, item.String(), &gain); #endif msg.AddFloat("sounds:volume", gain); } sounds.AddMessage(item.String(), &msg); } err = SetMyMessage(theme, sounds); return err; }