/[svn]/linuxsampler/trunk/src/network/lscpinstrumentloader.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/network/lscpinstrumentloader.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 390 - (show annotations) (download) (as text)
Fri Feb 18 03:58:55 2005 UTC (15 years, 1 month ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3004 byte(s)
* fixed segfault and freeze of LSCPInstrumentLoader thread

1 /***************************************************************************
2 * *
3 * Copyright (C) 2005 Christian Schoenebeck *
4 * *
5 * This library is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This library is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this library; if not, write to the Free Software *
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
18 * MA 02111-1307 USA *
19 ***************************************************************************/
20
21 #ifndef __LSCPINSTRUMENTLOADER_H__
22 #define __LSCPINSTRUMENTLOADER_H__
23
24 #include "../common/global.h"
25 #include "../common/Thread.h"
26 #include "../common/Condition.h"
27 #include "../common/RingBuffer.h"
28 #include "../Sampler.h"
29
30 /// Maximum numbers of instruments waiting to be loaded by the LSCPInstrumentLoader.
31 #define INSTRUMENT_LOADER_QUEUE_SIZE 200
32
33 using namespace LinuxSampler;
34
35 /**
36 * Instrument loader thread for the LinuxSampler Control Protocol (LSCP)
37 * Server for loading instruments in the background. This loader will only
38 * load one instrument by one. The thread will actually only be created once
39 * StartnewLoad() method was called the first time. After that the thread
40 * will exist for the whole life time of the LSCPInstrumentLoader instance
41 * and just block until new loading jobs arrive.
42 */
43 class LSCPInstrumentLoader : public Thread {
44 public:
45 LSCPInstrumentLoader();
46 void StartNewLoad(String Filename, uint uiInstrumentIndex, Engine* pEngine);
47 virtual ~LSCPInstrumentLoader();
48 protected:
49 struct command_t {
50 String* pFilename;
51 uint uiInstrumentIndex;
52 Engine* pEngine;
53 };
54
55 // Instance variables.
56 RingBuffer<command_t>* pQueue; ///< queue with commands for loading new instruments.
57 Condition conditionJobsLeft; ///< synchronizer to block this thread until a new job arrives
58
59 int Main(); ///< Implementation of virtual method from class Thread.
60 };
61
62 #endif // __LSCPINSTRUMENTLOADER_H__

  ViewVC Help
Powered by ViewVC