コード例 #1
0
void AudioBufferSourceNode::process(size_t framesToProcess)
{
    AudioBus* outputBus = output(0)->bus();

    if (!isInitialized()) {
        outputBus->zero();
        return;
    }

    // The audio thread can't block on this lock, so we call tryLock() instead.
    MutexTryLocker tryLocker(m_processLock);
    if (tryLocker.locked()) {
        if (!buffer()) {
            outputBus->zero();
            return;
        }

        // After calling setBuffer() with a buffer having a different number of channels, there can in rare cases be a slight delay
        // before the output bus is updated to the new number of channels because of use of tryLocks() in the context's updating system.
        // In this case, if the the buffer has just been changed and we're not quite ready yet, then just output silence.
        if (numberOfChannels() != buffer()->numberOfChannels()) {
            outputBus->zero();
            return;
        }

        size_t quantumFrameOffset;
        size_t bufferFramesToProcess;

        updateSchedulingInfo(framesToProcess,
                             outputBus,
                             quantumFrameOffset,
                             bufferFramesToProcess);
                             
        if (!bufferFramesToProcess) {
            outputBus->zero();
            return;
        }

        for (unsigned i = 0; i < outputBus->numberOfChannels(); ++i)
            m_destinationChannels[i] = outputBus->channel(i)->mutableData();

        // Render by reading directly from the buffer.
        if (!renderFromBuffer(outputBus, quantumFrameOffset, bufferFramesToProcess)) {
            outputBus->zero();
            return;
        }

        // Apply the gain (in-place) to the output bus.
        float totalGain = gain()->value() * m_buffer->gain();
        outputBus->copyWithGainFrom(*outputBus, &m_lastGain, totalGain);
        outputBus->clearSilentFlag();
    } else {
        // Too bad - the tryLock() failed.  We must be in the middle of changing buffers and were already outputting silence anyway.
        outputBus->zero();
    }
}
コード例 #2
0
ファイル: lua_ref.cpp プロジェクト: NextRPG/Xihad
	 LuaRef::LuaRef( lua_State* L, int handle)
	 {
		 int* refPtr;
		 if (handle != LUA_REFNIL && handle != LUA_NOREF)
			 refPtr = new int(0);
		 else
			 refPtr = NULL;

		 gain(L, handle, refPtr);
	 }
