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