1*4703fb5dSbeveloper //------------------------------------------------------------------------------ 2*4703fb5dSbeveloper // Copyright (c) 2001-2002, OpenBeOS 3*4703fb5dSbeveloper // 4*4703fb5dSbeveloper // Permission is hereby granted, free of charge, to any person obtaining a 5*4703fb5dSbeveloper // copy of this software and associated documentation files (the "Software"), 6*4703fb5dSbeveloper // to deal in the Software without restriction, including without limitation 7*4703fb5dSbeveloper // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*4703fb5dSbeveloper // and/or sell copies of the Software, and to permit persons to whom the 9*4703fb5dSbeveloper // Software is furnished to do so, subject to the following conditions: 10*4703fb5dSbeveloper // 11*4703fb5dSbeveloper // The above copyright notice and this permission notice shall be included in 12*4703fb5dSbeveloper // all copies or substantial portions of the Software. 13*4703fb5dSbeveloper // 14*4703fb5dSbeveloper // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15*4703fb5dSbeveloper // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16*4703fb5dSbeveloper // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17*4703fb5dSbeveloper // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18*4703fb5dSbeveloper // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19*4703fb5dSbeveloper // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20*4703fb5dSbeveloper // DEALINGS IN THE SOFTWARE. 21*4703fb5dSbeveloper // 22*4703fb5dSbeveloper // File Name: GameSoundDevice.h 23*4703fb5dSbeveloper // Author: Christopher ML Zumwalt May (zummy@users.sf.net) 24*4703fb5dSbeveloper // Description: Manages the game producer. The class may change with out 25*4703fb5dSbeveloper // notice and was only inteneded for use by the GameKit at 26*4703fb5dSbeveloper // this time. Use at your own risk. 27*4703fb5dSbeveloper //------------------------------------------------------------------------------ 28*4703fb5dSbeveloper 29*4703fb5dSbeveloper #ifndef _GAMESOUNDDEVICE_H 30*4703fb5dSbeveloper #define _GAMESOUNDDEVICE_H 31*4703fb5dSbeveloper 32*4703fb5dSbeveloper // Standard Includes ----------------------------------------------------------- 33*4703fb5dSbeveloper 34*4703fb5dSbeveloper // System Includes ------------------------------------------------------------- 35*4703fb5dSbeveloper #include <GameSoundDefs.h> 36*4703fb5dSbeveloper 37*4703fb5dSbeveloper // Project Includes ------------------------------------------------------------ 38*4703fb5dSbeveloper 39*4703fb5dSbeveloper // Local Includes -------------------------------------------------------------- 40*4703fb5dSbeveloper 41*4703fb5dSbeveloper // Local Defines --------------------------------------------------------------- 42*4703fb5dSbeveloper 43*4703fb5dSbeveloper // Globals --------------------------------------------------------------------- 44*4703fb5dSbeveloper class BMediaNode; 45*4703fb5dSbeveloper class GameSoundBuffer; 46*4703fb5dSbeveloper struct Connection; 47*4703fb5dSbeveloper 48*4703fb5dSbeveloper // BGameSoundDevice ------------------------------------------------------------ 49*4703fb5dSbeveloper class BGameSoundDevice 50*4703fb5dSbeveloper { 51*4703fb5dSbeveloper public: 52*4703fb5dSbeveloper BGameSoundDevice(); 53*4703fb5dSbeveloper virtual ~BGameSoundDevice(); 54*4703fb5dSbeveloper 55*4703fb5dSbeveloper status_t InitCheck() const; 56*4703fb5dSbeveloper virtual const gs_audio_format & Format() const; 57*4703fb5dSbeveloper virtual const gs_audio_format & Format(gs_id sound) const; 58*4703fb5dSbeveloper 59*4703fb5dSbeveloper virtual status_t CreateBuffer(gs_id * sound, 60*4703fb5dSbeveloper const gs_audio_format * format, 61*4703fb5dSbeveloper const void * data, 62*4703fb5dSbeveloper int64 frames); 63*4703fb5dSbeveloper virtual status_t CreateBuffer(gs_id * sound, 64*4703fb5dSbeveloper const void * object, 65*4703fb5dSbeveloper const gs_audio_format * format); 66*4703fb5dSbeveloper virtual void ReleaseBuffer(gs_id sound); 67*4703fb5dSbeveloper 68*4703fb5dSbeveloper virtual status_t Buffer(gs_id sound, 69*4703fb5dSbeveloper gs_audio_format * format, 70*4703fb5dSbeveloper void * data); 71*4703fb5dSbeveloper 72*4703fb5dSbeveloper virtual bool IsPlaying(gs_id sound); 73*4703fb5dSbeveloper virtual status_t StartPlaying(gs_id sound); 74*4703fb5dSbeveloper virtual status_t StopPlaying(gs_id sound); 75*4703fb5dSbeveloper 76*4703fb5dSbeveloper virtual status_t GetAttributes(gs_id sound, 77*4703fb5dSbeveloper gs_attribute * attributes, 78*4703fb5dSbeveloper size_t attributeCount); 79*4703fb5dSbeveloper virtual status_t SetAttributes(gs_id sound, 80*4703fb5dSbeveloper gs_attribute * attributes, 81*4703fb5dSbeveloper size_t attributeCount); 82*4703fb5dSbeveloper 83*4703fb5dSbeveloper protected: 84*4703fb5dSbeveloper void SetInitError(status_t error); 85*4703fb5dSbeveloper 86*4703fb5dSbeveloper gs_audio_format fFormat; 87*4703fb5dSbeveloper private: 88*4703fb5dSbeveloper status_t Connect(); 89*4703fb5dSbeveloper int32 AllocateSound(); 90*4703fb5dSbeveloper 91*4703fb5dSbeveloper status_t fInitError; 92*4703fb5dSbeveloper 93*4703fb5dSbeveloper Connection * fConnection; 94*4703fb5dSbeveloper bool fIsConnected; 95*4703fb5dSbeveloper 96*4703fb5dSbeveloper int32 fSoundCount; 97*4703fb5dSbeveloper GameSoundBuffer ** fSounds; 98*4703fb5dSbeveloper }; 99*4703fb5dSbeveloper 100*4703fb5dSbeveloper BGameSoundDevice* GetDefaultDevice(); 101*4703fb5dSbeveloper void ReleaseDevice(); 102*4703fb5dSbeveloper 103*4703fb5dSbeveloper #endif 104