BGameSoundDevice: Cleanup.

* Use new-style header comments.

 * Put globals inside class or make static, instead of exporting
   unnecessarily.
This commit is contained in:
Augustin Cavalier
2026-02-28 21:52:05 -05:00
parent 6a4a02907a
commit 4d055d982a
3 changed files with 31 additions and 70 deletions
+3 -4
View File
@@ -4,7 +4,6 @@
* *
* Authors: * Authors:
* Christopher ML Zumwalt May ([email protected]) * Christopher ML Zumwalt May ([email protected])
*
*/ */
@@ -30,7 +29,7 @@ BGameSound::BGameSound(BGameSoundDevice *device)
// TODO: device is ignored! // TODO: device is ignored!
// NOTE: BeBook documents that BGameSoundDevice must currently always // NOTE: BeBook documents that BGameSoundDevice must currently always
// be NULL... // be NULL...
fDevice = GetDefaultDevice(); fDevice = BGameSoundDevice::GetDefaultDevice();
fInitError = fDevice->InitCheck(); fInitError = fDevice->InitCheck();
} }
@@ -41,7 +40,7 @@ BGameSound::BGameSound(const BGameSound &other)
{ {
memcpy(&fFormat, &other.fFormat, sizeof(gs_audio_format)); memcpy(&fFormat, &other.fFormat, sizeof(gs_audio_format));
// TODO: device from other is ignored! // TODO: device from other is ignored!
fDevice = GetDefaultDevice(); fDevice = BGameSoundDevice::GetDefaultDevice();
fInitError = fDevice->InitCheck(); fInitError = fDevice->InitCheck();
} }
@@ -52,7 +51,7 @@ BGameSound::~BGameSound()
if (fSound >= 0) if (fSound >= 0)
fDevice->ReleaseBuffer(fSound); fDevice->ReleaseBuffer(fSound);
ReleaseDevice(); BGameSoundDevice::ReleaseDevice();
} }
+17 -35
View File
@@ -1,31 +1,17 @@
//------------------------------------------------------------------------------ /*
// Copyright (c) 2001-2002, Haiku * Copyright 2001-2002, Haiku. All rights reserved.
// * Distributed under the terms of the MIT License.
// Permission is hereby granted, free of charge, to any person obtaining a *
// copy of this software and associated documentation files (the "Software"), * Authors:
// to deal in the Software without restriction, including without limitation * Stefano Ceccherini ([email protected])
// the rights to use, copy, modify, merge, publish, distribute, sublicense, * Adrien Destugues (pulkomandy)
// and/or sell copies of the Software, and to permit persons to whom the * Jérôme Duval (korli)
// Software is furnished to do so, subject to the following conditions: * Christopher ML Zumwalt May ([email protected])
// */
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: BGameSoundDevice.cpp
// Author: Christopher ML Zumwalt May ([email protected])
// Description: Manages the game producer. The class may change with out
// notice and was only inteneded for use by the GameKit at
// this time. Use at your own risk.
//------------------------------------------------------------------------------
// Description: Manages the game producer. The class may change without
// notice and was only intended for use by the GameKit at
// this time. Use at your own risk.
#include "GameSoundDevice.h" #include "GameSoundDevice.h"
@@ -42,13 +28,10 @@
#include <TimeSource.h> #include <TimeSource.h>
#include "GameSoundBuffer.h" #include "GameSoundBuffer.h"
#include "GameProducer.h"
#include "GSUtility.h"
// BGameSoundDevice definitions ------------------------------------ static const int32 kInitSoundCount = 32;
const int32 kInitSoundCount = 32; static const int32 kGrowth = 16;
const int32 kGrowth = 16;
static int32 sDeviceCount = 0; static int32 sDeviceCount = 0;
static BGameSoundDevice* sDevice = NULL; static BGameSoundDevice* sDevice = NULL;
@@ -56,7 +39,7 @@ static BLocker sDeviceRefCountLock("GameSound device lock");
BGameSoundDevice* BGameSoundDevice*
GetDefaultDevice() BGameSoundDevice::GetDefaultDevice()
{ {
BAutolock _(sDeviceRefCountLock); BAutolock _(sDeviceRefCountLock);
@@ -69,7 +52,7 @@ GetDefaultDevice()
void void
ReleaseDevice() BGameSoundDevice::ReleaseDevice()
{ {
BAutolock _(sDeviceRefCountLock); BAutolock _(sDeviceRefCountLock);
@@ -82,7 +65,6 @@ ReleaseDevice()
} }
// BGameSoundDevice -------------------------------------------------------
BGameSoundDevice::BGameSoundDevice() BGameSoundDevice::BGameSoundDevice()
: :
fIsConnected(false), fIsConnected(false),
+11 -31
View File
@@ -1,34 +1,11 @@
//------------------------------------------------------------------------------ /*
// Copyright (c) 2001-2002, Haiku * Copyright 2001-2002, Haiku. All rights reserved.
// * Distributed under the terms of the MIT License.
// Permission is hereby granted, free of charge, to any person obtaining a */
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: GameSoundDevice.h
// Author: Christopher ML Zumwalt May ([email protected])
// Description: Manages the game producer. The class may change with out
// notice and was only inteneded for use by the GameKit at
// this time. Use at your own risk.
//------------------------------------------------------------------------------
#ifndef _GAMESOUNDDEVICE_H #ifndef _GAMESOUNDDEVICE_H
#define _GAMESOUNDDEVICE_H #define _GAMESOUNDDEVICE_H
#include <GameSoundDefs.h> #include <GameSoundDefs.h>
@@ -36,7 +13,12 @@ class BMediaNode;
class GameSoundBuffer; class GameSoundBuffer;
struct Connection; struct Connection;
class BGameSoundDevice {
class BGameSoundDevice {
public:
static BGameSoundDevice* GetDefaultDevice();
static void ReleaseDevice();
public: public:
BGameSoundDevice(); BGameSoundDevice();
virtual ~BGameSoundDevice(); virtual ~BGameSoundDevice();
@@ -87,7 +69,5 @@ private:
GameSoundBuffer ** fSounds; GameSoundBuffer ** fSounds;
}; };
BGameSoundDevice* GetDefaultDevice();
void ReleaseDevice();
#endif #endif