Hello! Tried this, but as a result I get no sound, but a
Suggested buffer duration 10000, size 3528
#include <stdio.h>
#include <MediaDefs.h>
#include <Sound.h>
#include <SoundPlayer.h>
#include <Entry.h>
#include <Path.h>
void playsound(char *path) {
BSound *sound;
BSoundPlayer player;
entry_ref ref;
BEntry entry(path, true);
BSoundPlayer::play_id id;
if (entry.InitCheck() == B_OK) {
if (entry.GetRef(&ref) == B_OK) {
sound = new BSound(&ref);
if (sound->InitCheck() == B_OK) {
printf("InitCheck() == OK\n");
player.Start();
player.SetVolume(1.0);
id = player.StartPlaying(sound);
sound->ReleaseRef();
player.WaitForSound(id);
}
}
}
}
int main() {
printf("play\n");
playsound("/boot/home/simple.mp3");
}