Public Member Functions
GameProducer Class Reference

A MediaKit producer node which mixes sound from the GameKit and sends them to the audio mixer. More...

Inheritance diagram for GameProducer:
BMediaEventLooper BMediaNode

List of all members.

Public Member Functions

 GameProducer (GameSoundBuffer *object, const gs_audio_format *format)
 Initializes the GameProducer with the passed in GameSoundBuffer and gs_audio_format.
 ~GameProducer ()
 Destroys the GameProducer object and stops the BMediaEventLooper thread.
void AdditionalBufferRequested (const media_source &source, media_buffer_id prev_buffer, bigtime_t prev_time, const media_seek_tag *prev_tag)
 Offline modes are not supported for now, does nothing.
BMediaAddOnAddOn (int32 *internal_id) const
 Unimplemented.
void Connect (status_t error, const media_source &source, const media_destination &destination, const media_format &format, char *io_name)
 Connects to the output device.
void Disconnect (const media_source &what, const media_destination &where)
 Disconnects from the output device.
status_t DisposeOutputCookie (int32 cookie)
 Does nothing because the cookie has no use as of yet.
void EnableOutput (const media_source &what, bool enabled, int32 *_deprecated_)
 Enable or disable an output.
status_t FormatChangeRequested (const media_source &source, const media_destination &destination, media_format *io_format, int32 *_deprecated_)
 We don't support any other formats, so we just reject any format changes.
status_t FormatProposal (const media_source &output, media_format *format)
 Attempts to change the media format.
status_t FormatSuggestionRequested (media_type type, int32 quality, media_format *format)
 Checks if a certain media format works with the GameProducer.
status_t GetLatency (bigtime_t *out_latency)
 Gets the total latency, including internal downstream plus scheduling.
status_t GetNextOutput (int32 *cookie, media_output *out_output)
 Gets the next output cookie.
void HandleEvent (const media_timed_event *event, bigtime_t lateness, bool realTimeEvent=false)
 Handles when an event is triggered.
status_t HandleMessage (int32 message, const void *data, size_t size)
 Private messages are not supported, returns B_ERROR.
void LatencyChanged (const media_source &source, const media_destination &destination, bigtime_t new_latency, uint32 flags)
 Sets the event latency in the case that the latency changed.
void LateNoticeReceived (const media_source &what, bigtime_t how_much, bigtime_t performance_time)
 Attempts to catch up to the buffer.
void NodeRegistered ()
 Handles when an output source node is registered.
status_t PrepareToConnect (const media_source &what, const media_destination &where, media_format *format, media_source *out_source, char *out_name)
 Confirms that the media format and wild cards are valid.
status_t SetBufferGroup (const media_source &for_source, BBufferGroup *group)
 Changes the buffer group from the current one, to the specified one.
status_t SetPlayRate (int32 numer, int32 denom)
 Play rates are not supported, returns B_ERROR.
void SetRunMode (run_mode mode)
 Offline mode is not supported.

Detailed Description

A MediaKit producer node which mixes sound from the GameKit and sends them to the audio mixer.


Constructor & Destructor Documentation

GameProducer::GameProducer ( GameSoundBuffer *  object,
const gs_audio_format *  format 
)

Initializes the GameProducer with the passed in GameSoundBuffer and gs_audio_format.

Parameters:
objectThe GameSoundBuffer to 'sync' the GameProducer with.
formatThe gs_audio_format to set the GameProducer's format.

Member Function Documentation

void GameProducer::AdditionalBufferRequested ( const media_source &  source,
media_buffer_id  prev_buffer,
bigtime_t  prev_time,
const media_seek_tag *  prev_tag 
)

Offline modes are not supported for now, does nothing.

Parameters:
sourceThe media output source.
prev_bufferThe previous buffer.
prev_timeThe previous buffer time.
prev_tagThe previous buffer delimiter.
void GameProducer::Connect ( status_t  error,
const media_source &  source,
const media_destination &  destination,
const media_format &  format,
char *  io_name 
)

Connects to the output device.

Parameters:
errorThe variable that holds an error, should one arise.
sourceThe output source to connect to.
destinationThe media destination, that is connected to.
formatThe variable that holds the format type.
io_nameThe variable that holds the output name.
void GameProducer::Disconnect ( const media_source &  what,
const media_destination &  where 
)

Disconnects from the output device.

Parameters:
whatThe media destination.
whereThe media's output source.
status_t GameProducer::DisposeOutputCookie ( int32  cookie)

Does nothing because the cookie has no use as of yet.

Parameters:
cookieThe cookie index.
Returns:
Always returns B_OK.
void GameProducer::EnableOutput ( const media_source &  what,
bool  enabled,
int32 *  _deprecated_ 
)

Enable or disable an output.

Attention:
This method is deprecated.
Parameters:
whatThe media output source.
enabledSets the output to enabled or disabled.
_deprecated_This method is deprecated.
status_t GameProducer::FormatChangeRequested ( const media_source &  source,
const media_destination &  destination,
media_format *  io_format,
int32 *  _deprecated_ 
)

