コード例 #1
0
ファイル: channelsettings.cpp プロジェクト: deus-amd/Sgen
void ChannelSettings::init_snd_channel_params()
{
    sc->setFunctionStr(channel_index, getFunction());
    sc->setAmp(channel_index, getAmp());
    sc->setFreq(channel_index, getFreq());
    channel_drawer->setAmp(getAmp());
    channel_drawer->setFreq(getFreq());
}
コード例 #2
0
ファイル: eigenGrasp.cpp プロジェクト: GraspControl/graspit
/*! The boundary of the "legal" space forms a polygon in EG-subspace 
	which is not axis-aligned. It is difficult to compute analytically
	so for any new hand configuration this function re-computes the min 
	and max values. The min and max along each eigengrasp are then stored
	inside the eigengrasps themselves.

	The behavior depends on whether EIGENGRASP_LOOSE is defined. If not, min
	and max have to be set so that not a single dof is taken outside of its
	range. If it is not set, then min and max have to be set so that at least
	one dof is inside the legal range, the others can go out as they will be
	clamped later.

	For some reason, this apparently simple function has given me a ton of
	trouble, and I've never been completely happy with it.
*/
void
EigenGraspInterface::setMinMax()
{
	double m,M,mmin,mmax;
	double* eg = new double[dSize];
	double* currentDOF = new double[dSize];
	double* currentAmps  = new double[eSize];

	mRobot->getDOFVals(currentDOF);
	getAmp(currentAmps, currentDOF);

	for (int e = 0; e < eSize; e++)
	{
		//fprintf(stderr,"\n------\nEG %d\n",e);
#ifdef EIGENGRASP_LOOSE
		mmin = +1.0e5;
		mmax = -1.0e5;
#else
		mmin = -1.0e5;
		mmax = +1.0e5;
#endif
		mGrasps[e]->getEigenGrasp(eg);
		for (int d=0; d < dSize; d++) {
			if (eg[d]==0) continue;
			m = ( mRobot->getDOF(d)->getMin() - currentDOF[d] ) / ( eg[d] * mNorm->getAxisValue(d) );
			M = ( mRobot->getDOF(d)->getMax() - currentDOF[d] ) / ( eg[d] * mNorm->getAxisValue(d) );
			if ( m > M) {std::swap(m,M);} //swap m and M if needed
#ifdef EIGENGRASP_LOOSE
            //if ( m < mmin ) {mmin = m; mind = d;}
            //if ( M > mmax ) {mmax = M; maxd = d;}
            if ( m < mmin ) {mmin = m;}
            if ( M > mmax ) {mmax = M;}
#else
            //if ( m > mmin ) {mmin = m; mind = d;}
            //if ( M < mmax ) {mmax = M; maxd = d;}
            if ( m > mmin ) {mmin = m;}
            if ( M < mmax ) {mmax = M;}
#endif
		}
		if(!mGrasps[e]->mPredefinedLimits){
			mGrasps[e]->mMin = currentAmps[e] + mmin;
			mGrasps[e]->mMax = currentAmps[e] + mmax;
		}
		//fprintf(stderr,"Current: %f; range: %f(%d) -- %f(%d) \n",currentAmps[e],
		//		mGrasps[e]->mMin, mind, mGrasps[e]->mMax, maxd);
	}

	delete [] eg;
	delete [] currentDOF;
	delete [] currentAmps;
}
コード例 #3
0
ファイル: MidiPerform.cpp プロジェクト: UIKit0/improv
void MidiPerform::xcheck(void) {
   int quitQ = 0;
   MFEvent* event = NULL;
   if (beatTimer.expired()) {   // waiting for the next beat, so don't continue
      if (getTempoMethod() != TEMPO_METHOD_AUTOMATIC) {
         return;
      }
   }
   int currentTime = (int)(performanceTimer.getPeriodCount() *
         midifile.getTicksPerQuarterNote());
   int i;
   for (i=0; i<midifile.getTrackCount(); i++) {
      if (readIndex[i] >= midifile.getNumEvents(i)) {
         quitQ++;
         continue;
      }
      while (midifile.getEvent(i, readIndex[i]).time <= currentTime) {
         event = &midifile.getEvent(i, readIndex[i]);
         if (((event->data[0] & 0xf0) == 0x90) ||
             ((event->data[0] & 0xf0) == 0x80)) {
            if (channelCollapse()) {
               event->data[0] = event->data[0] & (uchar)0xf0;
            }
            if (event->data[2] != 0) {
               int amplitude = (int)(event->data[2] * getAmp());
               if (amplitude < 0) {
                  amplitude = 0;
               } else if (amplitude > getMaxAmp()) {
                  amplitude = getMaxAmp();
               }
               event->data[2] = (uchar)amplitude;
            }
         }
         rawsend(event->data.getBase(), event->data.getSize());
         readIndex[i] = readIndex[i] + 1;
         if (readIndex[i] >= midifile.getNumEvents(i)) {
            quitQ++;
            break;
         }
      }
   }

   if (quitQ == midifile.getTrackCount()) {
      exit(0);
   }
}
コード例 #4
0
SoundPlayer::SoundPlayer(EventListener *g) {
	sound->system->createChannelGroup(NULL, &cg);

	sound->system->createDSPByType(FMOD_DSP_TYPE_LOWPASS, &lowpass);
	sound->system->createDSPByType(FMOD_DSP_TYPE_HIGHPASS, &hipass);
	sound->system->createDSPByType(FMOD_DSP_TYPE_ECHO, &echo);
	sound->system->createDSPByType(FMOD_DSP_TYPE_REVERB, &reverb);
	
	vc = PLAYER_DEFAULT_DISTORTION;
	vol = PLAYER_DEFAULT_VOLUME;
	
	cg->setVolume(PLAYER_DEFAULT_VOLUME);

	distortion = getDistortion();
	slicer = getSlicer();
	amp = getAmp();
	pan = getPanner();
	
	cg->addDSP(amp);
	cg->addDSP(reverb);
	cg->addDSP(echo);
	cg->addDSP(pan);
	cg->addDSP(lowpass);
	cg->addDSP(hipass);
	ERRCHECK(cg->addDSP(distortion));
	ERRCHECK(cg->addDSP(slicer));

	slicer->setBypass(true);
	echo->setBypass(true);
	reverb->setBypass(true);

	echo->setParameter(FMOD_DSP_ECHO_DELAY, 60.0 / (float)sound->getTempo() * 1000 / 2);
	echo->setParameter(FMOD_DSP_ECHO_MAXCHANNELS, 2);
	echo->setParameter(FMOD_DSP_ECHO_WETMIX, 0.4);
	echo->setParameter(FMOD_DSP_ECHO_DRYMIX, 1);

	lowpass->setParameter(FMOD_DSP_LOWPASS_CUTOFF, OPTLPFCO(PLAYER_LPF_DEFAULT_CUTOFF));
	lowpass->setParameter(FMOD_DSP_LOWPASS_RESONANCE, OPTLPFRE(PLAYER_LPF_DEFAULT_RESONANCE));
	hipass->setParameter(FMOD_DSP_HIGHPASS_CUTOFF, OPTLPFCO(PLAYER_HPF_DEFAULT_CUTOFF));
	distortion->setParameter(0, PLAYER_DEFAULT_DISTORTION);
	amp->setParameter(0, PLAYER_DEFAULT_VOLUME);
	pan->setParameter(0, PLAYER_DEFAULT_PAN * 2 - 1);

	this->gui = g;
}
コード例 #5
0
ファイル: eigenGrasp.cpp プロジェクト: CURG/graspit_handop
/*! Given a vector of EG amplitudes (a point in EG subspace) this 
	function returns it's equivalent in DOF space. Essentially, it
	back-projects a point from eg space to dof space.

	If the interface is rigid, we add the amplitudes to the pre-specified 
	eigen space origin. This means we DISCARD whatever component was in 
	the pose that was not from eigenspace.
	
	If the interface is not rigid, we add the change in amplitudes to the 
	current position of the robot. This means we KEEP the position component 
	that was not in eigen space.
*/
void 
EigenGraspInterface::getDOF(const double *amp, double *dof) const 
{
	double *origin = new double[dSize];
	double *rigidAmp = new double[eSize];
	
	for (int e=0; e < eSize; e++) {
		if ( !mGrasps[e]->mFixed )
			rigidAmp[e] = amp[e];
		else {
			rigidAmp[e] = mGrasps[e]->fixedAmplitude;
			DBGA(e << " fixed at " << mGrasps[e]->fixedAmplitude);
		}
	}

	if (mRigid) {
		//if the interface is rigid, we add the amplitudes to the pre-specified eigen space origin
		//it means we DISCARD whatever component was in the pose that was not from eigenspace
		mOrigin->getEigenGrasp(origin);
		toDOFSpace(rigidAmp, dof, origin);
	} else {
		//if it is not, we just add the change in amplitudes to the current position of the robot
		//this means we KEEP the position component that was not in eigen space
		double *currentAmp = new double[eSize];
		double *relativeAmp = new double[eSize];
		mRobot->getDOFVals(origin);
		getAmp(currentAmp, origin);
		for (int e=0; e < eSize; e++) {
			relativeAmp[e] = rigidAmp[e] - currentAmp[e];
		}
		toDOFSpace(relativeAmp, dof, origin);
		delete [] currentAmp;
		delete [] relativeAmp;		
	}

	delete [] rigidAmp;
	delete [] origin;
}
コード例 #6
0
ファイル: main.cpp プロジェクト: blodow/ilive
int main() {
  std::cout << getAmp() << std::endl;
}