void LLAudioSourceVO::update() { if (!mObjectp) { return; } if (mObjectp->isDead()) { mObjectp = NULL; return; } updateGain(); if (mObjectp->isHUDAttachment()) { mPositionGlobal = gAgent.getCameraPositionGlobal(); } else { mPositionGlobal = mObjectp->getPositionGlobal(); } if (mObjectp->getSubParent()) { mVelocity = mObjectp->getSubParent()->getVelocity(); } else { mVelocity = mObjectp->getVelocity(); } LLAudioSource::update(); }
bool sdrServer::needPacket(mySocket *socket) { short *i, *q; uint8_t *s; int count = mSdrPlay.getSamplesPerPacket(); bool grChanged, rfChanged, fsChanged; try { if(mFrequencyChanged) updateFrequency(); if(mSamplerateChanged) updateSampleRate(); if(mGainChanged) updateGain(); if(mSdrPlay.readPacket(mI, mQ, &grChanged, &rfChanged, &fsChanged) == 0) { for(i=mI, q=mQ, s=mS; i<mI+count; i++, q++) { *(s++) = (uint8_t)((*i>>8)+128); *(s++) = (uint8_t)((*q>>8)+128); } socket->send(mS, (size_t) count * 2); } } catch(error *e) { printf("%s\n", e->text()); return false; } return true; }
void CDPlayer::setGain(float gain) { m_gain = gain; updateGain(); m_pluginLoader.trackVolumeChanged(getName().toRawUTF8(), "", m_gain); std::for_each(m_listeners.begin(), m_listeners.end(), std::bind(&MixerControlableChangeListener::gainChanged, std::placeholders::_1, gain)); }
void ChannelVolumeAudioSource::setChannelMute(int channelIndex, bool mute) { const ScopedLock sl(m_lock); m_setMutes.set(channelIndex, mute); updateGain(channelIndex); }
void ChannelVolumeAudioSource::setChannelVolume(size_t channelIndex, float gain) { const ScopedLock sl(m_lock); m_setVolumes.set(channelIndex, gain); updateGain(channelIndex); }
LLAudioSourceVO::LLAudioSourceVO(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain, LLViewerObject *objectp) : LLAudioSource(sound_id, owner_id, gain), mObjectp(objectp), mActualGain(gain) { setAmbient(FALSE); updateGain(); update(); }
void CDPlayer::setSolo(bool solo) { m_solo = solo; if (m_soloBusSettings.isConfigured()) m_remappingAudioSource.setSolo(solo); else updateGain(); std::for_each(m_listeners.begin(), m_listeners.end(), std::bind(&MixerControlableChangeListener::soloChanged, std::placeholders::_1, solo)); }
void ChannelVolumeAudioSource::setChannelSolo(int channelIndex, bool solo) { const ScopedLock sl(m_lock); m_setSolos.set(channelIndex, solo); const bool anySolo = std::any_of(m_setSolos.begin(), m_setSolos.end(), [](bool solo) { return solo; }); if (m_anySolo != anySolo) { // need to update every channel gain m_anySolo = anySolo; for (int i = 0; i < m_appliedGains.size(); ++i) updateGain(i); } else { updateGain(channelIndex); } }
void PlayerWidget::_setupSource() { setUpdatesEnabled( false ); const bool hasAudioSource = audioSource_ != 0; setEnabled( hasAudioSource ); // inititialized-invariant values ui_.labelFileName->setText( hasAudioSource ? QFileInfo( playerInfo_->filePath ).fileName() : QString() ); ui_.buttonDestroy->setEnabled( hasAudioSource ); _updateStateLabels(); updateLoop(); updateGain(); updatePitch(); // initialized-depended values _updateSourceInitialization(); setUpdatesEnabled( true ); }
void sf2Instrument::loadSettings( const QDomElement & _this ) { openFile( _this.attribute( "src" ), false ); m_patchNum.loadSettings( _this, "patch" ); m_bankNum.loadSettings( _this, "bank" ); m_gain.loadSettings( _this, "gain" ); m_reverbOn.loadSettings( _this, "reverbOn" ); m_reverbRoomSize.loadSettings( _this, "reverbRoomSize" ); m_reverbDamping.loadSettings( _this, "reverbDamping" ); m_reverbWidth.loadSettings( _this, "reverbWidth" ); m_reverbLevel.loadSettings( _this, "reverbLevel" ); m_chorusOn.loadSettings( _this, "chorusOn" ); m_chorusNum.loadSettings( _this, "chorusNum" ); m_chorusLevel.loadSettings( _this, "chorusLevel" ); m_chorusSpeed.loadSettings( _this, "chorusSpeed" ); m_chorusDepth.loadSettings( _this, "chorusDepth" ); updatePatch(); updateGain(); }
void LLAudioSourceVO::setGain(const F32 gain) { mActualGain = llclamp(gain, 0.f, 1.f); updateGain(); }
sf2Instrument::sf2Instrument( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &sf2player_plugin_descriptor ), m_srcState( NULL ), m_font( NULL ), m_fontId( 0 ), m_filename( "" ), m_lastMidiPitch( -1 ), m_lastMidiPitchRange( -1 ), m_channel( 1 ), m_bankNum( 0, 0, 999, this, tr("Bank") ), m_patchNum( 0, 0, 127, this, tr("Patch") ), m_gain( 1.0f, 0.0f, 5.0f, 0.01f, this, tr( "Gain" ) ), m_reverbOn( false, this, tr( "Reverb" ) ), m_reverbRoomSize( FLUID_REVERB_DEFAULT_ROOMSIZE, 0, 1.0, 0.01f, this, tr( "Reverb room size" ) ), m_reverbDamping( FLUID_REVERB_DEFAULT_DAMP, 0, 1.0, 0.01, this, tr( "Reverb damping" ) ), m_reverbWidth( FLUID_REVERB_DEFAULT_WIDTH, 0, 1.0, 0.01f, this, tr( "Reverb width" ) ), m_reverbLevel( FLUID_REVERB_DEFAULT_LEVEL, 0, 1.0, 0.01f, this, tr( "Reverb level" ) ), m_chorusOn( false, this, tr( "Chorus" ) ), m_chorusNum( FLUID_CHORUS_DEFAULT_N, 0, 10.0, 1.0, this, tr( "Chorus voices" ) ), m_chorusLevel( FLUID_CHORUS_DEFAULT_LEVEL, 0, 10.0, 0.01, this, tr( "Chorus level" ) ), m_chorusSpeed( FLUID_CHORUS_DEFAULT_SPEED, 0.29, 5.0, 0.01, this, tr( "Chorus speed" ) ), m_chorusDepth( FLUID_CHORUS_DEFAULT_DEPTH, 0, 46.0, 0.05, this, tr( "Chorus depth" ) ) { for( int i = 0; i < 128; ++i ) { m_notesRunning[i] = 0; } #if QT_VERSION_CHECK(FLUIDSYNTH_VERSION_MAJOR, FLUIDSYNTH_VERSION_MINOR, FLUIDSYNTH_VERSION_MICRO) >= QT_VERSION_CHECK(1,1,9) // Deactivate all audio drivers in fluidsynth const char *none[] = { NULL }; fluid_audio_driver_register( none ); #endif m_settings = new_fluid_settings(); //fluid_settings_setint( m_settings, (char *) "audio.period-size", engine::mixer()->framesPerPeriod() ); // This is just our starting instance of synth. It is recreated // everytime we load a new soundfont. m_synth = new_fluid_synth( m_settings ); #if FLUIDSYNTH_VERSION_MAJOR >= 2 // Get the default values from the setting double settingVal; fluid_settings_getnum_default(m_settings, "synth.reverb.room-size", &settingVal); m_reverbRoomSize.setInitValue(settingVal); fluid_settings_getnum_default(m_settings, "synth.reverb.damping", &settingVal); m_reverbDamping.setInitValue(settingVal); fluid_settings_getnum_default(m_settings, "synth.reverb.width", &settingVal); m_reverbWidth.setInitValue(settingVal); fluid_settings_getnum_default(m_settings, "synth.reverb.level", &settingVal); m_reverbLevel.setInitValue(settingVal); fluid_settings_getnum_default(m_settings, "synth.chorus.nr", &settingVal); m_chorusNum.setInitValue(settingVal); fluid_settings_getnum_default(m_settings, "synth.chorus.level", &settingVal); m_chorusLevel.setInitValue(settingVal); fluid_settings_getnum_default(m_settings, "synth.chorus.speed", &settingVal); m_chorusSpeed.setInitValue(settingVal); fluid_settings_getnum_default(m_settings, "synth.chorus.depth", &settingVal); m_chorusDepth.setInitValue(settingVal); #endif loadFile( ConfigManager::inst()->defaultSoundfont() ); updateSampleRate(); updateReverbOn(); updateReverb(); updateChorusOn(); updateChorus(); updateGain(); connect( &m_bankNum, SIGNAL( dataChanged() ), this, SLOT( updatePatch() ) ); connect( &m_patchNum, SIGNAL( dataChanged() ), this, SLOT( updatePatch() ) ); connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) ); // Gain connect( &m_gain, SIGNAL( dataChanged() ), this, SLOT( updateGain() ) ); // Reverb connect( &m_reverbOn, SIGNAL( dataChanged() ), this, SLOT( updateReverbOn() ) ); connect( &m_reverbRoomSize, SIGNAL( dataChanged() ), this, SLOT( updateReverb() ) ); connect( &m_reverbDamping, SIGNAL( dataChanged() ), this, SLOT( updateReverb() ) ); connect( &m_reverbWidth, SIGNAL( dataChanged() ), this, SLOT( updateReverb() ) ); connect( &m_reverbLevel, SIGNAL( dataChanged() ), this, SLOT( updateReverb() ) ); // Chorus connect( &m_chorusOn, SIGNAL( dataChanged() ), this, SLOT( updateChorusOn() ) ); connect( &m_chorusNum, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) ); connect( &m_chorusLevel, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) ); connect( &m_chorusSpeed, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) ); connect( &m_chorusDepth, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) ); InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrument_track ); Engine::mixer()->addPlayHandle( iph ); }
void CDPlayer::setMute(bool mute) { m_mute = mute; updateGain(); }
void CDPlayer::soloBusChannelChanged(SoloBusChannel channel, int outputChannel, int previousOutputChannel) { ignoreUnused(channel, outputChannel, previousOutputChannel); updateGain(); }
// Gain accessors. void qtractorMixerMeter::setGain ( float fGain ) { m_pGainObserver->setValue(fGain); monitor()->update(); updateGain(); }
void sf2Instrument::updateSampleRate() { double tempRate; // Set & get, returns the true sample rate fluid_settings_setnum( m_settings, (char *) "synth.sample-rate", engine::mixer()->processingSampleRate() ); fluid_settings_getnum( m_settings, (char *) "synth.sample-rate", &tempRate ); m_internalSampleRate = static_cast<int>( tempRate ); if( m_font ) { // Now, delete the old one and replace m_synthMutex.lock(); fluid_synth_remove_sfont( m_synth, m_font->fluidFont ); delete_fluid_synth( m_synth ); // New synth m_synth = new_fluid_synth( m_settings ); m_fontId = fluid_synth_add_sfont( m_synth, m_font->fluidFont ); m_synthMutex.unlock(); // synth program change (set bank and patch) updatePatch(); updateGain(); } else { // Recreate synth with no soundfonts m_synthMutex.lock(); delete_fluid_synth( m_synth ); m_synth = new_fluid_synth( m_settings ); m_synthMutex.unlock(); } m_synthMutex.lock(); if( engine::mixer()->currentQualitySettings().interpolation >= Mixer::qualitySettings::Interpolation_SincFastest ) { fluid_synth_set_interp_method( m_synth, -1, FLUID_INTERP_7THORDER ); } else { fluid_synth_set_interp_method( m_synth, -1, FLUID_INTERP_DEFAULT ); } m_synthMutex.unlock(); if( m_internalSampleRate < engine::mixer()->processingSampleRate() ) { m_synthMutex.lock(); if( m_srcState != NULL ) { src_delete( m_srcState ); } int error; m_srcState = src_new( engine::mixer()->currentQualitySettings().libsrcInterpolation(), DEFAULT_CHANNELS, &error ); if( m_srcState == NULL || error ) { qCritical( "error while creating libsamplerate data structure in Sf2Instrument::updateSampleRate()" ); } m_synthMutex.unlock(); } updateReverb(); updateChorus(); }
void CDPlayer::setSoloMute(bool soloMute) { m_soloMute = soloMute; updateGain(); }
sf2Instrument::sf2Instrument( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &sf2player_plugin_descriptor ), m_srcState( NULL ), m_font( NULL ), m_fontId( 0 ), m_filename( "" ), m_lastMidiPitch( -1 ), m_lastMidiPitchRange( -1 ), m_channel( 1 ), m_bankNum( 0, 0, 999, this, tr("Bank") ), m_patchNum( 0, 0, 127, this, tr("Patch") ), m_gain( 1.0f, 0.0f, 5.0f, 0.01f, this, tr( "Gain" ) ), m_reverbOn( false, this, tr( "Reverb" ) ), m_reverbRoomSize( FLUID_REVERB_DEFAULT_ROOMSIZE, 0, 1.0, 0.01f, this, tr( "Reverb Roomsize" ) ), m_reverbDamping( FLUID_REVERB_DEFAULT_DAMP, 0, 1.0, 0.01, this, tr( "Reverb Damping" ) ), m_reverbWidth( FLUID_REVERB_DEFAULT_WIDTH, 0, 1.0, 0.01f, this, tr( "Reverb Width" ) ), m_reverbLevel( FLUID_REVERB_DEFAULT_LEVEL, 0, 1.0, 0.01f, this, tr( "Reverb Level" ) ), m_chorusOn( false, this, tr( "Chorus" ) ), m_chorusNum( FLUID_CHORUS_DEFAULT_N, 0, 10.0, 1.0, this, tr( "Chorus Lines" ) ), m_chorusLevel( FLUID_CHORUS_DEFAULT_LEVEL, 0, 10.0, 0.01, this, tr( "Chorus Level" ) ), m_chorusSpeed( FLUID_CHORUS_DEFAULT_SPEED, 0.29, 5.0, 0.01, this, tr( "Chorus Speed" ) ), m_chorusDepth( FLUID_CHORUS_DEFAULT_DEPTH, 0, 46.0, 0.05, this, tr( "Chorus Depth" ) ) { for( int i = 0; i < 128; ++i ) { m_notesRunning[i] = 0; } m_settings = new_fluid_settings(); fluid_settings_setint( m_settings, (char *) "audio.period-size", engine::mixer()->framesPerPeriod() ); // This is just our starting instance of synth. It is recreated // everytime we load a new soundfont. m_synth = new_fluid_synth( m_settings ); InstrumentPlayHandle * iph = new InstrumentPlayHandle( this ); engine::mixer()->addPlayHandle( iph ); loadFile( configManager::inst()->defaultSoundfont() ); updateSampleRate(); updateReverbOn(); updateReverb(); updateChorusOn(); updateChorus(); updateGain(); connect( &m_bankNum, SIGNAL( dataChanged() ), this, SLOT( updatePatch() ) ); connect( &m_patchNum, SIGNAL( dataChanged() ), this, SLOT( updatePatch() ) ); connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) ); // Gain connect( &m_gain, SIGNAL( dataChanged() ), this, SLOT( updateGain() ) ); // Reverb connect( &m_reverbOn, SIGNAL( dataChanged() ), this, SLOT( updateReverbOn() ) ); connect( &m_reverbRoomSize, SIGNAL( dataChanged() ), this, SLOT( updateReverb() ) ); connect( &m_reverbDamping, SIGNAL( dataChanged() ), this, SLOT( updateReverb() ) ); connect( &m_reverbWidth, SIGNAL( dataChanged() ), this, SLOT( updateReverb() ) ); connect( &m_reverbLevel, SIGNAL( dataChanged() ), this, SLOT( updateReverb() ) ); // Chorus connect( &m_chorusOn, SIGNAL( dataChanged() ), this, SLOT( updateChorusOn() ) ); connect( &m_chorusNum, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) ); connect( &m_chorusLevel, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) ); connect( &m_chorusSpeed, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) ); connect( &m_chorusDepth, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) ); }
//----------------------------------------------------------------------------- void GuiEditor::valueChanged (CControl* control) { //effect->setParameterAutomated (control->getTag (), control->getValue ()); float value; int ival; const char* text; std::string result; char* tempt; switch (control->getTag()) { case kBufferSize: ((COptionMenu*)(control))->getCurrent(tempt); ival = ((COptionMenu*)(control))->getIndex(tempt); updateBufferSize(ival); break; case kGain: value = control->getValue(); result = floatToString(value*maxGain); gainDisplay->setText(result.c_str()); updateGain(value*maxGain); break; case kGainText: text = ((CTextEdit*)(control))->getText(); value = charToFloat(text); gainFader->setValue(value/(float)maxGain); updateGain(value); break; case kXScale: value = control->getValue(); result = floatToString(value*maxXScale); xScaleDisplay->setText(result.c_str()); updateXScale(value*maxXScale); break; case kXScaleText: text = ((CTextEdit*)(control))->getText(); value = charToFloat(text); xScaleFader->setValue(value/(float)maxXScale); updateXScale(value); break; case kYScale: value = control->getValue(); result = floatToString(value*maxYScale); yScaleDisplay->setText(result.c_str()); updateYScale(value*maxYScale); break; case kYScaleText: text = ((CTextEdit*)(control))->getText(); value = charToFloat(text); yScaleFader->setValue(value/(float)maxYScale); updateYScale(value); break; case kResponse: value = control->getValue(); result = floatToString(value); responseDisplay->setText(result.c_str()); updateResponse(value); break; case kResponseText: text = ((CTextEdit*)(control))->getText(); value = charToFloat(text); responseFader->setValue(value); updateResponse(value); break; case kBands: ival = (int)(control->getValue()*maxBands); result = intToString(ival); bandsDisplay->setText(result.c_str()); bandsFader->setValue(((float)ival)/(float)maxBands); updateBands(ival); break; case kBandsText: text = ((CTextEdit*)(control))->getText(); ival = charToInt(text); bandsFader->setValue((float)value/(float)maxBands); updateBands(ival); break; case kAmpScale: ((COptionMenu*)(control))->getCurrent(tempt); ival = ((COptionMenu*)(control))->getIndex(tempt); updateAmpScale(ival); break; case kType: ((COptionMenu*)(control))->getCurrent(tempt); ival = ((COptionMenu*)(control))->getIndex(tempt); updateType(ival); break; case kDisplay: ((COptionMenu*)(control))->getCurrent(tempt); ival = ((COptionMenu*)(control))->getIndex(tempt); updateDisplayt(ival); break; case kResampling: ((COptionMenu*)(control))->getCurrent(tempt); ival = ((COptionMenu*)(control))->getIndex(tempt); updateResampling(ival); break; case kFreqScale: ((COptionMenu*)(control))->getCurrent(tempt); ival = ((COptionMenu*)(control))->getIndex(tempt); updateFreqScale(ival); break; case kAddress: text = ((CTextEdit*)(control))->getText(); updateAddress(text); break; case kPort: text = ((CTextEdit*)(control))->getText(); ival = charToInt(text); updatePort(ival); break; case kHost: text = ((CTextEdit*)(control))->getText(); updateHost(text); break; } }