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