Some more code styles fixes, thanks axe
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32619 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -118,7 +118,7 @@ BGameSoundDevice::~BGameSoundDevice()
|
|||||||
// release our references to the nodes that we're using. We *are*
|
// release our references to the nodes that we're using. We *are*
|
||||||
// supposed to do that even for global nodes like the Mixer.
|
// supposed to do that even for global nodes like the Mixer.
|
||||||
roster->Disconnect(fConnection->producer.node, fConnection->source,
|
roster->Disconnect(fConnection->producer.node, fConnection->source,
|
||||||
fConnection->consumer.node, fConnection->destination);
|
fConnection->consumer.node, fConnection->destination);
|
||||||
|
|
||||||
roster->ReleaseNode(fConnection->producer);
|
roster->ReleaseNode(fConnection->producer);
|
||||||
roster->ReleaseNode(fConnection->consumer);
|
roster->ReleaseNode(fConnection->consumer);
|
||||||
@@ -159,7 +159,7 @@ BGameSoundDevice::SetInitError(status_t error)
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
BGameSoundDevice::CreateBuffer(gs_id* sound, const gs_audio_format* format,
|
BGameSoundDevice::CreateBuffer(gs_id* sound, const gs_audio_format* format,
|
||||||
const void* data, int64 frames)
|
const void* data, int64 frames)
|
||||||
{
|
{
|
||||||
if (frames <= 0 || !sound)
|
if (frames <= 0 || !sound)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -180,7 +180,7 @@ BGameSoundDevice::CreateBuffer(gs_id* sound, const gs_audio_format* format,
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
BGameSoundDevice::CreateBuffer(gs_id* sound, const void* object,
|
BGameSoundDevice::CreateBuffer(gs_id* sound, const void* object,
|
||||||
const gs_audio_format* format)
|
const gs_audio_format* format)
|
||||||
{
|
{
|
||||||
if (!object || !sound)
|
if (!object || !sound)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -276,7 +276,7 @@ BGameSoundDevice::IsPlaying(gs_id sound)
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
BGameSoundDevice::GetAttributes(gs_id sound, gs_attribute* attributes,
|
BGameSoundDevice::GetAttributes(gs_id sound, gs_attribute* attributes,
|
||||||
size_t attributeCount)
|
size_t attributeCount)
|
||||||
{
|
{
|
||||||
if (!fSounds[sound - 1])
|
if (!fSounds[sound - 1])
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -287,7 +287,7 @@ BGameSoundDevice::GetAttributes(gs_id sound, gs_attribute* attributes,
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
BGameSoundDevice::SetAttributes(gs_id sound, gs_attribute* attributes,
|
BGameSoundDevice::SetAttributes(gs_id sound, gs_attribute* attributes,
|
||||||
size_t attributeCount)
|
size_t attributeCount)
|
||||||
{
|
{
|
||||||
if (!fSounds[sound - 1])
|
if (!fSounds[sound - 1])
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -309,13 +309,13 @@ BGameSoundDevice::Connect()
|
|||||||
dormant_node_info mixer_dormant_info;
|
dormant_node_info mixer_dormant_info;
|
||||||
int32 mixer_count = 1; // for now, we only care about the first we find.
|
int32 mixer_count = 1; // for now, we only care about the first we find.
|
||||||
status_t err = roster->GetDormantNodes(&mixer_dormant_info,
|
status_t err = roster->GetDormantNodes(&mixer_dormant_info,
|
||||||
&mixer_count, 0, 0, 0, B_SYSTEM_MIXER, 0);
|
&mixer_count, 0, 0, 0, B_SYSTEM_MIXER, 0);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
//fMixer = new media_node;
|
//fMixer = new media_node;
|
||||||
err = roster->InstantiateDormantNode(mixer_dormant_info,
|
err = roster->InstantiateDormantNode(mixer_dormant_info,
|
||||||
&fConnection->producer);
|
&fConnection->producer);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -327,20 +327,20 @@ BGameSoundDevice::Connect()
|
|||||||
int32 count = 1;
|
int32 count = 1;
|
||||||
media_input mixerInput;
|
media_input mixerInput;
|
||||||
err = roster->GetFreeInputsFor(fConnection->consumer, &mixerInput, 1,
|
err = roster->GetFreeInputsFor(fConnection->consumer, &mixerInput, 1,
|
||||||
&count);
|
&count);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
count = 1;
|
count = 1;
|
||||||
media_output mixerOutput;
|
media_output mixerOutput;
|
||||||
err = roster->GetFreeOutputsFor(fConnection->producer, &mixerOutput, 1,
|
err = roster->GetFreeOutputsFor(fConnection->producer, &mixerOutput, 1,
|
||||||
&count);
|
&count);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
media_format format(mixerOutput.format);
|
media_format format(mixerOutput.format);
|
||||||
err = roster->Connect(mixerOutput.source, mixerInput.destination,
|
err = roster->Connect(mixerOutput.source, mixerInput.destination,
|
||||||
&format, &mixerOutput, &mixerInput);
|
&format, &mixerOutput, &mixerInput);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -348,18 +348,18 @@ BGameSoundDevice::Connect()
|
|||||||
// the Mixer uses too.
|
// the Mixer uses too.
|
||||||
roster->GetTimeSource(&fConnection->timeSource);
|
roster->GetTimeSource(&fConnection->timeSource);
|
||||||
roster->SetTimeSourceFor(fConnection->producer.node,
|
roster->SetTimeSourceFor(fConnection->producer.node,
|
||||||
fConnection->timeSource.node);
|
fConnection->timeSource.node);
|
||||||
|
|
||||||
// Start our mixer's time source if need be. Chances are, it won't need to
|
// Start our mixer's time source if need be. Chances are, it won't need to
|
||||||
// be, but if we forget to do this, our mixer might not do anything at all.
|
// be, but if we forget to do this, our mixer might not do anything at all.
|
||||||
BTimeSource* mixerTimeSource = roster->MakeTimeSourceFor(
|
BTimeSource* mixerTimeSource = roster->MakeTimeSourceFor(
|
||||||
fConnection->producer);
|
fConnection->producer);
|
||||||
if (!mixerTimeSource)
|
if (!mixerTimeSource)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
if (!mixerTimeSource->IsRunning()) {
|
if (!mixerTimeSource->IsRunning()) {
|
||||||
status_t err = roster->StartNode(mixerTimeSource->Node(),
|
status_t err = roster->StartNode(mixerTimeSource->Node(),
|
||||||
BTimeSource::RealTime());
|
BTimeSource::RealTime());
|
||||||
if (err != B_OK) {
|
if (err != B_OK) {
|
||||||
mixerTimeSource->Release();
|
mixerTimeSource->Release();
|
||||||
return err;
|
return err;
|
||||||
@@ -382,7 +382,7 @@ BGameSoundDevice::Connect()
|
|||||||
|
|
||||||
// Set an appropriate run mode for the producer
|
// Set an appropriate run mode for the producer
|
||||||
roster->SetRunModeNode(fConnection->producer,
|
roster->SetRunModeNode(fConnection->producer,
|
||||||
BMediaNode::B_INCREASE_LATENCY);
|
BMediaNode::B_INCREASE_LATENCY);
|
||||||
|
|
||||||
media_to_gs_format(&fFormat, &format.u.raw_audio);
|
media_to_gs_format(&fFormat, &format.u.raw_audio);
|
||||||
fIsConnected = true;
|
fIsConnected = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user