コード例 #3
0
ファイル: Spc_Emu.cpp プロジェクト: Biggo/androidgmeplayer
blargg_err_t Spc_Emu::set_sample_rate_( long sample_rate )
{
	apu.set_gain( gain() );
	if ( sample_rate != native_sample_rate )
	{
		RETURN_ERR( resampler.buffer_size( native_sample_rate / 20 * 2 ) );
		resampler.time_ratio( (double) native_sample_rate / sample_rate, 0.9965 );
	}
	return 0;
}
コード例 #4
0
ファイル: Spc_Emu.cpp プロジェクト: bazzinotti/libGME_M
blargg_err_t Spc_Emu::set_sample_rate_( long sample_rate )
{
	RETURN_ERR( apu.init() );
	apu.set_gain( (int) (gain() * Snes_Spc::gain_unit) );
	if ( sample_rate != native_sample_rate )
	{
		RETURN_ERR( resampler.buffer_size( native_sample_rate / 20 * 2 ) );
		resampler.time_ratio( (double) native_sample_rate / sample_rate, 0.9965 );
	}
	return 0;
}
コード例 #5
0
ファイル: Hes_Emu.cpp プロジェクト: Kinglions/modizer
blargg_err_t Hes_Emu::load_( Data_Reader& in )
{
	RETURN_ERR( core.load( in ) );
	
	static const char* const names [Hes_Apu::osc_count + Hes_Apu_Adpcm::osc_count] = {
		"Wave 1", "Wave 2", "Wave 3", "Wave 4", "Multi 1", "Multi 2", "ADPCM"
	};
	set_voice_names( names );
	
	static int const types [Hes_Apu::osc_count + Hes_Apu_Adpcm::osc_count] = {
		wave_type+0, wave_type+1, wave_type+2, wave_type+3, mixed_type+0, mixed_type+1, mixed_type+2
	};
	set_voice_types( types );
	
	set_voice_count( core.apu().osc_count + core.adpcm().osc_count );
	core.apu().volume( gain() );
	core.adpcm().volume( gain() );
	
    return setup_buffer( 7159091 );
}
コード例 #6
0
ファイル: indexflushtarget.cpp プロジェクト: songhtdo/vespa
uint64_t
IndexFlushTarget::getApproxBytesToWriteToDisk() const
{
    MemoryGain gain(_flushStats.memory_before_bytes,
                    _flushStats.memory_after_bytes);
    if (gain.getAfter() < gain.getBefore()) {
        return gain.getBefore() - gain.getAfter();
    } else {
        return 0;
    }
}
コード例 #7
0
ファイル: imft.cpp プロジェクト: NBXApp/tum-lsr-dhri
void IMFT<Ptr>::addToDGraph(VecPtr ptrs)
{
    // save old edges
    m_vecOldEdge.clear();
    for(ListGraph::EdgeIt e(m_g); e != INVALID; ++e){
        m_vecOldEdge.push_back(m_g.id(e));
    }

    // making nodes
    for(int i=0;i<ptrs.size();i++){
        // inNode
        ListGraph::Node xi = m_g.addNode();
        V vi;
        vi.id = m_g.id(xi);
        vi.isIn = 1;
        vi.ptr = ptrs[i];
        vi.nFrame = cnt;
        vi.edgeID = -1;
        vi.isTrack = 0;
        vi.nTrack = 0;
        (*m_gNodeMap)[xi] = vi;

        // outNode
        ListGraph::Node xo = m_g.addNode();
        V vo;
        vo.id = m_g.id(xo);
        vo.isIn = 0;
        vo.ptr = ptrs[i];
        vo.nFrame = cnt;
        vo.edgeID = -1;
        vo.isTrack = 0;
        vo.nTrack = 0;
        (*m_gNodeMap)[xo] = vo;

        // connection to previous nodes
        for(ListGraph::NodeIt n(m_g); n != INVALID; ++n){
            if((*m_gNodeMap)[n].nFrame != vi.nFrame && !(*m_gNodeMap)[n].isIn){
                //                double weight = gain((*m_gNodeMap)[n], vi);
                double weight = gain((*m_gNodeMap)[m_g.nodeFromId(m_g.id(n)-1)], vi);

                //                m_g.nodeFromId(m_g.id((*m_gNodeMap)[n])-1);

                (*m_gEdgeMap)[m_g.addEdge(n,xi)] = weight;

                //                ListGraph::Edge e = m_g.addEdge(n,xi);
                //                (*m_gEdgeMap)[e] = weight;
                //                (*m_gNodeMap)[m_g.u(e)].edgeID = m_g.id(e);
                //                (*m_gNodeMap)[m_g.v(e)].edgeID = m_g.id(e);

            }
        }
    }
}
コード例 #8
0
ファイル: Vgm_Emu.cpp プロジェクト: Kinglions/modizer
blargg_err_t Vgm_Emu::load_mem_( byte const data [], int size )
{
	RETURN_ERR( core.load_mem( data, size ) );

	set_voice_count( core.psg[0].osc_count );
	
	double fm_rate = 0.0;
	if ( !disable_oversampling_ )
		fm_rate = sample_rate() * oversample_factor;
	RETURN_ERR( core.init_chips( &fm_rate ) );

	double psg_gain = ( ( core.header().psg_rate[3] & 0xC0 ) == 0x40 ) ? 0.5 : 1.0;
	
	if ( core.uses_fm() )
	{
		set_voice_count( 8 );
		RETURN_ERR( resampler.setup( fm_rate / sample_rate(), rolloff, gain() ) );
		RETURN_ERR( resampler.reset( core.stereo_buf[0].length() * sample_rate() / 1000 ) );
		core.psg[0].volume( 0.135 * fm_gain * psg_gain * gain() );
		core.psg[1].volume( 0.135 * fm_gain * psg_gain * gain() );
		core.ay[0].volume( 0.135 * fm_gain * gain() );
		core.ay[1].volume( 0.135 * fm_gain * gain() );
        core.huc6280[0].volume( 0.135 * fm_gain * gain() );
        core.huc6280[1].volume( 0.135 * fm_gain * gain() );
	}
	else
	{
		core.psg[0].volume( psg_gain * gain() );
		core.psg[1].volume( psg_gain * gain() );
	}
	
	static const char* const fm_names [] = {
		"FM 1", "FM 2", "FM 3", "FM 4", "FM 5", "FM 6", "PCM", "PSG"
	};
	static const char* const psg_names [] = { "Square 1", "Square 2", "Square 3", "Noise" };
	set_voice_names( core.uses_fm() ? fm_names : psg_names );
	
	static int const types [8] = {
		wave_type+1, wave_type+2, wave_type+3, noise_type+1,
		0, 0, 0, 0
	};
	set_voice_types( types );
	
	return Classic_Emu::setup_buffer( core.stereo_buf[0].center()->clock_rate() );
}
コード例 #9
0
ファイル: PluginProcessor.cpp プロジェクト: cchacons/ambix
/*
 Parameters:
 ////////////
 Azimuth
 Elevation
 Shape
 Width
 Height
 Gain
 Window
*/
void Ambix_directional_loudnessAudioProcessor::setParameter (int index, float newValue)
{

    int filter_id = (int)floor(index/PARAMS_PER_FILTER);

    if (filter_id < NUM_FILTERS) // safety..
    {
        _param_changed = true;

        switch (index%PARAMS_PER_FILTER) {

        case 0:
            center_sph(filter_id, 0) = newValue;
            break;

        case 1:
            center_sph(filter_id, 1) = newValue;
            break;

        case 2:
            shape(filter_id) = (newValue <= 0.5f ? 0 : 1.f);
            break;

        case 3:
            width(filter_id) = newValue;
            break;

        case 4:
            height(filter_id) = newValue;
            break;

        case 5:
            gain(filter_id) = newValue;
            break;

        case 6:
            window(filter_id) = newValue > 0.5f ? true : false;
            break;

        case 7:
            transition(filter_id) = newValue;
            break;

        default:
            _param_changed = false;
            break;
        }

    }

    sendChangeMessage();
}
コード例 #10
0
ファイル: Audio_Region.C プロジェクト: imv/non
/** Apply a (portion of) fade from /start/ to a buffer up to size /nframes/. */
void
Audio_Region::Fade::apply ( sample_t *buf, Audio_Region::Fade::fade_dir_e dir, nframes_t start, nframes_t nframes ) const
{
//    printf( "apply fade %s: start=%ld end=%lu\n", dir == Fade::Out ? "out" : "in", start, end );
    if ( ! nframes )
        return;

    nframes_t n = nframes;

    const double inc = increment();
    double fi = start / (double)length;

    if ( dir == Fade::Out )
    {
        fi = 1.0f - fi;
        for ( ; n--; fi -= inc  )
            *(buf++) *= gain( fi );
    }
    else
        for ( ; n--; fi += inc )
            *(buf++) *= gain( fi );
}
コード例 #11
0
 inline float apply_float_controls(float value) const
 {
     value = (value - m_contrast_pivot) * m_contrast + m_contrast_pivot;
     if (m_bias != 0.5f)
         value = bias(value);
     if (m_gain != 0.5f)
         value = gain(value);
     value = value * m_output_range + m_output_min;
     if (m_clamp_min)
         value = std::max(value, m_output_min);
     if (m_clamp_max)
         value = std::min(value, m_output_max);
     return value;
 }
