1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_AUDIO_SOUNDS_SOUNDS_MANAGER_H_
6 #define MEDIA_AUDIO_SOUNDS_SOUNDS_MANAGER_H_
10 #include "base/basictypes.h"
11 #include "base/strings/string_piece.h"
12 #include "base/threading/non_thread_safe.h"
13 #include "base/time/time.h"
14 #include "media/base/media_export.h"
18 // This class is used for reproduction of system sounds. All methods
19 // should be accessed from the Audio thread.
20 class MEDIA_EXPORT SoundsManager : public base::NonThreadSafe {
30 // Creates a singleton instance of the SoundsManager.
33 // Removes a singleton instance of the SoundsManager.
34 static void Shutdown();
36 // Returns a pointer to a singleton instance of the SoundsManager.
37 static SoundsManager* Get();
39 // Initializes SoundsManager with the wav data for the system
40 // sounds. Returns true if SoundsManager was successfully
42 virtual bool Initialize(const std::vector<base::StringPiece>& resources) = 0;
44 // Plays |sound|, returns false if SoundsManager was not properly
46 virtual bool Play(Sound sound) = 0;
48 // Returns duration of the |sound|. If SoundsManager was not
49 // properly initialized returns an empty value.
50 virtual base::TimeDelta GetDuration(Sound sound) = 0;
54 virtual ~SoundsManager();
57 DISALLOW_COPY_AND_ASSIGN(SoundsManager);
62 #endif // MEDIA_AUDIO_SOUNDS_SOUNDS_MANAGER_H_