--- linuxsampler/trunk/src/engines/gig/Engine.cpp 2004/04/26 17:15:51 53 +++ linuxsampler/trunk/src/engines/gig/Engine.cpp 2004/06/06 20:57:28 112 @@ -2,7 +2,7 @@ * * * LinuxSampler - modular, streaming capable sampler * * * - * Copyright (C) 2003 by Benno Senoner and Christian Schoenebeck * + * Copyright (C) 2003, 2004 by Benno Senoner and 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 * @@ -59,6 +59,10 @@ pVoicePool->clear(); pSynthesisParameters[0] = NULL; // we allocate when an audio device is connected + pBasicFilterParameters = NULL; + pMainFilterParameters = NULL; + + InstrumentIdx = -1; ResetInternal(); } @@ -85,13 +89,15 @@ if (pVoicePool) delete pVoicePool; if (pActiveKeys) delete pActiveKeys; if (pEventGenerator) delete pEventGenerator; + if (pMainFilterParameters) delete[] pMainFilterParameters; + if (pBasicFilterParameters) delete[] pBasicFilterParameters; if (pSynthesisParameters[0]) delete[] pSynthesisParameters[0]; } void Engine::Enable() { dmsg(3,("gig::Engine: enabling\n")); EngineDisabled.PushAndUnlock(false, 2); // set condition object 'EngineDisabled' to false (wait max. 2s) - dmsg(1,("gig::Engine: enabled (val=%d)\n", EngineDisabled.GetUnsafe())); + dmsg(3,("gig::Engine: enabled (val=%d)\n", EngineDisabled.GetUnsafe())); } void Engine::Disable() { @@ -191,6 +197,8 @@ Instruments.HandBack(pInstrument, this); } + InstrumentIdx = -1; + // request gig instrument from instrument manager try { instrument_id_t instrid; @@ -214,6 +222,9 @@ throw LinuxSamplerException("gig::Engine error: Failed to load instrument, cause: Unknown exception while trying to parse gig file."); } + InstrumentFile = FileName; + InstrumentIdx = Instrument; + // inform audio driver for the need of two channels try { if (pAudioOutputDevice) pAudioOutputDevice->AcquireChannels(2); // gig Engine only stereo @@ -289,6 +300,12 @@ for (int dst = 1; dst < Event::destination_count; dst++) pSynthesisParameters[dst] = pSynthesisParameters[dst - 1] + pAudioOut->MaxSamplesPerCycle(); + // (re)allocate biquad filter parameter sequence + if (pBasicFilterParameters) delete[] pBasicFilterParameters; + if (pMainFilterParameters) delete[] pMainFilterParameters; + pBasicFilterParameters = new biquad_param_t[pAudioOut->MaxSamplesPerCycle()]; + pMainFilterParameters = new biquad_param_t[pAudioOut->MaxSamplesPerCycle()]; + dmsg(1,("Starting disk thread...")); pDiskThread->StartThread(); dmsg(1,("OK\n")); @@ -635,7 +652,13 @@ */ void Engine::ResetSynthesisParameters(Event::destination_t dst, float val) { int maxsamples = pAudioOutputDevice->MaxSamplesPerCycle(); - for (int i = 0; i < maxsamples; i++) pSynthesisParameters[dst][i] = val; + float* m = &pSynthesisParameters[dst][0]; + for (int i = 0; i < maxsamples; i += 4) { + m[i] = val; + m[i+1] = val; + m[i+2] = val; + m[i+3] = val; + } } float Engine::Volume() { @@ -674,6 +697,18 @@ return pDiskThread->GetBufferFillPercentage(); } + String Engine::EngineName() { + return "GigEngine"; + } + + String Engine::InstrumentFileName() { + return InstrumentFile; + } + + int Engine::InstrumentIndex() { + return InstrumentIdx; + } + String Engine::Description() { return "Gigasampler Engine"; }