Ejemplo n.º 1
0
Float32		CAAUProcessor::GetOLPercentComplete ()
{
	if (!IsOfflineContext())
		return 0;

	Float32 percentDone = mLastPercentReported;
		
	if (IsOfflineAU()) 
	{
		// we get the output size every time, as this can change as parameters are changed
		UInt64 numOutputSamples = mNumInputSamples;
		UInt32 propSize = sizeof(numOutputSamples);
		mUnit.GetProperty (kAudioUnitOfflineProperty_OutputSize,
							kAudioUnitScope_Global, 0, &numOutputSamples, &propSize);
		
		percentDone = (mRenderTimeStamp.mSampleTime / Float64(numOutputSamples)) * 100.;
	}
	else
	{
		percentDone = (mRenderTimeStamp.mSampleTime / Float64(mNumInputSamples + mTailSamples)) * 100.;
	}
	
	if (percentDone > mLastPercentReported)
		mLastPercentReported = percentDone;

	return mLastPercentReported;
}
Ejemplo n.º 2
0
dmz::Boolean
dmz::AudioModuleFMOD::lookup_sound (
      const Handle InstanceHandle,
      SoundInit &init,
      SoundAttributes &attributes) {

   Boolean result (False);

   if (_system) {

#if 0
      FMOD_VECTOR pos = {0.0f, 0.0f, 0.0f};

      InstanceStruct *instance = _instanceTable.lookup (InstanceHandle);

      if (instance && instance->channel) {

         instance->channel->get3DAttributes (&pos, 0);
         position.set_xyz (Float64 (pos.x), Float64 (pos.y), Float64 (pos.z));

         FMOD_RESULT fmodResult = instance->channel->getFrequency(&currentFrequency);

         if (_error_check ("Getting Sound Pitch", fmodResult)) {

            pitchScale = Float64 (currentFrequency) /
               Float64 (instance->defaultFrequency);

            result = True;
         }
      }
#endif
   }

   return result;
}
Ejemplo n.º 3
0
// Render Portal Observer Interface
void
dmz::EntityPluginOverlayDead::update_portal_size (
      const Handle PortalHandle,
      const Int32 ValueX,
      const Int32 ValueY) {

   if (_overlay && _overlayScale) {

      _overlay->store_transform_scale (
         _overlayScale,
         Float64 (ValueX),
         Float64 (ValueY));
   }
}
Ejemplo n.º 4
0
OSStatus CAPlayThrough::InputProc(void *inRefCon,
									AudioUnitRenderActionFlags *ioActionFlags,
									const AudioTimeStamp *inTimeStamp,
									UInt32 inBusNumber,
									UInt32 inNumberFrames,
									AudioBufferList * ioData)
{
    OSStatus err = noErr;
	
	CAPlayThrough *This = (CAPlayThrough *)inRefCon;
	if (This->mFirstInputTime < 0.)
		This->mFirstInputTime = inTimeStamp->mSampleTime;
		
	//Get the new audio data
	err = AudioUnitRender(This->mInputUnit,
						 ioActionFlags,
						 inTimeStamp, 
						 inBusNumber,     
						 inNumberFrames, //# of frames requested
						 This->mInputBuffer);// Audio Buffer List to hold data
	checkErr(err);
		
	if(!err)
		err = This->mBuffer->Store(This->mInputBuffer, Float64(inNumberFrames), SInt64(inTimeStamp->mSampleTime));
	
	return err;
}
Ejemplo n.º 5
0
QVariant Float64Codec::value( const PODData& data, int* byteCount ) const
{
    const double* pointer = (double*)data.pointer( 8 );

    *byteCount = pointer ? 8 : 0;
    return pointer ? QVariant::fromValue<Float64>( Float64(*pointer) ) : QVariant();
}
Ejemplo n.º 6
0
void
dmz::QtPluginAppUpdater::_slot_download_progress (qint64 received, qint64 total) {

    if (_updateDialog) {

        Float64 receivedSizeInMb = Float64 (received) / 1048576;
        Float64 totalSizeInMb = Float64 (total) / 1048576;

        QString info (tr ("Downloading %1 MB of %2 MB").
                      arg (receivedSizeInMb, 0, 'f', 2).
                      arg (totalSizeInMb, 0, 'f', 2));

        _ui.progressLabel->setText (info);
        _ui.progressBar->setMaximum (total);
        _ui.progressBar->setValue (received);
    }
}
// Time Slice Interface
void
dmz::ForgePluginScreenCaptureMulti::update_time_slice (const Float64 TimeDelta) {

   if (_fileIndex > 0) {

      if (_fileIndex > 1) {

         _heading += TwoPi64 / Float64 (_maxFiles);
         _update_portal ();
      }

      String count (String::number (_fileIndex));
      if (count.get_length () < _maxLength) {

         count.shift (_maxLength - count.get_length (), '0');
      }

      String file (_fileRoot);
      file << count << ".png";
      _fileList.add (file);

      Data out = _convertString.to_data (file);
      _doCaptureMsg.send (&out);

      _fileIndex++;
      if (_fileIndex > _maxFiles) { _fileIndex = -1; }
   }
   else if (_fileIndex < 0) {

      const Int32 Size (_fileList.get_count ());

      Int32 count (0);
      StringContainerIterator it;
      String file;
      while (_fileList.get_next (it, file)) {

         if (is_valid_path (file)) { count++; }
         else { break; }
      }

      _update_portal ();

      if (Size == count) {

         Data out = _convertList.to_data (_fileList);
         _finishedCaptureMsg.send (&out);
         _fileIndex = 0;
      }
      else {

_log.error << "Not all screen capture images created. Created " << count << " of " << Size << endl;
      }
   }
}
Ejemplo n.º 8
0
// Object Observer Interface
void
dmz::EntityPluginOverlayDead::update_object_state (
      const UUID &Identity,
      const Handle ObjectHandle,
      const Handle AttributeHandle,
      const Mask &Value,
      const Mask *PreviousValue) {

   if (_overlay && (ObjectHandle == _hil)) {

      const Boolean IsDead (Value.contains (_deadState));
      const Boolean WasDead (
         PreviousValue ? PreviousValue->contains (_deadState) : False);

      if (IsDead && !WasDead) {

         if (_overlaySwitch) {

            _overlay->enable_switch_state_single (_overlaySwitch, 1);
         }

         if (_overlayScale) {

            _overlay->store_transform_scale (
               _overlayScale,
               Float64 (get_portal_x ()),
               Float64 (get_portal_y ()));
         }
      }
      else if (!IsDead && WasDead) {

         if (_overlaySwitch) {

            _overlay->enable_switch_state_single (_overlaySwitch, 0);
         }
      }
   }
}
Ejemplo n.º 9
0
void
dmz::QtPluginGraph::_update_power_law (
    const BarStruct *LastBar,
    const Float64 EndOfXAxis) {

    Boolean foundFirstBar (False);
    Float32 offset = _spaceWidth;

    Float64 p (0.0);
    Float64 q (0.0);
    Float64 nonZeroCount (0.0);
    Float64 x (0.0);
    Float64 y (0.0);
    Float64 sumX (0.0);
    Float64 sumY (0.0);
    Float64 sumXY (0.0);
    Float64 sumX2 (0.0);

    HashTableUInt32Iterator it;
    BarStruct *bar (_ascendingOrder ? _barTable.get_first (it) : _barTable.get_last (it));

    while (bar) {

        if (!foundFirstBar && bar->count) {
            foundFirstBar = True;
        }

        if (foundFirstBar) {

            if (bar->Id == 0) {
                x = 1.0;
            }
            else {
                x = log (Float64 (bar->Id));
            }

            if (bar->height < 0.0f) {

                y = log (-bar->height);
                sumY += y;
                sumX += x;
                sumXY += x * y;
                sumX2 += x * x;
                nonZeroCount++;
            }
        }

        if (LastBar == bar) {
            bar = 0;
        }
        else {

            bar = (_ascendingOrder ? _barTable.get_next (it) : _barTable.get_prev (it));
        }
    }

    if (nonZeroCount > 0.0) {

        q = ((nonZeroCount * sumXY) - (sumX * sumY)) /
            ((nonZeroCount * sumX2) - (sumX * sumX));

        p = exp ((sumY - (q * sumX)) / nonZeroCount);
    }

    foundFirstBar = false;
    QPainterPath path;

    bar = (_ascendingOrder ? _barTable.get_first (it) : _barTable.get_last (it));

    const Float32 Offset (_barWidth * 0.5f);

    while (bar) {

        if (!foundFirstBar && bar->count) {

            path.moveTo (bar->offset + Offset, -local_power (p, q, bar->Id));
            foundFirstBar = True;
        }
        else if (foundFirstBar) {

            path.lineTo (bar->offset + Offset, -local_power (p, q, bar->Id));
        }

        if (LastBar == bar) {
            bar = 0;
        }
        else {

            bar = (_ascendingOrder ? _barTable.get_next (it) : _barTable.get_prev (it));
        }
    }

    if (path.elementCount () > 1) {

        if (!_powerLawPath) {

            _powerLawPath = new QGraphicsPathItem;
            _powerLawPath->setPen (_powerStroke);
            _powerLawPath->setZValue (2.0);
            if (_scene) {
                _scene->addItem (_powerLawPath);
            }
        }

        if (_powerLawPath) {

            _powerLawPath->setPath (path);
        }

        if (!_powerLabel) {

            _powerLabel = new QGraphicsTextItem;
            _powerLabel->setPos (260.0, -_barHeight);
            if (_scene) {
                _scene->addItem (_powerLabel);
            }
        }

        if (_powerLabel) {

            _powerLabel->setPlainText (
                QString::fromAscii ("Exponent = ") + QString::number (q));
        }
    }
    else if (_scene) {

        if (_powerLawPath) {

            _scene->removeItem (_powerLawPath);
            delete _powerLawPath;
            _powerLawPath = 0;
        }

        if (_powerLabel) {

            _scene->removeItem (_powerLabel);
            delete _powerLabel;
            _powerLabel = 0;
        }
    }
}
Ejemplo n.º 10
0
 const std::vector<const Parameter*> Flicker::setupParameters()
 {
     std::vector<const runtime::Parameter*> parameters;
     
     NumericParameter<Float64>* amount = new NumericParameter<Float64>(AMOUNT, Float64(0.0), Float64(1.0));
     amount->setTitle(L_("Relative amount"));
     amount->setAccessMode(runtime::Parameter::ACTIVATED_WRITE);
     parameters.push_back(amount);
                                 
     return parameters;
 }