/[svn]/linuxsampler/trunk/src/engines/common/SampleFile.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/engines/common/SampleFile.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2012 - (show annotations) (download) (as text)
Fri Oct 23 17:53:17 2009 UTC (14 years, 6 months ago) by iliev
File MIME type: text/x-c++hdr
File size: 3707 byte(s)
* Refactoring: moved the independent code from
  the Gigasampler format engine to base classes
* SFZ format engine: experimental code (not usable yet)
* SoundFont format engine: experimental code (not usable yet)
* Fixed crash which may occur when MIDI key + transpose is out of range

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003 - 2009 Christian Schoenebeck *
6 * Copyright (C) 2009 Grigor Iliev *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21 * MA 02111-1307 USA *
22 ***************************************************************************/
23
24 #ifndef __LS_SAMPLEFILE_H__
25 #define __LS_SAMPLEFILE_H__
26
27 #include "Sample.h"
28
29 #include <sndfile.h>
30 #include "../../common/global.h"
31
32
33 namespace LinuxSampler {
34 class SampleFile : public Sample {
35 public:
36 SampleFile(String File, bool DontClose = false);
37 virtual ~SampleFile();
38
39 String GetFile() { return File; }
40
41 virtual String GetName() { return File; }
42 virtual int GetSampleRate() { return SampleRate; }
43 virtual int GetChannelCount() { return ChannelCount; }
44 virtual long GetTotalFrameCount() { return TotalFrameCount; }
45 virtual int GetFrameSize() { return FrameSize; }
46
47 virtual buffer_t LoadSampleData();
48 virtual buffer_t LoadSampleData(unsigned long FrameCount);
49 virtual buffer_t LoadSampleDataWithNullSamplesExtension(uint NullFrameCount);
50 virtual buffer_t LoadSampleDataWithNullSamplesExtension(unsigned long FrameCount, uint NullFramesCount);
51 virtual void ReleaseSampleData();
52 virtual buffer_t GetCache();
53 virtual long Read(void* pBuffer, unsigned long FrameCount);
54
55 virtual unsigned long ReadAndLoop (
56 void* pBuffer,
57 unsigned long FrameCount,
58 PlaybackState* pPlaybackState
59 );
60
61 virtual long SetPos(unsigned long FrameOffset);
62 virtual long GetPos();
63
64 void Open();
65 void Close();
66
67 private:
68 String File;
69 int SampleRate;
70 int ChannelCount;
71 int Format;
72 int FrameSize; ///< In bytes
73 long TotalFrameCount;
74
75 SNDFILE* pSndFile;
76
77 buffer_t RAMCache; ///< Buffers samples (already uncompressed) in RAM.
78 long SetPos(unsigned long FrameCount, int Whence);
79 };
80 } // namespace LinuxSampler
81
82 #endif // __LS_SAMPLEFILE_H__

  ViewVC Help
Powered by ViewVC