コード例 #12
0
ファイル: Gym_Emu.cpp プロジェクト: IamusNavarathna/lv3proj
blargg_err_t Gym_Emu::set_sample_rate_( int sample_rate )
{
	blip_eq_t eq( -32, 8000, sample_rate );
	apu.treble_eq( eq );
	pcm_synth.treble_eq( eq );
	
	apu.volume( 0.135 * fm_gain * gain() );
	
	double factor = oversample;
	if ( disable_oversampling_ )
		factor = (double) base_clock / 7 / 144 / sample_rate;
	RETURN_ERR( resampler.setup( factor, 0.990, fm_gain * gain() ) );
	factor = resampler.rate();
	double fm_rate = sample_rate * factor;
	
	RETURN_ERR( stereo_buf.set_sample_rate( sample_rate, int (1000 / 60.0 / min_tempo) ) );
	stereo_buf.clock_rate( clock_rate );
	
	RETURN_ERR( fm.set_rate( fm_rate, base_clock / 7.0 ) );
	RETURN_ERR( resampler.reset( (int) (1.0 / 60 / min_tempo * sample_rate) ) );
	
	return blargg_ok;
}
コード例 #13
0
ファイル: shootemup.cpp プロジェクト: AReim1982/scummvm
void ShootEmUp::collisionCheck() {
	for (int i = 0; i < 99; i++) {
		if ((_sprites[i]._x != kFlag) && (_sprites[i]._missile) &&
			(_sprites[i]._y < 60) && (_sprites[i]._timeout == 1)) {
			int distFromSide = (_sprites[i]._x - 20) % 90;
			int thisStock = (_sprites[i]._x - 20) / 90;
			if ((!_hasEscaped[thisStock]) && (distFromSide > 17) && (distFromSide < 34)) {
				_vm->_sound->playNote(999, 3);
				_vm->_system->delayMillis(3);
				define(_sprites[i]._x + 20, _sprites[i]._y, 25 + _vm->_rnd->getRandomNumber(1), 3, 1, 12, false, true); // Well done!
				define(thisStock * 90 + 20, 30, 30, 0, 0, 7, false, false); // Face of man
				defineCameo(thisStock * 90 + 20 + 10, 35, 40, 7); // Splat!
				define(thisStock * 90 + 20 + 20, 50, 33 + _vm->_rnd->getRandomNumber(4), 0, 2, 9, false, true); // Oof!
				_stockStatus[thisStock] = 17;
				gain(3); // Score for hitting a face.

				if (_escaping && (_escapeStock = thisStock)) { // Hit the escaper.
					_vm->_sound->playNote(1777, 1);
					_vm->_system->delayMillis(1);
					gain(5); // Bonus for hitting escaper.
					_escaping = false;
					newEscape();
				}
			} else {
				define(_sprites[i]._x, _sprites[i]._y, 82 + _vm->_rnd->getRandomNumber(2), 2, 2, 17, false, true); // Missed!
				if ((!_hasEscaped[thisStock]) && (distFromSide > 3) && (distFromSide < 43)) {
					define(thisStock * 90 + 20, 30, 29, 0, 0, 7, false, false); // Face of man
					if (distFromSide > 35)
						defineCameo(_sprites[i]._x - 27, 35, 40, 7); // Splat!
					else
						defineCameo(_sprites[i]._x - 7, 35, 40, 7);
					_stockStatus[thisStock] = 17;
				}
			}
		}
	}
}
コード例 #14
0
ファイル: Hes_Emu.cpp プロジェクト: Accusedbold/zdoom
blargg_err_t Hes_Emu::load_( Data_Reader& in )
{
	assert( offsetof (header_t,unused [4]) == header_size );
	RETURN_ERR( rom.load( in, header_size, &header_, unmapped ) );
	
	RETURN_ERR( check_hes_header( header_.tag ) );
	
	if ( header_.vers != 0 )
		set_warning( "Unknown file version" );
	
	if ( memcmp( header_.data_tag, "DATA", 4 ) )
		set_warning( "Data header missing" );
	
	if ( memcmp( header_.unused, "\0\0\0\0", 4 ) )
		set_warning( "Unknown header data" );
	
	// File spec supports multiple blocks, but I haven't found any, and
	// many files have bad sizes in the only block, so it's simpler to
	// just try to load the damn data as best as possible.
	
	long addr = get_le32( header_.addr );
	long size = get_le32( header_.size );
	long const rom_max = 0x100000;
	if ( addr & ~(rom_max - 1) )
	{
		set_warning( "Invalid address" );
		addr &= rom_max - 1;
	}
	if ( (unsigned long) (addr + size) > (unsigned long) rom_max )
		set_warning( "Invalid size" );
	
	if ( size != rom.file_size() )
	{
		if ( size <= rom.file_size() - 4 && !memcmp( rom.begin() + size, "DATA", 4 ) )
			set_warning( "Multiple DATA not supported" );
		else if ( size < rom.file_size() )
			set_warning( "Extra file data" );
		else
			set_warning( "Missing file data" );
	}
	
	rom.set_addr( addr );
	
	set_voice_count( apu.osc_count );
	
	apu.volume( gain() );
	
	return setup_buffer( 7159091 );
}
コード例 #15
0
ファイル: Ay_Emu.cpp プロジェクト: HipsterLion/SRB2
blargg_err_t Ay_Emu::load_mem_( byte const* in, long size )
{
	assert( offsetof (header_t,track_info [2]) == header_size );
	
	RETURN_ERR( parse_header( in, size, &file ) );
	set_track_count( file.header->max_track + 1 );
	
	if ( file.header->vers > 2 )
		set_warning( "Unknown file version" );
	
	set_voice_count( osc_count );
	apu.volume( gain() );
	
	return setup_buffer( spectrum_clock );
}
コード例 #16
0
ファイル: AudioGainNode.cpp プロジェクト: sysrqb/chromium-src
void AudioGainNode::process(size_t framesToProcess)
{
    // FIXME: for some cases there is a nice optimization to avoid processing here, and let the gain change
    // happen in the summing junction input of the AudioNode we're connected to.
    // Then we can avoid all of the following:

    AudioBus* outputBus = output(0)->bus();
    ASSERT(outputBus);

    // The realtime thread can't block on this lock, so we call tryLock() instead.
    if (m_processLock.tryLock()) {
        if (!isInitialized() || !input(0)->isConnected())
            outputBus->zero();
        else {
            AudioBus* inputBus = input(0)->bus();

            if (gain()->hasTimelineValues()) {
                // Apply sample-accurate gain scaling for precise envelopes, grain windows, etc.
                ASSERT(framesToProcess <= m_sampleAccurateGainValues.size());
                if (framesToProcess <= m_sampleAccurateGainValues.size()) {
                    float* gainValues = m_sampleAccurateGainValues.data();
                    gain()->calculateSampleAccurateValues(gainValues, framesToProcess);
                    outputBus->copyWithSampleAccurateGainValuesFrom(*inputBus, gainValues, framesToProcess);
                }
            } else {
                // Apply the gain with de-zippering into the output bus.
                outputBus->copyWithGainFrom(*inputBus, &m_lastGain, gain()->value());
            }
        }

        m_processLock.unlock();
    } else {
        // Too bad - the tryLock() failed.  We must be in the middle of re-connecting and were already outputting silence anyway...
        outputBus->zero();
    }
}
コード例 #17
0
ファイル: gain_stream.cpp プロジェクト: rdpoor/mu
 void GainStream::inspect_aux(int level, std::stringstream *ss) {
   MuStream::inspect_aux(level, ss);
   inspect_indent(level, ss);
   *ss << "gain() = " << gain() << std::endl;
   if (signal_source()) {
     inspect_indent(level, ss); 
     *ss << "signal_source()" << std::endl;
     signal_source()->inspect_aux(level+1, ss);
   }
   if (gain_source()) {
     inspect_indent(level, ss); 
     *ss << "gain_source()" << std::endl;
     gain_source()->inspect_aux(level+1, ss);
   }
 }
