disable node stopping on the system mixer
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3432 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5014c4dcdd
commit
545124e6a1
@ -231,7 +231,8 @@ AudioMixer::AudioMixer(BMediaAddOn *addOn)
|
|||||||
fFramesSent(0),
|
fFramesSent(0),
|
||||||
fOutputEnabled(true),
|
fOutputEnabled(true),
|
||||||
fBufferGroup(NULL),
|
fBufferGroup(NULL),
|
||||||
fNextFreeID(1)
|
fNextFreeID(1),
|
||||||
|
fDisableStop(false)
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -289,6 +290,22 @@ AudioMixer::~AudioMixer()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioMixer::DisableNodeStop()
|
||||||
|
{
|
||||||
|
fDisableStop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioMixer::Stop(bigtime_t performance_time, bool immediate)
|
||||||
|
{
|
||||||
|
if (fDisableStop) {
|
||||||
|
printf("AudioMixer STOP is disabled\n");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
BMediaEventLooper::Stop(performance_time, immediate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// BMediaNode methods
|
// BMediaNode methods
|
||||||
//
|
//
|
||||||
@ -522,6 +539,7 @@ AudioMixer::DisposeInputCookie(int32 cookie)
|
|||||||
void
|
void
|
||||||
AudioMixer::BufferReceived(BBuffer *buffer)
|
AudioMixer::BufferReceived(BBuffer *buffer)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (buffer->Header()->type == B_MEDIA_PARAMETERS) {
|
if (buffer->Header()->type == B_MEDIA_PARAMETERS) {
|
||||||
printf("Control Buffer Received\n");
|
printf("Control Buffer Received\n");
|
||||||
ApplyParameterData(buffer->Data(), buffer->SizeUsed());
|
ApplyParameterData(buffer->Data(), buffer->SizeUsed());
|
||||||
@ -544,15 +562,16 @@ AudioMixer::BufferReceived(BBuffer *buffer)
|
|||||||
void
|
void
|
||||||
AudioMixer::HandleInputBuffer(BBuffer *buffer, bigtime_t lateness)
|
AudioMixer::HandleInputBuffer(BBuffer *buffer, bigtime_t lateness)
|
||||||
{
|
{
|
||||||
|
static char lastIndata = 0;
|
||||||
media_header *hdr = buffer->Header();
|
media_header *hdr = buffer->Header();
|
||||||
|
|
||||||
// printf("latency = %12Ld, event = %12Ld, sched = %5Ld, arrive at %12Ld, now %12Ld, current lateness %12Ld\n", EventLatency() + SchedulingLatency(), EventLatency(), SchedulingLatency(), buffer->Header()->start_time, TimeSource()->Now(), lateness);
|
// printf("latency = %12Ld, event = %12Ld, sched = %5Ld, arrive at %12Ld, now %12Ld, current lateness %12Ld\n", EventLatency() + SchedulingLatency(), EventLatency(), SchedulingLatency(), buffer->Header()->start_time, TimeSource()->Now(), lateness);
|
||||||
|
|
||||||
// check input
|
// check input
|
||||||
int inputcount = fMixerInputs.CountItems();
|
int inputcount = fMixerInputs.CountItems();
|
||||||
|
//if (inputcount == 0)
|
||||||
|
// printf("**** input count == 0\n");
|
||||||
for (int i = 0; i < inputcount; i++) {
|
for (int i = 0; i < inputcount; i++) {
|
||||||
|
|
||||||
mixer_input *channel = (mixer_input *)fMixerInputs.ItemAt(i);
|
mixer_input *channel = (mixer_input *)fMixerInputs.ItemAt(i);
|
||||||
|
|
||||||
if (channel->fInput.destination.id != hdr->destination)
|
if (channel->fInput.destination.id != hdr->destination)
|
||||||
@ -586,6 +605,11 @@ AudioMixer::HandleInputBuffer(BBuffer *buffer, bigtime_t lateness)
|
|||||||
|
|
||||||
char *indata = (char *)buffer->Data();
|
char *indata = (char *)buffer->Data();
|
||||||
|
|
||||||
|
//if (indata[0] != lastIndata) {
|
||||||
|
// printf("**** inbuffer changed to %d\n", indata[0]);
|
||||||
|
// lastIndata = indata[0];
|
||||||
|
//}
|
||||||
|
|
||||||
if (buffer->SizeUsed() > (channel->fDataSize - total_offset))
|
if (buffer->SizeUsed() > (channel->fDataSize - total_offset))
|
||||||
{
|
{
|
||||||
memcpy(channel->fData + total_offset, indata, channel->fDataSize - total_offset);
|
memcpy(channel->fData + total_offset, indata, channel->fDataSize - total_offset);
|
||||||
@ -627,6 +651,14 @@ AudioMixer::SendNewBuffer(bigtime_t event_time)
|
|||||||
outheader->time_source = TimeSource()->ID();
|
outheader->time_source = TimeSource()->ID();
|
||||||
outheader->start_time = event_time;
|
outheader->start_time = event_time;
|
||||||
|
|
||||||
|
//static char lastOutdata = 0;
|
||||||
|
//char *outdata = (char *)outbuffer->Data();
|
||||||
|
//if (outdata[0] != lastOutdata) {
|
||||||
|
// printf("**** outbuffer changed to %d\n", outdata[0]);
|
||||||
|
// lastOutdata = outdata[0];
|
||||||
|
//}
|
||||||
|
//printf("**** send new buffer *******\n");
|
||||||
|
|
||||||
bigtime_t start2 = system_time();
|
bigtime_t start2 = system_time();
|
||||||
if (B_OK != SendBuffer(outbuffer, fOutput.destination)) {
|
if (B_OK != SendBuffer(outbuffer, fOutput.destination)) {
|
||||||
printf("AudioMixer: Could not send buffer to output : %s\n", fOutput.name);
|
printf("AudioMixer: Could not send buffer to output : %s\n", fOutput.name);
|
||||||
|
@ -36,6 +36,9 @@ class AudioMixer :
|
|||||||
AudioMixer(BMediaAddOn *addOn);
|
AudioMixer(BMediaAddOn *addOn);
|
||||||
~AudioMixer();
|
~AudioMixer();
|
||||||
|
|
||||||
|
|
||||||
|
void DisableNodeStop();
|
||||||
|
|
||||||
// AudioMixer support
|
// AudioMixer support
|
||||||
|
|
||||||
bool IsValidDest( media_destination dest);
|
bool IsValidDest( media_destination dest);
|
||||||
@ -177,6 +180,9 @@ class AudioMixer :
|
|||||||
|
|
||||||
virtual void NodeRegistered();
|
virtual void NodeRegistered();
|
||||||
|
|
||||||
|
virtual void Stop(bigtime_t performance_time,
|
||||||
|
bool immediate);
|
||||||
|
|
||||||
void HandleEvent( const media_timed_event *event,
|
void HandleEvent( const media_timed_event *event,
|
||||||
bigtime_t lateness,
|
bigtime_t lateness,
|
||||||
bool realTimeEvent = false);
|
bool realTimeEvent = false);
|
||||||
@ -215,6 +221,8 @@ class AudioMixer :
|
|||||||
|
|
||||||
int fNextFreeID;
|
int fNextFreeID;
|
||||||
|
|
||||||
|
bool fDisableStop;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -263,7 +263,7 @@ AudioMixer::FillMixBuffer(void *outbuffer, size_t ioSize)
|
|||||||
} else if (mix) {
|
} else if (mix) {
|
||||||
printf("#### FillMixBuffer(): 4.Should mix from B_AUDIO_SHORT!\n");
|
printf("#### FillMixBuffer(): 4.Should mix from B_AUDIO_SHORT!\n");
|
||||||
} else {
|
} else {
|
||||||
printf("#### FillMixBuffer(): 4.Should copy from B_AUDIO_SHORT!\n");
|
// printf("#### FillMixBuffer(): 4.Should copy from B_AUDIO_SHORT!\n");
|
||||||
int baseOffset = channel->fEventOffset / 2;
|
int baseOffset = channel->fEventOffset / 2;
|
||||||
int maxOffset = int(channel->fDataSize / 2);
|
int maxOffset = int(channel->fDataSize / 2);
|
||||||
|
|
||||||
|
@ -110,6 +110,12 @@ AudioMixerAddon::AutoStart(int in_index, BMediaNode ** out_node,
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
*out_internal_id = 0;
|
*out_internal_id = 0;
|
||||||
*out_node = new AudioMixer(this);
|
AudioMixer *mixer = new AudioMixer(this);
|
||||||
|
|
||||||
|
// disable stop on the auto started (system) mixer
|
||||||
|
mixer->DisableNodeStop();
|
||||||
|
|
||||||
|
*out_node = mixer;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user