1 |
/*************************************************************************** |
2 |
* * |
3 |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
5 |
* Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005-2009 Christian Schoenebeck * |
7 |
* Copyright (C) 2009 Grigor Iliev * |
8 |
* * |
9 |
* This program is free software; you can redistribute it and/or modify * |
10 |
* it under the terms of the GNU General Public License as published by * |
11 |
* the Free Software Foundation; either version 2 of the License, or * |
12 |
* (at your option) any later version. * |
13 |
* * |
14 |
* This program is distributed in the hope that it will be useful, * |
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
17 |
* GNU General Public License for more details. * |
18 |
* * |
19 |
* You should have received a copy of the GNU General Public License * |
20 |
* along with this program; if not, write to the Free Software * |
21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
22 |
* MA 02111-1307 USA * |
23 |
***************************************************************************/ |
24 |
|
25 |
#include "DiskThread.h" |
26 |
#include "Stream.h" |
27 |
#include "../../common/global_private.h" |
28 |
|
29 |
namespace LinuxSampler { |
30 |
// just a placeholder to mark a cell in the pickup array as 'reserved' |
31 |
template <> |
32 |
LinuxSampler::Stream* LinuxSampler::DiskThreadBase< ::sfz::Region, sfz::InstrumentResourceManager>::SLOT_RESERVED = (LinuxSampler::Stream*) &SLOT_RESERVED; |
33 |
|
34 |
namespace sfz { |
35 |
|
36 |
DiskThread::DiskThread(int MaxStreams, uint BufferWrapElements, InstrumentResourceManager* pInstruments) : |
37 |
DiskThreadBase< ::sfz::Region, InstrumentResourceManager>(MaxStreams, BufferWrapElements, pInstruments) |
38 |
{ |
39 |
CreateAllStreams(MaxStreams, BufferWrapElements); |
40 |
} |
41 |
|
42 |
DiskThread::~DiskThread() { |
43 |
|
44 |
} |
45 |
|
46 |
LinuxSampler::Stream* DiskThread::CreateStream(long BufferSize, uint BufferWrapElements) { |
47 |
return new Stream(BufferSize, BufferWrapElements, pInstruments->GetSampleManager()); // 131072 sample words |
48 |
} |
49 |
|
50 |
void DiskThread::LaunchStream ( |
51 |
LinuxSampler::Stream* pStream, |
52 |
Stream::Handle hStream, |
53 |
Stream::reference_t* pExportReference, |
54 |
::sfz::Region* pRgn, |
55 |
unsigned long SampleOffset, |
56 |
bool DoLoop |
57 |
) { |
58 |
Stream* pSfzStream = dynamic_cast<Stream*>(pStream); |
59 |
if(!pSfzStream) throw Exception("Invalid stream type"); |
60 |
pSfzStream->Launch(hStream, pExportReference, pRgn, SampleOffset, DoLoop); |
61 |
} |
62 |
}} // namespace LinuxSampler::sfz |
63 |
|