Modified:
/trunk/Source/SoundflowerEngine.cpp
=======================================
--- /trunk/Source/SoundflowerEngine.cpp Fri Mar 12 10:30:51 2010
+++ /trunk/Source/SoundflowerEngine.cpp Fri Mar 12 10:30:58 2010
@@ -533,26 +533,27 @@
IOReturn SoundflowerEngine::clipOutputSamples(const void *mixBuf, void
*sampleBuf, UInt32 firstSampleFrame, UInt32 numSampleFrames, const
IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream)
{
- UInt32 channelCount = streamFormat->fNumChannels;
- UInt32 offset = firstSampleFrame * channelCount;
- UInt32 byteOffset = offset * sizeof(float);
- UInt32 numBytes = numSampleFrames * channelCount * sizeof(float);
+ UInt32 channelCount = streamFormat->fNumChannels;
+ UInt32 offset = firstSampleFrame * channelCount;
+ UInt32 byteOffset = offset * sizeof(float);
+ UInt32 numBytes = numSampleFrames * channelCount * sizeof(float);
+ SoundflowerDevice* device = (SoundflowerDevice*)audioDevice;
//IOLog("SoundflowerEngine[%p]::clipOutputSamples() -- channelCount:%u
\n", this, (uint)channelCount);
- if (((SoundflowerDevice *)audioDevice)->mMuteIn[0]) {
+ if (device->mMuteIn[0]) {
memset((UInt8 *)thruBuffer + byteOffset, 0, numBytes);
}
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);
+ float masterGain = device->mGain[0] /
((float)SoundflowerDevice::kGainMax);
+ float masterVolume = device->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);
+ SInt32 channelMute = device->mMuteIn[channel+1];
+ float channelGain = device->mGain[channel+1] /
((float)SoundflowerDevice::kGainMax);
+ float channelVolume = device->mVolume[channel+1] /
((float)SoundflowerDevice::kVolumeMax);
float adjustment = masterVolume * channelVolume * masterGain *
channelGain;
for (UInt32 channelBufferIterator = 0; channelBufferIterator <
numSampleFrames; channelBufferIterator++) {
@@ -571,12 +572,13 @@
IOReturn SoundflowerEngine::convertInputSamples(const void *sampleBuf,
void *destBuf, UInt32 firstSampleFrame, UInt32 numSampleFrames, const
IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream)
{
- UInt32 frameSize = streamFormat->fNumChannels * sizeof(float);
- UInt32 offset = firstSampleFrame * frameSize;
+ UInt32 frameSize = streamFormat->fNumChannels * sizeof(float);
+ UInt32 offset = firstSampleFrame * frameSize;
+ SoundflowerDevice* device = (SoundflowerDevice*)audioDevice;
//IOLog("SoundflowerEngine[%p]::convertInputSamples() -- channelCount:%u
\n", this, (uint)streamFormat->fNumChannels);
- if (((SoundflowerDevice *)audioDevice)->mMuteOut[0])
+ if (device->mMuteOut[0])
memset((UInt8 *)destBuf, 0, numSampleFrames * frameSize);
else
memcpy((UInt8 *)destBuf, (UInt8 *)thruBuffer + offset,
numSampleFrames * frameSize);