Style fixes to the Game Kit, focus on docs

This commit is contained in:
John Scipione
2014-06-11 16:44:48 -04:00
parent ac9714d8a4
commit 37fedaf849
6 changed files with 216 additions and 229 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2008, Haiku.
* Copyright 2001-2008 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -90,7 +90,7 @@ class BDirectWindow : public BWindow {
virtual void Hide();
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 form, const char *property);
int32 what, const char* property);
virtual status_t GetSupportedSuites(BMessage* data);
virtual status_t Perform(perform_code code, void* arg);
-1
View File
@@ -102,7 +102,6 @@ private:
bool fPaused;
float fPauseGain;
uint32 _reserved[9];
};
+7 -6
View File
@@ -1,10 +1,10 @@
/*
* Copyright 2003-2009, Haiku Inc.
* Copyright 2003-2009 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stefano Ceccherini <[email protected]>
* Carwyn Jones <[email protected]>
*
* Distributed under the terms of the MIT License.
*/
@@ -311,10 +311,11 @@ BDirectWindow::Hide()
BHandler*
BDirectWindow::ResolveSpecifier(BMessage *msg, int32 index,
BMessage *specifier, int32 form, const char *property)
BDirectWindow::ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 what, const char* property)
{
return inherited::ResolveSpecifier(msg, index, specifier, form, property);
return inherited::ResolveSpecifier(message, index, specifier, what,
property);
}
+1 -2
View File
@@ -321,8 +321,7 @@ BFileGameSound::FillBuffer(void *inBuffer, size_t inByteCount)
status_t
BFileGameSound::Perform(int32 selector,
void *data)
BFileGameSound::Perform(int32 selector, void* data)
{
return B_ERROR;
}
+16 -16
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 Haiku, Inc. All rights reserved.
* Copyright 2002-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -7,7 +7,7 @@
*/
/*! A MediaKit producer node which mixes sound from the GameKit
/* A MediaKit producer node which mixes sound from the GameKit
and sends them to the audio mixer
*/
@@ -90,13 +90,13 @@ GameProducer::AddOn(int32 *internal_id) const
// BBufferProducer methods
status_t
GameProducer::GetNextOutput(int32* cookie, media_output* out_output)
GameProducer::GetNextOutput(int32* cookie, media_output* _output)
{
// we currently support only one output
if (0 != *cookie)
return B_BAD_INDEX;
*out_output = fOutput;
*_output = fOutput;
*cookie += 1;
return B_OK;
}
@@ -169,7 +169,7 @@ GameProducer::FormatProposal(const media_source& output, media_format* format)
status_t
GameProducer::PrepareToConnect(const media_source& what,
const media_destination& where, media_format* format,
media_source* out_source, char* out_name)
media_source* _source, char* out_name)
{
// The format has been processed by the consumer at this point. We need
// to insure the format is still acceptable and any wild care are filled in.
@@ -201,7 +201,7 @@ GameProducer::PrepareToConnect(const media_source& what,
// Now reserve the connection, and return information about it
fOutput.destination = where;
fOutput.format = *format;
*out_source = fOutput.source;
*_source = fOutput.source;
strlcpy(out_name, fOutput.name, B_MEDIA_NAME_LENGTH);
return B_OK;
}
@@ -210,7 +210,7 @@ GameProducer::PrepareToConnect(const media_source& what,
void
GameProducer::Connect(status_t error, const media_source& source,
const media_destination& destination, const media_format& format,
char* io_name)
char* ioName)
{
// If something earlier failed, Connect() might still be called, but with a
// non-zero error code. When that happens we simply unreserve the
@@ -225,7 +225,7 @@ GameProducer::Connect(status_t error, const media_source& source,
// format that we agreed on, and report our connection name again.
fOutput.destination = destination;
fOutput.format = format;
strlcpy(io_name, fOutput.name, B_MEDIA_NAME_LENGTH);
strlcpy(ioName, fOutput.name, B_MEDIA_NAME_LENGTH);
// Now that we're connected, we can determine our downstream latency.
// Do so, then make sure we get our events early enough.
@@ -297,11 +297,11 @@ GameProducer::FormatChangeRequested(const media_source& source,
status_t
GameProducer::SetBufferGroup(const media_source& for_source,
GameProducer::SetBufferGroup(const media_source& forSource,
BBufferGroup* newGroup)
{
// verify that we didn't get bogus arguments before we proceed
if (for_source != fOutput.source)
if (forSource != fOutput.source)
return B_MEDIA_BAD_SOURCE;
// Are we being passed the buffer group we're already using?
@@ -337,17 +337,17 @@ GameProducer::SetBufferGroup(const media_source& for_source,
status_t
GameProducer::GetLatency(bigtime_t* out_latency)
GameProducer::GetLatency(bigtime_t* _latency)
{
// report our *total* latency: internal plus downstream plus scheduling
*out_latency = EventLatency() + SchedulingLatency();
*_latency = EventLatency() + SchedulingLatency();
return B_OK;
}
void
GameProducer::LateNoticeReceived(const media_source& what, bigtime_t how_much,
bigtime_t performance_time)
GameProducer::LateNoticeReceived(const media_source& what, bigtime_t howMuch,
bigtime_t performanceDuration)
{
// If we're late, we need to catch up. Respond in a manner appropriate to
// our current run mode.
@@ -363,7 +363,7 @@ GameProducer::LateNoticeReceived(const media_source& what, bigtime_t how_much,
// downstream nodes are not properly reporting their latency, but
// there's not much we can do about that at the moment, so we try
// to start producing buffers earlier to compensate.
fInternalLatency += how_much;
fInternalLatency += howMuch;
SetEventLatency(fLatency + fInternalLatency);
} else {
// The other run modes dictate various strategies for sacrificing
@@ -393,7 +393,7 @@ GameProducer::LatencyChanged(const media_source& source,
status_t
GameProducer::SetPlayRate(int32 numer, int32 denom)
GameProducer::SetPlayRate(int32 numerator, int32 denominator)
{
// Play rates are weird. We don't support them
return B_ERROR;
+19 -31
View File
@@ -24,29 +24,19 @@
// Description: A MediaKit producer node which mixes sound from the GameKit
// and sends them to the audio mixer
//------------------------------------------------------------------------------
#ifndef _GAME_PRODUCER_H
#define _GAME_PRODUCER_H
#ifndef _GAMEPRODUCER_H
#define _GAMEPRODUCER_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <media/BufferProducer.h>
#include <media/MediaEventLooper.h>
#include <GameSoundDefs.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class GameSoundBuffer;
// GameProducer class -------------------------------------------------------------
class GameProducer : public BBufferProducer, public BMediaEventLooper
{
class GameProducer : public BBufferProducer, public BMediaEventLooper {
public:
GameProducer(GameSoundBuffer* object,
const gs_audio_format * format);
@@ -57,8 +47,7 @@ public:
// BBufferProducer methods
status_t FormatSuggestionRequested(media_type type,
int32 quality,
media_format* format);
int32 quality, media_format* format);
status_t FormatProposal(const media_source& output,
media_format* format);
@@ -69,44 +58,41 @@ public:
int32* _deprecated_);
status_t GetNextOutput(int32* cookie,
media_output* out_output);
media_output* _output);
status_t DisposeOutputCookie(int32 cookie);
status_t SetBufferGroup(const media_source& for_source,
status_t SetBufferGroup(const media_source& forSource,
BBufferGroup* group);
status_t GetLatency(bigtime_t* out_latency);
status_t GetLatency(bigtime_t* _latency);
status_t PrepareToConnect(const media_source& what,
const media_destination& where,
media_format* format,
media_source* out_source,
media_source* _source,
char* out_name);
void Connect(status_t error,
const media_source& source,
const media_destination& destination,
const media_format& format,
char* io_name);
char* ioName);
void Disconnect(const media_source& what,
const media_destination& where);
void LateNoticeReceived(const media_source& what,
bigtime_t how_much,
bigtime_t performance_time);
bigtime_t howMuch,
bigtime_t performanceDuration);
void EnableOutput(const media_source & what,
bool enabled,
int32* _deprecated_);
bool enabled, int32* _deprecated_);
status_t SetPlayRate(int32 numer,
int32 denom);
status_t SetPlayRate(int32 numerator, int32 denominator);
status_t HandleMessage(int32 message,
const void* data,
status_t HandleMessage(int32 message, const void* data,
size_t size);
void AdditionalBufferRequested(const media_source& source,
@@ -137,7 +123,8 @@ private:
BBuffer* FillNextBuffer(bigtime_t event_time);
BBufferGroup* fBufferGroup;
bigtime_t fLatency, fInternalLatency;
bigtime_t fLatency;
bigtime_t fInternalLatency;
media_output fOutput;
bool fOutputEnabled;
media_format fPreferredFormat;
@@ -149,4 +136,5 @@ private:
size_t fBufferSize;
};
#endif
#endif // _GAME_PRODUCER_H