A MediaKit producer node which mixes sound from the GameKit and sends them to the audio mixer. More...
Inherits BBufferProducer, and BMediaEventLooper.
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. | |
BMediaAddOn * | AddOn (int32 *internal_id) const |
Unimplemented. | |
void | Connect (status_t error, const media_source &source, const media_destination &destination, const media_format &format, char *ioName) |
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 *_latency) |
Gets the total latency, including internal downstream plus scheduling. | |
status_t | GetNextOutput (int32 *cookie, media_output *_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 howMuch, bigtime_t performanceDuration) |
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 *_source, char *out_name) |
Confirms that the media format and wild cards are valid. | |
status_t | SetBufferGroup (const media_source &forSource, BBufferGroup *group) |
Changes the buffer group from the current one, to the specified one. | |
status_t | SetPlayRate (int32 numerator, int32 denominator) |
Play rates are not supported, returns B_ERROR . | |
void | SetRunMode (run_mode mode) |
Offline mode is not supported. | |
A MediaKit producer node which mixes sound from the GameKit and sends them to the audio mixer.
GameProducer::GameProducer | ( | GameSoundBuffer * | object, |
const gs_audio_format * | format | ||
) |
Initializes the GameProducer with the passed in GameSoundBuffer and gs_audio_format.
object | The GameSoundBuffer to 'sync' the GameProducer with. |
format | The gs_audio_format to set the GameProducer's format. |
GameProducer::~GameProducer | ( | ) |
Destroys the GameProducer object and stops the BMediaEventLooper thread.
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.
source | The media output source. |
prev_buffer | The previous buffer. |
prev_time | The previous buffer time. |
prev_tag | The previous buffer delimiter. |
|
virtual |
void GameProducer::Connect | ( | status_t | error, |
const media_source & | source, | ||
const media_destination & | destination, | ||
const media_format & | format, | ||
char * | ioName | ||
) |
Connects to the output device.
error | The variable that holds an error, should one arise. |
source | The output source to connect to. |
destination | The media destination, that is connected to. |
format | The variable that holds the format type. |
ioName | The variable that holds the output name. |
void GameProducer::Disconnect | ( | const media_source & | what, |
const media_destination & | where | ||
) |
Disconnects from the output device.
what | The media destination. |
where | The media's output source. |
Does nothing because the cookie has no use as of yet.
cookie | The cookie index. |
void GameProducer::EnableOutput | ( | const media_source & | what, |
bool | enabled, | ||
int32 * | _deprecated_ | ||
) |
Enable or disable an output.
what | The media output source. |
enabled | Sets 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.
source | The output source. |
destination | The media's destination. |
io_format | The format of the media |
_deprecated_ | This method is deprecated. |
status_t GameProducer::FormatProposal | ( | const media_source & | output, |
media_format * | format | ||
) |
Attempts to change the media format.
output | The source that the media outputs to. |
format | The type of media being proposed. |
B_OK | The format is supported. |
B_MEDIA_BAD_SOURCE | The output doesn't match the current output source. |
B_MEDIA_BAD_FORMAT | The 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.
type | The media format being tested. |
quality | The quality of the media – Not used in the method. |
format | The media format to send through. |
B_OK | type is supported. |
B_BAD_VALUE | No format was received. |
B_MEDIA_BAD_FORMAT | The format is not supported. |
Gets the total latency, including internal downstream plus scheduling.
_latency | Gets set to the current latency. |
Gets the next output cookie.
Cookie can only be zero, as GameProducer supports one output.
cookie | The output cookie value. |
_output | The output that the cookie represents. |
B_OK | The cookie was successfully incremented. |
B_BAD_INDEX | The cookie is not equal to zero. |
|
virtual |
Handles when an event is triggered.
event | The type of event. |
lateness | Unused. |
realTimeEvent | Unused. |
Implements BMediaEventLooper.
Private messages are not supported, returns B_ERROR
.
message | The message to be sent. |
data | The data to be sent. |
size | The size of the message. |
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.
source | The media output source. |
destination | The connected output destination. |
new_latency | The new amount of latency. |
flags | Unused. |
void GameProducer::LateNoticeReceived | ( | const media_source & | what, |
bigtime_t | howMuch, | ||
bigtime_t | performanceDuration | ||
) |
Attempts to catch up to the buffer.
what | The media output source. |
howMuch | The amount of 'lateness'. |
performanceDuration | Unused. |
|
virtual |
Handles when an output source node is registered.
Reimplemented from BMediaEventLooper.
status_t GameProducer::PrepareToConnect | ( | const media_source & | what, |
const media_destination & | where, | ||
media_format * | format, | ||
media_source * | _source, | ||
char * | out_name | ||
) |
Confirms that the media format and wild cards are valid.
what | The media source to output to. |
where | The destination for the connection. |
format | The format to finish specializing. |
_source | The output source that the method retrieves. |
out_name | The variable that holds the output name. |
B_OK | The connection preparations have finished. |
B_MEDIA_BAD_SOURCE | The output doesn't match the current output source. |
B_MEDIA_ALREADY_CONNECTED | The GameProducer is already connected. |
B_MEDIA_BAD_FORMAT | The format is not supported. |
status_t GameProducer::SetBufferGroup | ( | const media_source & | forSource, |
BBufferGroup * | newGroup | ||
) |
Changes the buffer group from the current one, to the specified one.
forSource | The output source. Can't be equivalent to the current output source. |
newGroup | The new BBufferGroup to assign the buffer group to. |
B_OK | The change has succeeded. |
B_MEDIA_BAD_SOURCE | forSource is equal to the current output source. |
B_BAD_VALUE | The new BBufferGroup's buffer list returns an error. |
Play rates are not supported, returns B_ERROR
.
numerator | The top part of the fraction. |
denominator | The bottom part of the fraction. |
B_ERROR
since play rates aren't supported.
|
virtual |
Offline mode is not supported.
mode | The mode of running. |
Reimplemented from BMediaEventLooper.