Mixer rewrite, work in progress.
Moved Input and Output handling into the MixerCore class, format and connection negotiation remains in AudioMixer class. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3481 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,8 @@
|
||||
|
||||
// forward declarations
|
||||
|
||||
class mixer_input;
|
||||
class MixerCore;
|
||||
|
||||
|
||||
// includes
|
||||
|
||||
@@ -41,9 +42,6 @@ class AudioMixer :
|
||||
|
||||
// AudioMixer support
|
||||
|
||||
bool IsValidDest( media_destination dest);
|
||||
bool IsValidSource( media_source source);
|
||||
|
||||
|
||||
BParameterWeb * BuildParameterWeb(); // used to create the initial 'master' web
|
||||
void MakeWebForInput(char *name, media_format format);
|
||||
@@ -195,16 +193,7 @@ class AudioMixer :
|
||||
|
||||
private:
|
||||
|
||||
thread_id fThread; // for launching mixthread
|
||||
|
||||
media_output fOutput; // single output (temp)
|
||||
float * fMasterGainScale; // array used for scaling output - _not_ for display!
|
||||
float * fMasterGainDisplay; // array of volume values for display purposes
|
||||
bigtime_t fMasterGainDisplayLastChange;
|
||||
|
||||
int fMasterMuteValue;
|
||||
bigtime_t fMasterMuteValueLastChange;
|
||||
|
||||
|
||||
BMediaAddOn * fAddOn;
|
||||
BParameterWeb * fWeb; // local pointer to parameterweb
|
||||
@@ -214,15 +203,16 @@ class AudioMixer :
|
||||
uint64 fFramesSent; // audio frames sent
|
||||
bool fOutputEnabled;
|
||||
|
||||
media_format fPrefInputFormat, fPrefOutputFormat;
|
||||
BBufferGroup * fBufferGroup;
|
||||
|
||||
BList fMixerInputs;
|
||||
|
||||
int fNextFreeID;
|
||||
|
||||
|
||||
bool fDisableStop;
|
||||
|
||||
MixerCore *fCore;
|
||||
media_format fDefaultFormat;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
SubDir OBOS_TOP src add-ons media media-add-ons mixer ;
|
||||
|
||||
UsePrivateHeaders media ;
|
||||
|
||||
Addon mixer.media_addon : media :
|
||||
AudioMixer.cpp
|
||||
FillMixBuffer.cpp
|
||||
|
||||
@@ -3,8 +3,15 @@
|
||||
#include "MixerInput.h"
|
||||
#include "MixerOutput.h"
|
||||
|
||||
#define MAX_OUTPUT_BUFFER_LENGTH 50000LL /* 50 ms */
|
||||
|
||||
|
||||
MixerCore::MixerCore()
|
||||
: fLocker(new BLocker)
|
||||
: fLocker(new BLocker),
|
||||
fOutputBufferLength(MAX_OUTPUT_BUFFER_LENGTH),
|
||||
fInputBufferLength(3 * MAX_OUTPUT_BUFFER_LENGTH),
|
||||
fOutput(0)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
@@ -36,3 +43,40 @@ MixerCore::RemoveOutput(const media_output &output)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
MixerCore::OutputBufferLengthChanged(bigtime_t length)
|
||||
{
|
||||
Lock();
|
||||
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
MixerInput *
|
||||
MixerCore::Input(int i)
|
||||
{
|
||||
return (MixerInput *)fInputs->ItemAt(i);
|
||||
}
|
||||
|
||||
/*
|
||||
void BufferReceived(BBuffer *buffer, bigtime_t lateness);
|
||||
|
||||
|
||||
if (buffer->SizeUsed() > (channel->fDataSize - total_offset))
|
||||
{
|
||||
memcpy(channel->fData + total_offset, indata, channel->fDataSize - total_offset);
|
||||
memcpy(channel->fData, indata + (channel->fDataSize - total_offset), buffer->SizeUsed() - (channel->fDataSize - total_offset));
|
||||
}
|
||||
else
|
||||
memcpy(channel->fData + total_offset, indata, buffer->SizeUsed());
|
||||
|
||||
if ((B_OFFLINE == RunMode()) && (B_DATA_AVAILABLE == channel->fProducerDataStatus))
|
||||
{
|
||||
RequestAdditionalBuffer(channel->fInput.source, buffer);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -15,14 +15,35 @@ public:
|
||||
|
||||
bool AddInput(const media_input &input);
|
||||
bool AddOutput(const media_output &output);
|
||||
bool RemoveInput(const media_input &input);
|
||||
bool RemoveOutput(const media_output &output);
|
||||
|
||||
bool RemoveInput(int32 inputID);
|
||||
bool RemoveOutput();
|
||||
|
||||
int32 CreateInputID();
|
||||
|
||||
MixerInput *Input(int index); // index = 0 to count-1, NOT inputID
|
||||
MixerOutput *Output();
|
||||
|
||||
void Lock();
|
||||
void Unlock();
|
||||
|
||||
void BufferReceived(BBuffer *buffer, bigtime_t lateness);
|
||||
|
||||
void InputFormatChanged(int32 inputID, const media_format *format);
|
||||
void OutputFormatChanged(const media_format *format);
|
||||
|
||||
private:
|
||||
void OutputBufferLengthChanged(bigtime_t length);
|
||||
|
||||
|
||||
private:
|
||||
BLocker *fLocker;
|
||||
|
||||
bigtime_t fOutputBufferLength;
|
||||
bigtime_t fInputBufferLength;
|
||||
|
||||
BList *fInputs;
|
||||
MixerOutput *fOutput;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ public:
|
||||
|
||||
void BufferReceived(BBuffer *buffer);
|
||||
|
||||
media_input & MediaInput();
|
||||
|
||||
private:
|
||||
MixerCore *fCore;
|
||||
};
|
||||
|
||||
@@ -12,3 +12,4 @@ MixerOutput::~MixerOutput()
|
||||
{
|
||||
}
|
||||
|
||||
media_output MediaOutput();
|
||||
|
||||
@@ -9,6 +9,8 @@ public:
|
||||
MixerOutput(MixerCore *core);
|
||||
~MixerOutput();
|
||||
|
||||
media_output MediaOutput();
|
||||
|
||||
private:
|
||||
MixerCore *fCore;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user