1/*
2    Copyright (C) 2012 Samsung Electronics
3
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public
6    License 2.1 as published by the Free Software Foundation.
7
8    This library is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11    Library General Public License for more details.
12
13    You should have received a copy of the GNU Library General Public License
14    along with this library; see the file COPYING.LIB.  If not, write to
15    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16    Boston, MA 02110-1301, USA.
17*/
18
19#include "config.h"
20
21#if ENABLE(WEB_AUDIO)
22#include "AudioBus.h"
23
24#include "AudioFileReader.h"
25#include "FileSystem.h"
26#include <wtf/text/CString.h>
27#include <wtf/text/StringConcatenate.h>
28
29namespace WebCore {
30
31PassRefPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, float sampleRate)
32{
33    String absoluteFilename(makeString(DATA_DIR, "/webaudio/resources/", name, ".wav"));
34    if (!fileExists(absoluteFilename))
35        absoluteFilename = makeString(UNINSTALLED_AUDIO_RESOURCES_DIR, "/", name, ".wav");
36
37    return createBusFromAudioFile(absoluteFilename.utf8().data(), false, sampleRate);
38}
39
40} // namespace WebCore
41
42#endif // ENABLE(WEB_AUDIO)
43