--- linuxsampler/trunk/src/engines/gig/Engine.h 2006/12/06 22:28:17 970 +++ linuxsampler/trunk/src/engines/gig/Engine.h 2007/09/04 01:12:49 1321 @@ -2,8 +2,8 @@ * * * LinuxSampler - modular, streaming capable sampler * * * - * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * - * Copyright (C) 2005, 2006 Christian Schoenebeck * + * Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck * + * Copyright (C) 2005-2007 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 * @@ -60,6 +60,11 @@ Engine(); virtual ~Engine(); void Connect(AudioOutputDevice* pAudioOut); + ::gig::DimensionRegion** ChangeInstrument(EngineChannel* pEngineChannel, ::gig::Instrument* pInstrument); + void SuspendAll(); + void ResumeAll(); + void Suspend(::gig::Region* pRegion); + void Resume(::gig::Region* pRegion); // implementation of abstract methods derived from class 'LinuxSampler::Engine' virtual int RenderAudio(uint Samples); @@ -116,6 +121,7 @@ void ProcessEvents(EngineChannel* pEngineChannel, uint Samples); void RenderActiveVoices(EngineChannel* pEngineChannel, uint Samples); void RenderStolenVoices(uint Samples); + void RouteAudio(EngineChannel* pEngineChannel, uint Samples); void PostProcess(EngineChannel* pEngineChannel); void ClearEventLists(); void ImportEvents(uint Samples); @@ -124,12 +130,15 @@ void ProcessPitchbend(EngineChannel* pEngineChannel, Pool::Iterator& itPitchbendEvent); void ProcessControlChange(EngineChannel* pEngineChannel, Pool::Iterator& itControlChangeEvent); void ProcessSysex(Pool::Iterator& itSysexEvent); + void ProcessSuspensionsChanges(); + void ProcessPendingStreamDeletions(); Pool::Iterator LaunchVoice(EngineChannel* pEngineChannel, Pool::Iterator& itNoteOnEvent, int iLayer, bool ReleaseTriggerVoice, bool VoiceStealing, bool HandleKeyGroupConflicts); int StealVoice(EngineChannel* pEngineChannel, Pool::Iterator& itNoteOnEvent); void FreeVoice(EngineChannel* pEngineChannel, Pool::Iterator& itVoice); void FreeKey(EngineChannel* pEngineChannel, midi_key_info_t* pKey); void ResetInternal(); void ResetScaleTuning(); + void ResetSuspendedRegions(); static Engine* AcquireEngine(LinuxSampler::gig::EngineChannel* pChannel, AudioOutputDevice* pDevice); static void FreeEngine(LinuxSampler::gig::EngineChannel* pChannel, AudioOutputDevice* pDevice); @@ -138,6 +147,27 @@ friend class Voice; private: + + /// Command used by the instrument loader thread to + /// request an instrument change on a channel. + struct instrument_change_command_t { + EngineChannel* pEngineChannel; + ::gig::Instrument* pInstrument; + }; + struct instrument_change_reply_t { + int dummy; + }; + RingBuffer* InstrumentChangeQueue; ///< Contains the instrument change command + RingBuffer* InstrumentChangeReplyQueue; ///< Contains the acknowledge of an instrument change + ::gig::DimensionRegion** pDimRegionsInUse; ///< After an instrument change, this contains a list of dimension regions that are still in use by playing voices + + Pool< ::gig::Region*> SuspendedRegions; + Mutex SuspendedRegionsMutex; + Condition SuspensionChangeOngoing; + ::gig::Region* pPendingRegionSuspension; + ::gig::Region* pPendingRegionResumption; + int iPendingStreamDeletions; + ArrayList engineChannels; ///< All engine channels of a gig::Engine instance. static std::map engines; ///< All instances of gig::Engine. @@ -150,6 +180,7 @@ void ReleaseAllVoices(EngineChannel* pEngineChannel, Pool::Iterator& itReleaseEvent); void KillAllVoices(EngineChannel* pEngineChannel, Pool::Iterator& itKillEvent); bool ShouldReleaseVoice(EngineChannel* pEngineChannel, int Key); + bool RegionSuspended(::gig::Region* pRegion); static float* InitVolumeCurve(); static float* InitPanCurve(); static float* InitCrossfadeCurve();