now plays the file found for the selected event
reclaim and reuse of sounds ressources still to be implemented git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20742 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -15,5 +15,5 @@ Server media_addon_server :
|
||||
MediaFilePlayer.cpp
|
||||
SystemTimeSource.cpp
|
||||
:
|
||||
be libmedia.so
|
||||
be libmedia.so game
|
||||
;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007, Marcus Overhagen <[email protected]>. All rights reserved.
|
||||
* Copyright (c) 2004, Marcus Overhagen <[email protected]>. All rights reserved.
|
||||
* Copyright (c) 2007, Jérôme Duval. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <Entry.h>
|
||||
#include <FileGameSound.h>
|
||||
#include <MediaFiles.h>
|
||||
#include "MediaFilePlayer.h"
|
||||
#include "debug.h"
|
||||
@@ -14,6 +16,15 @@ PlayMediaFile(const char *media_type, const char *media_name)
|
||||
TRACE("PlayMediaFile: type '%s', name '%s'\n", media_type, media_name);
|
||||
|
||||
entry_ref ref;
|
||||
BMediaFiles().GetRefFor(media_type, media_name, &ref);
|
||||
if (BMediaFiles().GetRefFor(media_type, media_name, &ref)!=B_OK
|
||||
|| !BEntry(&ref).Exists())
|
||||
return;
|
||||
|
||||
BFileGameSound *sound = new BFileGameSound(&ref, false);
|
||||
if (sound->InitCheck() == B_OK) {
|
||||
sound->Preload();
|
||||
sound->StartPlaying();
|
||||
}
|
||||
// TODO reclaim sound
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user