コード例 #18
0
ファイル: wg06.cpp プロジェクト: PR2/pr2_ethercat_drivers
FTParamsInternal::FTParamsInternal()
{
  // Initial offset = 0.0
  // Gains = 1.0 
  // Calibration coeff = identity matrix
  for (int i=0; i<6; ++i)
  {
    offset(i) = 0.0;
    gain(i) = 1.0;
    for (int j=0; j<6; ++j)
    {
      calibration_coeff(i,j) = (i==j) ? 1.0 : 0.0;
    }
  }
}
コード例 #19
0
ファイル: effects.c プロジェクト: lioncash/droidsound
void uade_effect_run(struct uade_effect *ue, int16_t * samples, int frames)
{
    if (ue->enabled & (1 << UADE_EFFECT_ALLOW)) {
        if( ue->enabled & (1 << UADE_EFFECT_NORMALISE))
            normalise(1, samples, frames);
        if (ue->enabled & (1 << UADE_EFFECT_PAN))
            pan(ue->pan, samples, frames);
        if (ue->enabled & (1 << UADE_EFFECT_HEADPHONES))
            headphones(samples, frames);
        if (ue->enabled & (1 << UADE_EFFECT_HEADPHONES2) && ue->rate)
            headphones2(samples, frames);
        if (ue->enabled & (1 << UADE_EFFECT_GAIN))
            gain(ue->gain, samples, frames);
    }
}
コード例 #20
0
void AudioBufferSourceNode::process(size_t framesToProcess)
{
    AudioBus* outputBus = output(0)->bus();

    if (!isInitialized()) {
        outputBus->zero();
        return;
    }

    // The audio thread can't block on this lock, so we call tryLock() instead.
    MutexTryLocker tryLocker(m_processLock);
    if (tryLocker.locked()) {
        if (!buffer()) {
            outputBus->zero();
            return;
        }

        size_t quantumFrameOffset;
        size_t bufferFramesToProcess;

        updateSchedulingInfo(framesToProcess,
                             outputBus,
                             quantumFrameOffset,
                             bufferFramesToProcess);
                             
        if (!bufferFramesToProcess) {
            outputBus->zero();
            return;
        }

        for (unsigned i = 0; i < outputBus->numberOfChannels(); ++i)
            m_destinationChannels[i] = outputBus->channel(i)->mutableData();

        // Render by reading directly from the buffer.
        if (!renderFromBuffer(outputBus, quantumFrameOffset, bufferFramesToProcess)) {
            outputBus->zero();
            return;
        }

        // Apply the gain (in-place) to the output bus.
        float totalGain = gain()->value() * m_buffer->gain();
        outputBus->copyWithGainFrom(*outputBus, &m_lastGain, totalGain);
        outputBus->clearSilentFlag();
    } else {
        // Too bad - the tryLock() failed.  We must be in the middle of changing buffers and were already outputting silence anyway.
        outputBus->zero();
    }
}
コード例 #21
0
ファイル: functions.c プロジェクト: hating/Ccode
/*
in :
    - attributes is the set of attributes to find the optimal one
    - n_attr is explicit
    - examples is the set of examples used to compute entropy
    - n_ex is explicit
out :
    - int the index
*/
static int optimal_attribute_index_gain(const struct attribute_t *attributes, int n_attr, const struct example_t *examples, int n_ex)
{
    int i,
        ret = 0;
    double min_value = 1.,
           tmp;
    for(i = 0; i < n_attr; ++i)
    {
        if((tmp = gain(&attributes[i], examples, n_ex)) < min_value)
        {
            min_value = tmp;
            ret = i;
        }
    }
    return ret;
}
コード例 #22
0
// Audio clip special process cycle executive.
void qtractorMidiClip::process (
	unsigned long iFrameStart, unsigned long iFrameEnd )
{
#ifdef CONFIG_DEBUG_0
	qDebug("qtractorMidiClip[%p]::process(%lu, %lu)\n",
		this, iFrameStart, iFrameEnd);
#endif

	qtractorTrack *pTrack = track();
	if (pTrack == NULL)
		return;

	qtractorSession *pSession = pTrack->session();
	if (pSession == NULL)
		return;

	qtractorMidiEngine *pMidiEngine = pSession->midiEngine();
	if (pMidiEngine == NULL)
		return;

	qtractorMidiSequence *pSeq = sequence();
	if (pSeq == NULL)
		return;

	// Track mute state...
	const bool bMute = (pTrack->isMute()
		|| (pSession->soloTracks() && !pTrack->isSolo()));

	const unsigned long t0 = pSession->tickFromFrame(clipStart());

	const unsigned long iTimeStart = pSession->tickFromFrame(iFrameStart);
	const unsigned long iTimeEnd   = pSession->tickFromFrame(iFrameEnd);

	// Enqueue the requested events...
	qtractorMidiEvent *pEvent
		= m_playCursor.seek(pSeq, iTimeStart > t0 ? iTimeStart - t0 : 0);
	while (pEvent) {
		const unsigned long t1 = t0 + pEvent->time();
		if (t1 >= iTimeEnd)
			break;
		if (t1 >= iTimeStart
			&& (!bMute || pEvent->type() != qtractorMidiEvent::NOTEON))
			pMidiEngine->enqueue(pTrack, pEvent, t1,
				gain(pSession->frameFromTick(t1) - clipStart()));
		pEvent = pEvent->next();
	}
}
コード例 #23
0
ファイル: CaptureImageState.cpp プロジェクト: Lingrui/TS
// capture gain correction
void CaptureImageState::WriteImageGainCorrection(int rows, int cols)
{
    for (int row = 0; row < rows; row++)
    {
        for (int col = 0; col < cols; col++)
        {
            // no nans allowed!
            assert ( !isnan(ImageTransformer::gain_correction[row*cols + col]) );
        }
    }

    std::string h5_name = h5file + ":/imgGain/gain_corr";
    assert(ImageTransformer::gain_correction != NULL);
    std::vector<float> gain(ImageTransformer::gain_correction, ImageTransformer::gain_correction + rows*cols);
    printf("[CaptureImageState] Writing Image gain correction to %s\n",h5file.c_str());
    H5File::WriteVector (h5_name, gain, false);
}
コード例 #24
0
ファイル: importance.c プロジェクト: hvatum/Skole
/**
 * Information Gain
 */
