--- linuxsampler/trunk/src/engines/gig/Voice.cpp 2005/10/30 08:35:13 796 +++ linuxsampler/trunk/src/engines/gig/Voice.cpp 2006/07/22 14:22:53 903 @@ -3,7 +3,7 @@ * LinuxSampler - modular, streaming capable sampler * * * * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * - * Copyright (C) 2005 Christian Schoenebeck * + * Copyright (C) 2005, 2006 Christian Schoenebeck * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -29,12 +29,6 @@ namespace LinuxSampler { namespace gig { - const float Voice::FILTER_CUTOFF_COEFF(CalculateFilterCutoffCoeff()); - - float Voice::CalculateFilterCutoffCoeff() { - return log(CONFIG_FILTER_CUTOFF_MAX / CONFIG_FILTER_CUTOFF_MIN); - } - Voice::Voice() { pEngine = NULL; pDiskThread = NULL; @@ -104,9 +98,12 @@ // calculate volume const double velocityAttenuation = pDimRgn->GetVelocityAttenuation(itNoteOnEvent->Param.Note.Velocity); - Volume = velocityAttenuation / 32768.0f; // we downscale by 32768 to convert from int16 value range to DSP value range (which is -1.0..1.0) + // For 16 bit samples, we downscale by 32768 to convert from + // int16 value range to DSP value range (which is + // -1.0..1.0). For 24 bit, we downscale from int32. + float volume = velocityAttenuation / (pSample->BitDepth == 16 ? 32768.0f : 32768.0f * 65536.0f); - Volume *= pDimRgn->SampleAttenuation; + volume *= pDimRgn->SampleAttenuation; // the volume of release triggered samples depends on note length if (Type == type_release_trigger) { @@ -114,30 +111,39 @@ pEngineChannel->pMIDIKeyInfo[MIDIKey].NoteOnTime) / pEngine->SampleRate; float attenuation = 1 - 0.01053 * (256 >> pDimRgn->ReleaseTriggerDecay) * noteLength; if (attenuation <= 0) return -1; - Volume *= attenuation; + volume *= attenuation; } // select channel mode (mono or stereo) SYNTHESIS_MODE_SET_CHANNELS(SynthesisMode, pSample->Channels == 2); + // select bit depth (16 or 24) + SYNTHESIS_MODE_SET_BITDEPTH24(SynthesisMode, pSample->BitDepth == 24); // get starting crossfade volume level + float crossfadeVolume; switch (pDimRgn->AttenuationController.type) { case ::gig::attenuation_ctrl_t::type_channelaftertouch: - CrossfadeVolume = 1.0f; //TODO: aftertouch not supported yet + crossfadeVolume = Engine::CrossfadeCurve[CrossfadeAttenuation(pEngineChannel->ControllerTable[128])]; break; case ::gig::attenuation_ctrl_t::type_velocity: - CrossfadeVolume = CrossfadeAttenuation(itNoteOnEvent->Param.Note.Velocity); + crossfadeVolume = Engine::CrossfadeCurve[CrossfadeAttenuation(itNoteOnEvent->Param.Note.Velocity)]; break; case ::gig::attenuation_ctrl_t::type_controlchange: //FIXME: currently not sample accurate - CrossfadeVolume = CrossfadeAttenuation(pEngineChannel->ControllerTable[pDimRgn->AttenuationController.controller_number]); + crossfadeVolume = Engine::CrossfadeCurve[CrossfadeAttenuation(pEngineChannel->ControllerTable[pDimRgn->AttenuationController.controller_number])]; break; case ::gig::attenuation_ctrl_t::type_none: // no crossfade defined default: - CrossfadeVolume = 1.0f; + crossfadeVolume = 1.0f; } - PanLeft = 1.0f - float(RTMath::Max(pDimRgn->Pan, 0)) / 63.0f; - PanRight = 1.0f - float(RTMath::Min(pDimRgn->Pan, 0)) / -64.0f; + VolumeLeft = volume * Engine::PanCurve[64 - pDimRgn->Pan]; + VolumeRight = volume * Engine::PanCurve[64 + pDimRgn->Pan]; + + float subfragmentRate = pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE; + CrossfadeSmoother.trigger(crossfadeVolume, subfragmentRate); + VolumeSmoother.trigger(pEngineChannel->GlobalVolume, subfragmentRate); + PanLeftSmoother.trigger(pEngineChannel->GlobalPanLeft, subfragmentRate); + PanRightSmoother.trigger(pEngineChannel->GlobalPanRight, subfragmentRate); finalSynthesisParameters.dPos = pDimRgn->SampleStartOffset; // offset where we should start playback of sample (0 - 2000 sample points) Pos = pDimRgn->SampleStartOffset; @@ -146,21 +152,15 @@ long cachedsamples = pSample->GetCache().Size / pSample->FrameSize; DiskVoice = cachedsamples < pSample->SamplesTotal; + const DLS::sample_loop_t& loopinfo = pDimRgn->pSampleLoops[0]; + if (DiskVoice) { // voice to be streamed from disk MaxRAMPos = cachedsamples - (pEngine->MaxSamplesPerCycle << CONFIG_MAX_PITCH) / pSample->Channels; //TODO: this calculation is too pessimistic and may better be moved to Render() method, so it calculates MaxRAMPos dependent to the current demand of sample points to be rendered (e.g. in case of JACK) // check if there's a loop defined which completely fits into the cached (RAM) part of the sample - if (pSample->Loops && pSample->LoopEnd <= MaxRAMPos) { - RAMLoop = true; - loop.uiTotalCycles = pSample->LoopPlayCount; - loop.uiCyclesLeft = pSample->LoopPlayCount; - loop.uiStart = pSample->LoopStart; - loop.uiEnd = pSample->LoopEnd; - loop.uiSize = pSample->LoopSize; - } - else RAMLoop = false; + RAMLoop = (pDimRgn->SampleLoops && (loopinfo.LoopStart + loopinfo.LoopLength) <= MaxRAMPos); - if (pDiskThread->OrderNewStream(&DiskStreamRef, pSample, MaxRAMPos, !RAMLoop) < 0) { + if (pDiskThread->OrderNewStream(&DiskStreamRef, pDimRgn, MaxRAMPos, !RAMLoop) < 0) { dmsg(1,("Disk stream order failed!\n")); KillImmediately(); return -1; @@ -169,14 +169,16 @@ } else { // RAM only voice MaxRAMPos = cachedsamples; - if (pSample->Loops) { - RAMLoop = true; - loop.uiCyclesLeft = pSample->LoopPlayCount; - } - else RAMLoop = false; + RAMLoop = (pDimRgn->SampleLoops != 0); dmsg(4,("RAM only voice launched (Looping: %s)\n", (RAMLoop) ? "yes" : "no")); } - + if (RAMLoop) { + loop.uiTotalCycles = pSample->LoopPlayCount; + loop.uiCyclesLeft = pSample->LoopPlayCount; + loop.uiStart = loopinfo.LoopStart; + loop.uiEnd = loopinfo.LoopStart + loopinfo.LoopLength; + loop.uiSize = loopinfo.LoopLength; + } // calculate initial pitch value { @@ -198,7 +200,7 @@ eg1controllervalue = 0; break; case ::gig::eg1_ctrl_t::type_channelaftertouch: - eg1controllervalue = 0; // TODO: aftertouch not yet supported + eg1controllervalue = pEngineChannel->ControllerTable[128]; break; case ::gig::eg1_ctrl_t::type_velocity: eg1controllervalue = itNoteOnEvent->Param.Note.Velocity; @@ -229,6 +231,23 @@ pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); } +#ifdef CONFIG_INTERPOLATE_VOLUME + // setup initial volume in synthesis parameters +#ifdef CONFIG_PROCESS_MUTED_CHANNELS + if (pEngineChannel->GetMute()) { + finalSynthesisParameters.fFinalVolumeLeft = 0; + finalSynthesisParameters.fFinalVolumeRight = 0; + } + else +#else + { + float finalVolume = pEngineChannel->GlobalVolume * crossfadeVolume * EG1.getLevel(); + + finalSynthesisParameters.fFinalVolumeLeft = finalVolume * VolumeLeft * pEngineChannel->GlobalPanLeft; + finalSynthesisParameters.fFinalVolumeRight = finalVolume * VolumeRight * pEngineChannel->GlobalPanRight; + } +#endif +#endif // setup EG 2 (VCF Cutoff EG) { @@ -239,7 +258,7 @@ eg2controllervalue = 0; break; case ::gig::eg2_ctrl_t::type_channelaftertouch: - eg2controllervalue = 0; // TODO: aftertouch not yet supported + eg2controllervalue = pEngineChannel->ControllerTable[128]; break; case ::gig::eg2_ctrl_t::type_velocity: eg2controllervalue = itNoteOnEvent->Param.Note.Velocity; @@ -270,8 +289,16 @@ // setup EG 3 (VCO EG) { - double eg3depth = RTMath::CentsToFreqRatio(pDimRgn->EG3Depth); - EG3.trigger(eg3depth, pDimRgn->EG3Attack, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); + // if portamento mode is on, we dedicate EG3 purely for portamento, otherwise if portamento is off we do as told by the patch + bool bPortamento = pEngineChannel->PortamentoMode && pEngineChannel->PortamentoPos >= 0.0f; + float eg3depth = (bPortamento) + ? RTMath::CentsToFreqRatio((pEngineChannel->PortamentoPos - (float) MIDIKey) * 100) + : RTMath::CentsToFreqRatio(pDimRgn->EG3Depth); + float eg3time = (bPortamento) + ? pEngineChannel->PortamentoTime + : pDimRgn->EG3Attack; + EG3.trigger(eg3depth, eg3time, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); + dmsg(5,("PortamentoPos=%f, depth=%f, time=%f\n", pEngineChannel->PortamentoPos, eg3depth, eg3time)); } @@ -309,12 +336,15 @@ pLFO1->ExtController = 0; // no external controller bLFO1Enabled = false; } - if (bLFO1Enabled) pLFO1->trigger(pDimRgn->LFO1Frequency, - start_level_max, - lfo1_internal_depth, - pDimRgn->LFO1ControlDepth, - pDimRgn->LFO1FlipPhase, - pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); + if (bLFO1Enabled) { + pLFO1->trigger(pDimRgn->LFO1Frequency, + start_level_max, + lfo1_internal_depth, + pDimRgn->LFO1ControlDepth, + pDimRgn->LFO1FlipPhase, + pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); + pLFO1->update(pLFO1->ExtController ? pEngineChannel->ControllerTable[pLFO1->ExtController] : 0); + } } @@ -352,12 +382,15 @@ pLFO2->ExtController = 0; // no external controller bLFO2Enabled = false; } - if (bLFO2Enabled) pLFO2->trigger(pDimRgn->LFO2Frequency, - start_level_max, - lfo2_internal_depth, - pDimRgn->LFO2ControlDepth, - pDimRgn->LFO2FlipPhase, - pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); + if (bLFO2Enabled) { + pLFO2->trigger(pDimRgn->LFO2Frequency, + start_level_max, + lfo2_internal_depth, + pDimRgn->LFO2ControlDepth, + pDimRgn->LFO2FlipPhase, + pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); + pLFO2->update(pLFO2->ExtController ? pEngineChannel->ControllerTable[pLFO2->ExtController] : 0); + } } @@ -377,8 +410,8 @@ break; case ::gig::lfo3_ctrl_aftertouch: lfo3_internal_depth = 0; - pLFO3->ExtController = 0; // TODO: aftertouch not implemented yet - bLFO3Enabled = false; // see TODO comment in line above + pLFO3->ExtController = 128; + bLFO3Enabled = true; break; case ::gig::lfo3_ctrl_internal_modwheel: lfo3_internal_depth = pDimRgn->LFO3InternalDepth; @@ -387,20 +420,23 @@ break; case ::gig::lfo3_ctrl_internal_aftertouch: lfo3_internal_depth = pDimRgn->LFO3InternalDepth; - pLFO1->ExtController = 0; // TODO: aftertouch not implemented yet - bLFO3Enabled = (lfo3_internal_depth > 0 /*|| pDimRgn->LFO3ControlDepth > 0*/); // see TODO comment in line above + pLFO1->ExtController = 128; + bLFO3Enabled = (lfo3_internal_depth > 0 || pDimRgn->LFO3ControlDepth > 0); break; default: lfo3_internal_depth = 0; pLFO3->ExtController = 0; // no external controller bLFO3Enabled = false; } - if (bLFO3Enabled) pLFO3->trigger(pDimRgn->LFO3Frequency, - start_level_mid, - lfo3_internal_depth, - pDimRgn->LFO3ControlDepth, - false, - pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); + if (bLFO3Enabled) { + pLFO3->trigger(pDimRgn->LFO3Frequency, + start_level_mid, + lfo3_internal_depth, + pDimRgn->LFO3ControlDepth, + false, + pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); + pLFO3->update(pLFO3->ExtController ? pEngineChannel->ControllerTable[pLFO3->ExtController] : 0); + } } @@ -442,7 +478,9 @@ case ::gig::vcf_cutoff_ctrl_genpurpose8: VCFCutoffCtrl.controller = 83; break; - case ::gig::vcf_cutoff_ctrl_aftertouch: //TODO: not implemented yet + case ::gig::vcf_cutoff_ctrl_aftertouch: + VCFCutoffCtrl.controller = 128; + break; case ::gig::vcf_cutoff_ctrl_none: default: VCFCutoffCtrl.controller = 0; @@ -500,15 +538,13 @@ else { cvalue = pDimRgn->VCFCutoff; } - cutoff *= float(cvalue) * 0.00787402f; // (1 / 127) - if (cutoff > 1.0) cutoff = 1.0; - cutoff = (cutoff < 0.5 ? cutoff * 4826 - 1 : cutoff * 5715 - 449); - if (cutoff < 1.0) cutoff = 1.0; + cutoff *= float(cvalue); + if (cutoff > 127.0f) cutoff = 127.0f; // calculate resonance - float resonance = (float) (VCFResonanceCtrl.controller ? VCFResonanceCtrl.value : pDimRgn->VCFResonance) * 0.00787f; // 0.0..1.0 + float resonance = (float) (VCFResonanceCtrl.controller ? VCFResonanceCtrl.value : pDimRgn->VCFResonance); - VCFCutoffCtrl.fvalue = cutoff - 1.0; + VCFCutoffCtrl.fvalue = cutoff; VCFResonanceCtrl.fvalue = resonance; } else { @@ -585,7 +621,7 @@ } } - sample_t* ptr = DiskStreamRef.pStream->GetReadPtr(); // get the current read_ptr within the ringbuffer where we read the samples from + sample_t* ptr = (sample_t*)DiskStreamRef.pStream->GetReadPtr(); // get the current read_ptr within the ringbuffer where we read the samples from // render current audio fragment Synthesize(Samples, ptr, Delay); @@ -638,7 +674,7 @@ * for the given time. * * @param itEvent - iterator pointing to the next event to be processed - * @param End - youngest time stamp where processing should be stopped + * @param End - youngest time stamp where processing should be stopped */ void Voice::processTransitionEvents(RTList::Iterator& itEvent, uint End) { for (; itEvent && itEvent->FragmentPos() <= End; ++itEvent) { @@ -657,7 +693,7 @@ * the given time. * * @param itEvent - iterator pointing to the next event to be processed - * @param End - youngest time stamp where processing should be stopped + * @param End - youngest time stamp where processing should be stopped */ void Voice::processCCEvents(RTList::Iterator& itEvent, uint End) { for (; itEvent && itEvent->FragmentPos() <= End; ++itEvent) { @@ -680,7 +716,13 @@ } if (pDimRgn->AttenuationController.type == ::gig::attenuation_ctrl_t::type_controlchange && itEvent->Param.CC.Controller == pDimRgn->AttenuationController.controller_number) { - processCrossFadeEvent(itEvent); + CrossfadeSmoother.update(Engine::CrossfadeCurve[CrossfadeAttenuation(itEvent->Param.CC.Value)]); + } + if (itEvent->Param.CC.Controller == 7) { // volume + VolumeSmoother.update(Engine::VolumeCurve[itEvent->Param.CC.Value] * CONFIG_GLOBAL_ATTENUATION); + } else if (itEvent->Param.CC.Controller == 10) { // panpot + PanLeftSmoother.update(Engine::PanCurve[128 - itEvent->Param.CC.Value]); + PanRightSmoother.update(Engine::PanCurve[itEvent->Param.CC.Value]); } } else if (itEvent->Type == Event::type_pitchbend) { // if pitch bend event processPitchEvent(itEvent); @@ -694,28 +736,16 @@ PitchBend = pitch; } - void Voice::processCrossFadeEvent(RTList::Iterator& itEvent) { - CrossfadeVolume = CrossfadeAttenuation(itEvent->Param.CC.Value); - #if CONFIG_PROCESS_MUTED_CHANNELS - const float effectiveVolume = CrossfadeVolume * Volume * (pEngineChannel->GetMute() ? 0 : pEngineChannel->GlobalVolume); - #else - const float effectiveVolume = CrossfadeVolume * Volume * pEngineChannel->GlobalVolume; - #endif - fFinalVolume = effectiveVolume; - } - void Voice::processCutoffEvent(RTList::Iterator& itEvent) { int ccvalue = itEvent->Param.CC.Value; if (VCFCutoffCtrl.value == ccvalue) return; VCFCutoffCtrl.value == ccvalue; if (pDimRgn->VCFCutoffControllerInvert) ccvalue = 127 - ccvalue; if (ccvalue < pDimRgn->VCFVelocityScale) ccvalue = pDimRgn->VCFVelocityScale; - float cutoff = CutoffBase * float(ccvalue) * 0.00787402f; // (1 / 127) - if (cutoff > 1.0) cutoff = 1.0; - cutoff = (cutoff < 0.5 ? cutoff * 4826 - 1 : cutoff * 5715 - 449); - if (cutoff < 1.0) cutoff = 1.0; + float cutoff = CutoffBase * float(ccvalue); + if (cutoff > 127.0f) cutoff = 127.0f; - VCFCutoffCtrl.fvalue = cutoff - 1.0; // needed for initialization of fFinalCutoff next time + VCFCutoffCtrl.fvalue = cutoff; // needed for initialization of fFinalCutoff next time fFinalCutoff = cutoff; } @@ -723,10 +753,10 @@ // convert absolute controller value to differential const int ctrldelta = itEvent->Param.CC.Value - VCFResonanceCtrl.value; VCFResonanceCtrl.value = itEvent->Param.CC.Value; - const float resonancedelta = (float) ctrldelta * 0.00787f; // 0.0..1.0 + const float resonancedelta = (float) ctrldelta; fFinalResonance += resonancedelta; // needed for initialization of parameter - VCFResonanceCtrl.fvalue = itEvent->Param.CC.Value * 0.00787f; + VCFResonanceCtrl.fvalue = itEvent->Param.CC.Value; } /** @@ -759,17 +789,17 @@ // initialize all final synthesis parameters finalSynthesisParameters.fFinalPitch = PitchBase * PitchBend; - #if CONFIG_PROCESS_MUTED_CHANNELS - fFinalVolume = this->Volume * this->CrossfadeVolume * (pEngineChannel->GetMute() ? 0 : pEngineChannel->GlobalVolume); - #else - fFinalVolume = this->Volume * this->CrossfadeVolume * pEngineChannel->GlobalVolume; - #endif fFinalCutoff = VCFCutoffCtrl.fvalue; fFinalResonance = VCFResonanceCtrl.fvalue; // process MIDI control change and pitchbend events for this subfragment processCCEvents(itCCEvent, iSubFragmentEnd); + float fFinalVolume = VolumeSmoother.render() * CrossfadeSmoother.render(); +#ifdef CONFIG_PROCESS_MUTED_CHANNELS + if (pEngineChannel->GetMute()) fFinalVolume = 0; +#endif + // process transition events (note on, note off & sustain pedal) processTransitionEvents(itNoteEvent, iSubFragmentEnd); @@ -802,7 +832,7 @@ fFinalCutoff *= EG2.getLevel(); break; // noop } - if (EG3.active()) finalSynthesisParameters.fFinalPitch *= RTMath::CentsToFreqRatio(EG3.render()); + if (EG3.active()) finalSynthesisParameters.fFinalPitch *= EG3.render(); // process low frequency oscillators if (bLFO1Enabled) fFinalVolume *= pLFO1->render(); @@ -811,8 +841,8 @@ // if filter enabled then update filter coefficients if (SYNTHESIS_MODE_GET_FILTER(SynthesisMode)) { - finalSynthesisParameters.filterLeft.SetParameters(fFinalCutoff + 1.0, fFinalResonance, pEngine->SampleRate); - finalSynthesisParameters.filterRight.SetParameters(fFinalCutoff + 1.0, fFinalResonance, pEngine->SampleRate); + finalSynthesisParameters.filterLeft.SetParameters(fFinalCutoff, fFinalResonance, pEngine->SampleRate); + finalSynthesisParameters.filterRight.SetParameters(fFinalCutoff, fFinalResonance, pEngine->SampleRate); } // do we need resampling? @@ -823,20 +853,33 @@ SYNTHESIS_MODE_SET_INTERPOLATE(SynthesisMode, bResamplingRequired); // prepare final synthesis parameters structure - finalSynthesisParameters.fFinalVolumeLeft = fFinalVolume * PanLeft; - finalSynthesisParameters.fFinalVolumeRight = fFinalVolume * PanRight; finalSynthesisParameters.uiToGo = iSubFragmentEnd - i; - +#ifdef CONFIG_INTERPOLATE_VOLUME + finalSynthesisParameters.fFinalVolumeDeltaLeft = + (fFinalVolume * VolumeLeft * PanLeftSmoother.render() - + finalSynthesisParameters.fFinalVolumeLeft) / finalSynthesisParameters.uiToGo; + finalSynthesisParameters.fFinalVolumeDeltaRight = + (fFinalVolume * VolumeRight * PanRightSmoother.render() - + finalSynthesisParameters.fFinalVolumeRight) / finalSynthesisParameters.uiToGo; +#else + finalSynthesisParameters.fFinalVolumeLeft = + fFinalVolume * VolumeLeft * PanLeftSmoother.render(); + finalSynthesisParameters.fFinalVolumeRight = + fFinalVolume * VolumeRight * PanRightSmoother.render(); +#endif // render audio for one subfragment RunSynthesisFunction(SynthesisMode, &finalSynthesisParameters, &loop); + // stop the rendering if volume EG is finished + if (EG1.getSegmentType() == EGADSR::segment_end) break; + const double newPos = Pos + (iSubFragmentEnd - i) * finalSynthesisParameters.fFinalPitch; // increment envelopes' positions if (EG1.active()) { // if sample has a loop and loop start has been reached in this subfragment, send a special event to EG1 to let it finish the attack hold stage - if (pSample->Loops && Pos <= pSample->LoopStart && pSample->LoopStart < newPos) { + if (pDimRgn->SampleLoops && Pos <= pDimRgn->pSampleLoops[0].LoopStart && pDimRgn->pSampleLoops[0].LoopStart < newPos) { EG1.update(EGADSR::event_hold_end, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); } @@ -855,6 +898,19 @@ } } + /** @brief Update current portamento position. + * + * Will be called when portamento mode is enabled to get the final + * portamento position of this active voice from where the next voice(s) + * might continue to slide on. + * + * @param itNoteOffEvent - event which causes this voice to die soon + */ + void Voice::UpdatePortamentoPos(Pool::Iterator& itNoteOffEvent) { + const float fFinalEG3Level = EG3.level(itNoteOffEvent->FragmentPos()); + pEngineChannel->PortamentoPos = (float) MIDIKey + RTMath::FreqRatioToCents(fFinalEG3Level) * 0.01f; + } + /** * Immediately kill the voice. This method should not be used to kill * a normal, active voice, because it doesn't take care of things like