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:
* Christopher ML Zumwalt May ([email protected])
*
*/
@@ -30,7 +29,7 @@ BGameSound::BGameSound(BGameSoundDevice *device)
// TODO: device is ignored!
// NOTE: BeBook documents that BGameSoundDevice must currently always
// be NULL...
fDevice = GetDefaultDevice();
fDevice = BGameSoundDevice::GetDefaultDevice();
fInitError = fDevice->InitCheck();
}
@@ -41,7 +40,7 @@ BGameSound::BGameSound(const BGameSound &other)
{
memcpy(&fFormat, &other.fFormat, sizeof(gs_audio_format));
// TODO: device from other is ignored!
fDevice = GetDefaultDevice();
fDevice = BGameSoundDevice::GetDefaultDevice();
fInitError = fDevice->InitCheck();
}
@@ -52,7 +51,7 @@ BGameSound::~BGameSound()
if (fSound >= 0)
fDevice->ReleaseBuffer(fSound);
ReleaseDevice();
BGameSoundDevice::ReleaseDevice();
}
+17 -35
View File
@@ -1,31 +1,17 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, Haiku
//
// 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: 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.
//------------------------------------------------------------------------------
/*
* Copyright 2001-2002, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stefano Ceccherini ([email protected])
* Adrien Destugues (pulkomandy)
* Jérôme Duval (korli)
* Christopher ML Zumwalt May ([email protected])
*/
// 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"
@@ -42,13 +28,10 @@
#include <TimeSource.h>
#include "GameSoundBuffer.h"
#include "GameProducer.h"
#include "GSUtility.h"
// BGameSoundDevice definitions ------------------------------------
const int32 kInitSoundCount = 32;
const int32 kGrowth = 16;
static const int32 kInitSoundCount = 32;
static const int32 kGrowth = 16;
static int32 sDeviceCount = 0;
static BGameSoundDevice* sDevice = NULL;
@@ -56,7 +39,7 @@ static BLocker sDeviceRefCountLock("GameSound device lock");
BGameSoundDevice*
GetDefaultDevice()
BGameSoundDevice::GetDefaultDevice()
{
BAutolock _(sDeviceRefCountLock);
@@ -69,7 +52,7 @@ GetDefaultDevice()
void
ReleaseDevice()
BGameSoundDevice::ReleaseDevice()
{
BAutolock _(sDeviceRefCountLock);
@@ -82,7 +65,6 @@ ReleaseDevice()
}
// BGameSoundDevice -------------------------------------------------------
BGameSoundDevice::BGameSoundDevice()
:
fIsConnected(false),
+11 -31
View File
@@ -1,34 +1,11 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, Haiku
//
// 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.
//------------------------------------------------------------------------------
/*
* Copyright 2001-2002, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GAMESOUNDDEVICE_H
#define _GAMESOUNDDEVICE_H
#include <GameSoundDefs.h>
@@ -36,7 +13,12 @@ class BMediaNode;
class GameSoundBuffer;
struct Connection;
class BGameSoundDevice {
class BGameSoundDevice {
public:
static BGameSoundDevice* GetDefaultDevice();
static void ReleaseDevice();
public:
BGameSoundDevice();
virtual ~BGameSoundDevice();
@@ -87,7 +69,5 @@ private:
GameSoundBuffer ** fSounds;
};
BGameSoundDevice* GetDefaultDevice();
void ReleaseDevice();
#endif