Modified:
/trunk/Source/SoundflowerDevice.cpp
/trunk/Source/SoundflowerEngine.cpp
=======================================
--- /trunk/Source/SoundflowerDevice.cpp Fri Mar 12 10:30:36 2010
+++ /trunk/Source/SoundflowerDevice.cpp Fri Mar 12 10:30:51 2010
@@ -79,18 +79,18 @@
OSCollectionIterator* audioEngineIterator;
OSDictionary* audioEngineDict;
- if(!audioEngineArray){
+ if (!audioEngineArray) {
IOLog("SoundflowerDevice[%p]::createAudioEngine() - Error: no
AudioEngine array in personality.\n", this);
return false;
}
audioEngineIterator =
OSCollectionIterator::withCollection(audioEngineArray);
- if(!audioEngineIterator){
+ if (!audioEngineIterator) {
IOLog("SoundflowerDevice: no audio engines available.\n");
return true;
}
- while(audioEngineDict =
(OSDictionary*)audioEngineIterator->getNextObject()){
+ while (audioEngineDict =
(OSDictionary*)audioEngineIterator->getNextObject()) {
SoundflowerEngine* audioEngine = NULL;
if(OSDynamicCast(OSDictionary, audioEngineDict) == NULL)
@@ -125,10 +125,8 @@
bool SoundflowerDevice::initControls(SoundflowerEngine* audioEngine)
{
IOAudioControl* control = NULL;
-// OSNumber *channelCountNum = OSDynamicCast(OSNumber,
audioEngine->getProperty(NUM_STREAMS_KEY)); // maximum 15, I assume
-// UInt32 channelCount = channelCountNum ?
channelCountNum->unsigned32BitValue() + 1 : 2; // adding one for the 'all'
channel
-
- for(UInt32 channel=0; channel <= 16; channel++) {
+
+ for (UInt32 channel=0; channel <= 16; channel++) {
mVolume[channel] = mGain[channel] = 65535;
mMuteOut[channel] = mMuteIn[channel] = false;
}
@@ -140,10 +138,10 @@
kIOAudioControlChannelNameLeftRear,
kIOAudioControlChannelNameRightRear,
kIOAudioControlChannelNameSub};
- for(UInt32 channel=7; channel <= 16; channel++)
+ for (UInt32 channel=7; channel <= 16; channel++)
channelNameMap[channel] = "Unknown Channel";
- for(unsigned channel=0; channel <= 16; channel++) {
+ for (unsigned channel=0; channel <= 16; channel++) {
// Create an output volume control for each channel with an int
range from 0 to 65535
// and a db range from -72 to 0
=======================================
--- /trunk/Source/SoundflowerEngine.cpp Fri Mar 12 10:30:29 2010
+++ /trunk/Source/SoundflowerEngine.cpp Fri Mar 12 10:30:51 2010
@@ -531,8 +531,6 @@
}
-// The following two routines were imported from the formerly separate
SoundflowerFPU.cpp/.a
-
IOReturn SoundflowerEngine::clipOutputSamples(const void *mixBuf, void
*sampleBuf, UInt32 firstSampleFrame, UInt32 numSampleFrames, const
IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream)
{
UInt32 channelCount = streamFormat->fNumChannels;
@@ -540,36 +538,31 @@
UInt32 byteOffset = offset * sizeof(float);
UInt32 numBytes = numSampleFrames * channelCount * sizeof(float);
-//IOLog("SoundflowerEngine[%p]::clipOutputSamples() -- channelCount:%u
\n", this, (uint)channelCount);
-
- if (((SoundflowerDevice *)audioDevice)->mMuteIn[0])
- {
+ //IOLog("SoundflowerEngine[%p]::clipOutputSamples() -- channelCount:%u
\n", this, (uint)channelCount);
+
+ if (((SoundflowerDevice *)audioDevice)->mMuteIn[0]) {
memset((UInt8 *)thruBuffer + byteOffset, 0, numBytes);
}
- else
- {
+ else {
memcpy((UInt8 *)thruBuffer + byteOffset, (UInt8 *)mixBuf + byteOffset,
numBytes);
float masterGain = ((SoundflowerDevice
*)audioDevice)->mGain[0]/((float)SoundflowerDevice::kGainMax);
float masterVolume = ((SoundflowerDevice
*)audioDevice)->mVolume[0]/((float)SoundflowerDevice::kVolumeMax);
- for(UInt32 channel = 0; channel < channelCount; channel++)
- {
- SInt32 channelMute = ((SoundflowerDevice
*)audioDevice)->mMuteIn[channel+1];
- float channelGain = ((SoundflowerDevice
*)audioDevice)->mGain[channel+1]/((float)SoundflowerDevice::kGainMax);
- float channelVolume = ((SoundflowerDevice
*)audioDevice)->mVolume[channel+1]/((float)SoundflowerDevice::kVolumeMax);
- float adjustment = masterVolume * channelVolume * masterGain *
channelGain;
-
- for(UInt32 channelBufferIterator = 0; channelBufferIterator <
numSampleFrames; channelBufferIterator++)
- {
- if( channelMute )
+ for (UInt32 channel = 0; channel < channelCount; channel++) {
+ SInt32 channelMute = ((SoundflowerDevice
*)audioDevice)->mMuteIn[channel+1];
+ float channelGain = ((SoundflowerDevice
*)audioDevice)->mGain[channel+1]/((float)SoundflowerDevice::kGainMax);
+ float channelVolume = ((SoundflowerDevice
*)audioDevice)->mVolume[channel+1]/((float)SoundflowerDevice::kVolumeMax);
+ float adjustment = masterVolume * channelVolume * masterGain *
channelGain;
+
+ for (UInt32 channelBufferIterator = 0; channelBufferIterator <
numSampleFrames; channelBufferIterator++) {
+ if (channelMute)
thruBuffer[offset + channelBufferIterator*channelCount + channel] = 0;
else
thruBuffer[offset + channelBufferIterator*channelCount + channel] *=
adjustment;
}
}
}
-
return kIOReturnSuccess;
}
@@ -578,11 +571,10 @@
IOReturn SoundflowerEngine::convertInputSamples(const void *sampleBuf,
void *destBuf, UInt32 firstSampleFrame, UInt32 numSampleFrames, const
IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream)
{
- UInt32 offset;
UInt32 frameSize = streamFormat->fNumChannels * sizeof(float);
- offset = firstSampleFrame * frameSize;
-
-//IOLog("SoundflowerEngine[%p]::convertInputSamples() -- channelCount:%u
\n", this, (uint)streamFormat->fNumChannels);
+ UInt32 offset = firstSampleFrame * frameSize;
+
+ //IOLog("SoundflowerEngine[%p]::convertInputSamples() -- channelCount:%u
\n", this, (uint)streamFormat->fNumChannels);
if (((SoundflowerDevice *)audioDevice)->mMuteOut[0])
memset((UInt8 *)destBuf, 0, numSampleFrames * frameSize);
@@ -591,4 +583,3 @@
return kIOReturnSuccess;
}
-