We don't support any other formats, so we just reject any format changes.

Attention:
This method is deprecated.
Parameters:
sourceThe output source.
destinationThe media's destination.
io_formatThe format of the media
_deprecated_This method is deprecated.
Returns:
B_ERROR as this function is deprecated, it has been removed, and now only returns B_ERROR.
status_t GameProducer::FormatProposal ( const media_source &  output,
media_format *  format 
)

Attempts to change the media format.

Warning:
Only supports raw audio and wildcard audio types.
Parameters:
outputThe source that the media outputs to.
formatThe type of media being proposed.
Returns:
A status code.
Return values:
B_OKThe format is supported.
B_MEDIA_BAD_SOURCEThe output doesn't match the current output source.
B_MEDIA_BAD_FORMATThe format is not supported.
status_t GameProducer::FormatSuggestionRequested ( media_type  type,
int32  quality,
media_format *  format 
)

Checks if a certain media format works with the GameProducer.

Warning:
Only supports raw audio at this point.
Parameters:
typeThe media format being tested.
qualityThe quality of the media -- Not used in the method.
formatThe media format to send through.
Returns:
A status code.
Return values:
B_OKtype is supported.
B_BAD_VALUENo format was received.
B_MEDIA_BAD_FORMATThe format is not supported.
status_t GameProducer::GetLatency ( bigtime_t out_latency)

Gets the total latency, including internal downstream plus scheduling.

Parameters:
out_latencyGets set to the current latency.
Returns:
B_OK.
status_t GameProducer::GetNextOutput ( int32 *  cookie,
media_output *  out_output 
)

Gets the next output cookie.

Cookie can only be zero, as GameProducer supports one output.

Parameters:
cookieThe output cookie value.
out_outputThe output that the cookie represents.
Returns:
A status code.
Return values:
B_OKThe cookie was successfully incremented.
B_BAD_INDEXThe cookie is not equal to zero.
void GameProducer::HandleEvent ( const media_timed_event *  event,
bigtime_t  lateness,
bool  realTimeEvent = false 
) [virtual]

Handles when an event is triggered.

Parameters:
eventThe type of event.
latenessUnused.
realTimeEventUnused.

Implements BMediaEventLooper.

status_t GameProducer::HandleMessage ( int32  message,
const void *  data,
size_t  size 
) [virtual]

Private messages are not supported, returns B_ERROR.

Parameters:
messageThe message to be sent.
dataThe data to be sent.
sizeThe size of the message.
Returns:
Always returns B_ERROR since private messages aren't supported.

Reimplemented from BMediaNode.

void GameProducer::LatencyChanged ( const media_source &  source,
const media_destination &  destination,
bigtime_t  new_latency,
uint32  flags 
)

Sets the event latency in the case that the latency changed.

Parameters:
sourceThe media output source.
destinationThe connected output destination.
new_latencyThe new amount of latency.
flagsUnused.
void GameProducer::LateNoticeReceived ( const media_source &  what,
bigtime_t  how_much,
bigtime_t  performance_time 
)

Attempts to catch up to the buffer.

Parameters:
whatThe media output source.
how_muchThe amount of 'lateness'.
performance_timeUnused.
status_t GameProducer::PrepareToConnect ( const media_source &  what,
const media_destination &  where,
media_format *  format,
media_source *  out_source,
char *  out_name 
)

Confirms that the media format and wild cards are valid.

Parameters:
whatThe media source to output to.
whereThe destination for the connection.
formatThe format to finish specializing.
out_sourceThe output source that the method retrieves.
out_nameThe variable that holds the output name.
Returns:
A status code.
Return values:
B_OKThe connection preparations have finished.
B_MEDIA_BAD_SOURCEThe output doesn't match the current output source.
B_MEDIA_ALREADY_CONNECTEDThe GameProducer is already connected.
B_MEDIA_BAD_FORMATThe format is not supported.
status_t GameProducer::SetBufferGroup ( const media_source &  for_source,
BBufferGroup *  newGroup 
)

Changes the buffer group from the current one, to the specified one.

Parameters:
for_sourceThe output source. Can't be equivalent to the current output source.
newGroupThe new BBufferGroup to assign the buffer group to.
Returns:
A status code.
Return values:
B_OKThe change has succeeded.
B_MEDIA_BAD_SOURCEfor_source is equal to the current output source.
B_BAD_VALUEThe new BBufferGroup's buffer list returns an error.
status_t GameProducer::SetPlayRate ( int32  numer,
int32  denom 
)

Play rates are not supported, returns B_ERROR.

Parameters:
numerThe top part of the fraction.
denomThe bottom part of the fraction.
Returns:
Always returns B_ERROR since play rates aren't supported.
void GameProducer::SetRunMode ( run_mode  mode) [virtual]

Offline mode is not supported.

Parameters:
modeThe mode of running.

Reimplemented from BMediaEventLooper.


The Haiku Book pre-R1 - GameProducer Class Reference
Generated on Sun May 19 2013 by Doxygen 1.7.5.1