int
gain_importance(obj** examples, int num_examples, int* attribs, int num_attribs)
{

    double max_gain = -1;
    int max_attrib = 0;
    for (int i = 0; i < num_attribs; i++)
    {
        double current_gain = gain(examples, num_examples, attribs[i]);
        if (current_gain - max_gain > 0.00001) /* > or >= gives a small difference. I found >= to be more accurate with out test data */
        {
            max_gain = current_gain;
            max_attrib = i;
        }
    }
    return attribs[max_attrib];
}
コード例 #25
0
ファイル: msynthesizer.cpp プロジェクト: sbradl/MuseScore
SynthesizerState MasterSynthesizer::state() const
{
    SynthesizerState ss;
    SynthesizerGroup g;
    g.setName("master");
    g.push_back(IdValue(0, QString("%1").arg(_effect[0] ? _effect[0]->name() : "none")));
    g.push_back(IdValue(1, QString("%1").arg(_effect[1] ? _effect[1]->name() : "none")));
    g.push_back(IdValue(2, QString("%1").arg(gain())));
    ss.push_back(g);
    for (Synthesizer* s : _synthesizer)
        ss.push_back(s->state());
    if (_effect[0])
        ss.push_back(_effect[0]->state());
    if (_effect[1])
        ss.push_back(_effect[1]->state());
    return ss;
}
コード例 #26
0
ファイル: PluginProcessor.cpp プロジェクト: OpenDAWN/ambix
float Ambix_directional_loudnessAudioProcessor::getParameter (int index)
{
    int filter_id = (int)floor(index/PARAMS_PER_FILTER);
    
    if (filter_id >= NUM_FILTERS) // safety..
        return 0.f;
    
    switch (index%PARAMS_PER_FILTER) {
            
        case 0:
            return (float)center_sph(filter_id, 0);
            break;
            
        case 1:
            return (float)center_sph(filter_id, 1);
            break;
            
        case 2:
            return shape(filter_id);
            break;
            
        case 3:
            return width(filter_id);
            
        case 4:
            return height(filter_id);
            
            
        case 5:
            return gain(filter_id);
            
            
        case 6:
            return window(filter_id);
            
            
        case 7:
            return transition(filter_id);


        default:
            return 0.0f;
    }
}
コード例 #27
0
ファイル: wg06.cpp プロジェクト: PR2/pr2_ethercat_drivers
void FTParamsInternal::print() const
{
  for (int i=0; i<6; ++i)
  {
    ROS_INFO("offset[%d] = %f", i, offset(i));
  }
  for (int i=0; i<6; ++i)
  {
    ROS_INFO("gain[%d] = %f", i, gain(i));
  }
  for (int i=0; i<6; ++i)
  {
    ROS_INFO("coeff[%d] = [%f,%f,%f,%f,%f,%f]", i, 
             calibration_coeff(i,0), calibration_coeff(i,1), 
             calibration_coeff(i,2), calibration_coeff(i,3), 
             calibration_coeff(i,4), calibration_coeff(i,5)
             );
  }
}
コード例 #28
0
ファイル: dockinputctl.cpp プロジェクト: scottdm/gqrx
void DockInputCtl::saveSettings(QSettings *settings)
{
    qint64 lnb_lo = (qint64)ui->lnbSpinBox->value()*1e6;
    if (lnb_lo)
        settings->setValue("input/lnb_lo", lnb_lo);
    else
        settings->remove("input/lnb_lo");

    double dblval = gain();
    settings->setValue("input/gain", dblval);

    if (freqCorr())
        settings->setValue("input/corr_freq", freqCorr());
    else
        settings->remove("input/corr_freq");

    if (iqSwap())
        settings->setValue("input/swap_iq", true);
    else
        settings->remove("input/swap_iq");

    if (dcCancel())
        settings->setValue("input/dc_cancel", true);
    else
        settings->remove("input/dc_cancel");

    if (iqBalance())
        settings->setValue("input/iq_balance", true);
    else
        settings->remove("input/iq_balance");

    if (ignoreLimits())
        settings->setValue("input/ignore_limits", true);
    else
        settings->remove("input/ignore_limits");

    // save antenna selection if there is more than one option
    if (ui->antSelector->count() > 1)
        settings->setValue("input/antenna", ui->antSelector->currentText());
    else
        settings->remove("input/antenna");
}
コード例 #29
0
blargg_err_t Sap_Emu::load_mem_( byte const* in, long size )
{
	file_end = in + size;
	
	info.warning    = 0;
	info.type       = 'B';
	info.stereo     = false;
	info.init_addr  = -1;
	info.play_addr  = -1;
	info.music_addr = -1;
	info.fastplay   = 312;
	RETURN_ERR( parse_info( in, size, &info ) );
	
	set_warning( info.warning );
	set_track_count( info.track_count );
	set_voice_count( Sap_Apu::osc_count << info.stereo );
	apu_impl.volume( gain() );
	
	return setup_buffer( 1773447 );
}
コード例 #30
0
ファイル: Gbs_Emu.cpp プロジェクト: iOSAppList/modizer
blargg_err_t Gbs_Emu::load_( Data_Reader& in )
{
	RETURN_ERR( core_.load( in ) );
	set_warning( core_.warning() );
	set_track_count( header().track_count );
	set_voice_count( Gb_Apu::osc_count );
	core_.apu().volume( gain() );
	
	static const char* const names [Gb_Apu::osc_count] = {
		"Square 1", "Square 2", "Wave", "Noise"
	};
	set_voice_names( names );
	
	static int const types [Gb_Apu::osc_count] = {
		wave_type+1, wave_type+2, wave_type+3, mixed_type+1
	};
	set_voice_types( types );
	
	return setup_buffer( 4194304 );
}