xref: /haiku/docs/user/game/FileGameSound.dox (revision e5d65858f2361fe0552495b61620c84dcee6bc00)
1/*
2 * Copyright 2012 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		John Scipione, jscipione@gmail.com
7 *
8 * Corresponds to:
9 *		src/kits/game/FileGameSound.cpp	hrev45076
10 *		src/kits/game/FileGameSound.h	hrev45076
11 */
12
13
14/*!
15	\file FileGameSound.h
16	\ingroup game
17	\ingroup libbe
18	\brief Provides the BFileGameSound class.
19*/
20
21
22/*!
23	\class BFileGameSound
24	\ingroup game
25	\ingroup libbe
26	\brief Playback audio from a sound file on disk.
27*/
28
29
30/*!
31	\fn BFileGameSound::BFileGameSound(const entry_ref *file, bool looping,
32		BGameSoundDevice *device)
33	\brief Creates and initializes a BFileGameSound object from an
34		   \c entry_ref allowing you to play the specified sound file.
35
36	If \a looping is \c true, the sound automatically replays from the
37	beginning once the end is reached. This is useful for playing
38	background music in a loop.
39
40	You can specify the sound devise to use by setting the \a device
41	parameter. Setting \a device to \c NULL uses the default sound device.
42
43	\param file The entry ref pointing to the sound file on disk.
44	\param looping Whether or not to repeat the sound in a loop.
45	\param device The sound device to use to play the sound, use \c NULL for
46		   default.
47*/
48
49
50/*!
51	\fn BFileGameSound::BFileGameSound(const char *file, bool looping,
52		BGameSoundDevice *device)
53	\brief Creates and initializes a BFileGameSound object from a file path
54		   allowing you to play the specified sound file.
55
56	If \a looping is \c true, the sound automatically replays from the
57	beginning once the end is reached. This is useful for playing
58	background music in a loop.
59
60	You can specify the sound devise to use by setting the \a device
61	parameter. Setting \a device to \c NULL uses the default sound device.
62
63	\param file The path of the sound file on disk.
64	\param looping Whether or not to repeat the sound in a loop.
65	\param device The sound device to use to play the sound, use \c NULL for
66		   default.
67*/
68
69
70/*!
71	\fn BFileGameSound::~BFileGameSound()
72	\brief Destroys the BFileGameSound object.
73*/
74
75
76/*!
77	\fn BGameSound* BFileGameSound::Clone() const
78	\brief Not implemented, always returns \c NULL.
79*/
80
81
82/*!
83	\fn status_t BFileGameSound::StartPlaying()
84	\brief Plays the sound file.
85
86	\returns A status code, \c B_OK on success or an error code on error.
87*/
88
89
90/*!
91	\fn status_t BFileGameSound::StopPlaying()
92	\brief Stops playback of the sound file.
93
94	\returns A status code, \c B_OK on success or an error code on error.
95*/
96
97
98/*!
99	\fn status_t BFileGameSound::Preload()
100	\brief Preload the sound file into memory so that playback won't be delayed.
101
102	\returns A status code, \c B_OK on success or an error code if we were
103			 unable to communicate with the sound port.
104*/
105
106
107/*!
108	\fn void BFileGameSound::FillBuffer(void *inBuffer, size_t inByteCount)
109	\brief Fill a buffer with sound data.
110
111	\param inBuffer The buffer to fill.
112	\param inByteCount The number of bytes to fill buffer with.
113*/
114
115
116/*!
117	\fn status_t BFileGameSound::SetPaused(bool isPaused, bigtime_t rampTime)
118	\brief Pauses playback if \a isPaused is \c true or resumes play if
119		   \a isPaused is \c false.
120
121	\param isPaused \c true to pause playback, \c false to resume playback.
122	\param rampTime Determines how long the change in playback state should
123		   take to complete in microseconds. Set to 0 for an instantaneous
124		   change.
125
126	\returns A status code.
127	\retval B_OK The playback state was updated.
128	\retval EALREADY Already in the requested playback state.
129*/
130
131
132/*!
133	\fn int32 BFileGameSound::IsPaused()
134	\brief Returns the current playback status.
135
136	\returns An integer indicating the current playback status.
137	\retval B_NOT_PAUSED Sound is playing.
138	\retval B_PAUSE_IN_PROGRESS The sound is transitioning to or from a paused state.
139	\retval B_PAUSED Sound is paused.
140*/
141