// ----------------------------------------------------------
ofxAudioUnitSampler::ofxAudioUnitSampler(const ofxAudioUnitSampler &orig)
// ----------------------------------------------------------
{
	_desc = orig._desc;
    initUnit();
    midiChannelInUse = orig.midiChannelInUse;
}
IndianaJonesUnit::IndianaJonesUnit(Vortex * gameEngine, std::vector<std::vector<MapTile *>> * mapGroundTiles, int posX, int posY, int endPosX, int endPosY) : Unit(gameEngine, mapGroundTiles, posX, posY) {

	this->endPosX = endPosX;
	this->endPosY = endPosY;

	maxspeed = 0.04f;
	speed = maxspeed;

	width = 32 / 2;
	height = 48 / 2;
	maxHealth = 53.f; //+15
	offsetComponentsY = 15 + gameEngine->getRandInt(-5, 5);

	killReward = 3;


	moveDirection = DIRECTIONS[rand() % 4];

	currentMoveAnimationIndex = getDirectionIndex(moveDirection);

	for (int i = 0; i < DIRECTIONS.size(); i++){

		VortexAnimation * tempAni = new VortexAnimation(posX, posY, width, height, 13, gameEngine);
		tempAni->asembleSpritesheetAnimation("Graphics/Units/indianajones.png", 32, 48, DIRECTIONS[i], 4);
		moveAnimations.push_back(tempAni);

	}

	hitParticleColor = sf::Color(220, 20, 20);


	initUnit();
}
// ----------------------------------------------------------
ofxAudioUnitInput::ofxAudioUnitInput(unsigned int samplesToBuffer)
: _impl(new InputImpl)
// ----------------------------------------------------------
{
	_desc = inputDesc;
	initUnit();
	
	AudioStreamBasicDescription ASBD = {0};
	UInt32 ASBD_size = sizeof(ASBD);
	OFXAU_PRINT(AudioUnitGetProperty(*_unit,
									 kAudioUnitProperty_StreamFormat,
									 kAudioUnitScope_Output,
									 1,
									 &ASBD,
									 &ASBD_size),
				"getting input ASBD");
	
	_impl->ctx.inputUnit  = _unit;
	_impl->ctx.bufferList = AudioBufferListRef(AudioBufferListAlloc(ASBD.mChannelsPerFrame, 1024), AudioBufferListRelease);
	_impl->ctx.circularBuffers.resize(ASBD.mChannelsPerFrame);
	_impl->isReady = false;
	
#if !TARGET_OS_IPHONE
	_impl->inputDeviceID = DefaultAudioInputDevice();
#endif
	
	for(int i = 0; i < ASBD.mChannelsPerFrame; i++) {
		TPCircularBufferInit(&_impl->ctx.circularBuffers[i], samplesToBuffer * sizeof(Float32));
	}
}
// ----------------------------------------------------------
ofxAudioUnitSampler::ofxAudioUnitSampler()
// ----------------------------------------------------------
{
	_desc = samplerDesc;
	initUnit();
    midiChannelInUse = 0;
}
// ----------------------------------------------------------
ofxAudioUnitNetSend::ofxAudioUnitNetSend()
// ----------------------------------------------------------
{
	_desc = netSendDesc;
	initUnit();
	setName("openFrameworks");
}
Exemple #6
0
// ----------------------------------------------------------
ofxAudioUnitOutput::ofxAudioUnitOutput()
: _isReady(false)
// ----------------------------------------------------------
{
	_desc = outputDesc;
	initUnit();
}
Exemple #7
0
std::unique_ptr<BcmUnit> BcmAPI::initOnlyUnit() {
  auto numDevices = BcmAPI::getNumSwitches();
  if (numDevices == 0) {
    throw FbossError("no Broadcom switching ASIC found");
  } else if (numDevices > 1) {
    throw FbossError("found more than 1 Broadcom switching ASIC");
  }
  return initUnit(0);
}
ofxAudioUnitFilePlayer::ofxAudioUnitFilePlayer()
: _region((ScheduledAudioFileRegion){0})
, _pauseTimeStamp((AudioTimeStamp){0})
, _loopCount(0)
, _pauseTimeAccumulator(0)
, _primed(false) {
	_fileID[0] = NULL;
	_desc = filePlayerDesc;
	initUnit();
}
// ----------------------------------------------------------
ofxAudioUnitSampler& ofxAudioUnitSampler::operator=(const ofxAudioUnitSampler &orig)
// ----------------------------------------------------------
{
	if(this == &orig) return *this;
	
	_desc = orig._desc;
	initUnit();
    midiChannelInUse = orig.midiChannelInUse;
	
	return *this;
}
// ----------------------------------------------------------
ofxAudioUnitInput::ofxAudioUnitInput() : _isReady(false)
// ----------------------------------------------------------
{
	_desc = inputDesc;
	initUnit();
	
	_ringBuffer = RingBufferRef(new ofxAudioUnitInput::RingBuffer());
	
	_renderContext.inputUnit  = _unit;
	_renderContext.ringBuffer = _ringBuffer;
}
// ----------------------------------------------------------
ofxAudioUnitSampler::ofxAudioUnitSampler(OSType type,
						   OSType subType,
						   OSType manufacturer)
// ----------------------------------------------------------
{
	_desc.componentType         = type;
	_desc.componentSubType      = subType;
	_desc.componentManufacturer = manufacturer;
	_desc.componentFlags        = 0;
	_desc.componentFlagsMask    = 0;
	initUnit();
    midiChannelInUse = 0;
};
// ----------------------------------------------------------
ofxAudioUnitMixer::ofxAudioUnitMixer()
// ----------------------------------------------------------
{
  _desc = mixerDesc;
  initUnit();
  
  // default volume is 0, which can make things seem like they aren't working
	
	int busses = getInputBusCount();
	for(int i = 0; i < busses; i++)
		setInputVolume(1, i);
  
	setOutputVolume(1);
}
// ----------------------------------------------------------
ofxAudioUnitSpeechSynth::ofxAudioUnitSpeechSynth()
// ----------------------------------------------------------
{
	_desc = speechDesc;
	initUnit();
	UInt32 dataSize = sizeof(SpeechChannel);
	
	OFXAU_PRINT(AudioUnitGetProperty(*_unit,
									 kAudioUnitProperty_SpeechChannel,
									 kAudioUnitScope_Global,
									 0,
									 &_channel,
									 &dataSize),
				"getting speech channel");
}
// ----------------------------------------------------------
ofxAudioUnitNetReceive::ofxAudioUnitNetReceive()
// ----------------------------------------------------------
{
    _desc = netReceiveDesc;
    initUnit();
}
// ----------------------------------------------------------
ofxAudioUnitOutput::ofxAudioUnitOutput()
// ----------------------------------------------------------
{
	_desc = outputDesc;
	initUnit();
}
// ----------------------------------------------------------
ofxAudioUnitFilePlayer::ofxAudioUnitFilePlayer()
// ----------------------------------------------------------
{
	_desc = filePlayerDesc;
	initUnit();
}
ofxAudioUnitSampler::ofxAudioUnitSampler()
{
	_desc = samplerDesc;
	initUnit();
}