/[svn]/libgig/trunk/src/Akai.h
ViewVC logotype

Annotation of /libgig/trunk/src/Akai.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2572 - (hide annotations) (download) (as text)
Thu May 22 12:14:04 2014 UTC (9 years, 11 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 23935 byte(s)
* Added fork of libakai (this fork provides Linux support) which
  allows reading AKAI medias. Comes with two command line tools
  'akaidump' and 'akaiextract'. Also added a man page for each
  tool.

1 schoenebeck 2572 /*
2     libakai - C++ cross-platform akai sample disk reader
3     Copyright (C) 2002-2003 Sébastien Métrot
4    
5     Linux port by Christian Schoenebeck <cuse@users.sourceforge.net> 2003-2014
6    
7     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Lesser General Public
9     License as published by the Free Software Foundation; either
10     version 2.1 of the License, or (at your option) any later version.
11    
12     This library is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15     Lesser General Public License for more details.
16    
17     You should have received a copy of the GNU Lesser General Public
18     License along with this library; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20     */
21     // Akai.h
22     // Info for the akai disk & file format found here:
23     // http://www.abel.co.uk/~maxim/akai/akaiinfo.htm
24     //
25     #ifndef __akai_h__
26     #define __akai_h__
27    
28     // for use with autoconf
29     #ifdef HAVE_CONFIG_H
30     #include <config.h>
31     #endif
32    
33     #if !defined(_CARBON_) && !defined(_WIN32_)
34     # define LINUX 1
35     #endif
36    
37     #include <stdint.h>
38     #include <string>
39     #include <stdio.h>
40     #include <stdlib.h>
41     #include <iostream>
42     #include <list>
43     #include <fstream>
44    
45     #if LINUX
46     # include <sys/types.h>
47     # include <sys/stat.h>
48     # include <sys/fcntl.h>
49     # include <sys/ioctl.h>
50     # include <unistd.h>
51     # include <linux/cdrom.h>
52     #endif
53    
54     typedef std::string String;
55     typedef std::streampos streampos;
56    
57     class AkaiVolume;
58     class AkaiPartition;
59     class AkaiDisk;
60    
61    
62     /* current state of the Akai stream */
63     typedef enum {
64     akai_stream_ready = 0,
65     akai_stream_end_reached = 1,
66     akai_stream_closed = 2
67     } akai_stream_state_t;
68    
69     /* stream position dependent to these relations */
70     typedef enum {
71     akai_stream_start = 0,
72     akai_stream_curpos = 1,
73     akai_stream_end = 2
74     } akai_stream_whence_t;
75    
76    
77     /* We need to cache IO access to reduce IO system calls which else would slow
78     down things tremendously. For that we differ between the following two
79     cache sizes:
80    
81     CD_FRAMESIZE for CDROM access
82     DISK_CLUSTER_SIZE for normal IO access (e.g. from hard disk)
83    
84     Not yet sure if these are the optimum sizes.
85     */
86    
87     #ifndef CD_FRAMESIZE
88     # define CD_FRAMESIZE 2048 /* frame size for Yellow Book, Form 1 */
89     #endif
90    
91     #define DISK_CLUSTER_SIZE 61440 /* 60 kB */
92    
93     typedef std::string String;
94    
95     /** @brief Accessing AKAI image either from file or a drive (i.e. CDROM).
96     *
97     * This class implements a hardware abstraction layer, providing an abstract
98     * streaming API to read from AKAI data images, no matter if the AKAI image is
99     * already available as image file or whether the respective hardware drive
100     * needs to be accessed directly (i.e. CDROM drive, ZIP drive). So the main task
101     * of this class is isolating operating system dependent file/hardware access.
102     */
103     class DiskImage
104     {
105     public:
106     DiskImage(const char* path); ///< Open an image from a file.
107     DiskImage(int disk); ///< Open an image from a device number (0='a:', 1='b:', etc...).
108    
109     bool WriteImage(const char* path); ///< Extract Akai data track and write it into a regular file.
110    
111     virtual ~DiskImage();
112    
113     virtual akai_stream_state_t GetState() const;
114     virtual int GetPos() const;
115     virtual int SetPos(int Where, akai_stream_whence_t Whence = akai_stream_start);
116    
117     virtual int Available (uint WordSize = 1);
118     virtual int Read (void* pData, uint WordCount, uint WordSize); ///< Returns number of successfully read words.
119    
120     void ReadInt8(uint8_t* pData, uint WordCount);
121     void ReadInt16(uint16_t* pData, uint WordCount);
122     void ReadInt32(uint32_t* pData, uint WordCount);
123     int ReadInt8(uint8_t* pData); ///< Returns number of successfully read 8 Bit words.
124     int ReadInt16(uint16_t* pData); ///< Returns number of successfully read 16 Bit words.
125     int ReadInt32(uint32_t* pData); ///< Returns number of successfully read 32 Bit words.
126     uint8_t ReadInt8();
127     uint16_t ReadInt16();
128     uint32_t ReadInt32();
129    
130    
131     virtual uint GetError() const
132     {
133     return 0;
134     }
135    
136     /*virtual const nglChar* GetErrorStr(uint err) const
137     {
138     return _T("No Error");
139     }*/
140    
141     protected:
142     #ifdef _WIN32_
143     HANDLE mFile;
144     #elif defined _CARBON_ || LINUX
145     int mFile;
146     #endif
147     bool mRegularFile;
148     int mPos;
149     int mCluster;
150     int mClusterSize;
151     int mSize; /* in bytes */
152     #if LINUX
153     /* start and end of the data track we chose (if we're reading from CDROM) */
154     int mStartFrame;
155     int mEndFrame;
156     #endif // LINUX
157     char* mpCache;
158    
159     void OpenStream(const char* path);
160     inline void swapBytes_16(void* Word);
161     inline void swapBytes_32(void* Word);
162    
163     private:
164     void Init();
165     };
166    
167    
168     class Resource
169     {
170     public:
171     Resource()
172     {
173     mRefCount = 0;
174     }
175     virtual ~Resource()
176     {
177     //NGL_ASSERT(mRefCount==0);
178     }
179     uint Acquire()
180     {
181     return mRefCount++;
182     }
183     uint Release()
184     {
185     uint res;
186     //NGL_ASSERT(mRefCount!=0);
187     mRefCount--;
188     res = mRefCount;
189     if (!mRefCount)
190     delete this;
191     return res;
192     }
193     private:
194     uint mRefCount;
195     };
196    
197     class AkaiDirEntry
198     {
199     public:
200     String mName;
201     uint16_t mType;
202     int mSize;
203     uint16_t mStart;
204     int mIndex;
205     };
206    
207     // AkaiDiskElement:
208     class AkaiDiskElement : public Resource
209     {
210     public:
211     AkaiDiskElement(uint Offset = 0)
212     {
213     mOffset = Offset;
214     }
215    
216     uint GetOffset()
217     {
218     return mOffset;
219     }
220    
221     protected:
222     void SetOffset(uint Offset)
223     {
224     mOffset = Offset;
225     }
226    
227     void AkaiToAscii(char * buffer, int length);
228     int ReadFAT(DiskImage* pDisk, AkaiPartition* pPartition, int block);
229     bool ReadDirEntry(DiskImage* pDisk, AkaiPartition* pPartition, AkaiDirEntry& rEntry, int block, int pos);
230     private:
231     uint mOffset;
232     };
233    
234     class AkaiSampleLoop
235     {
236     public:
237     // 4 unsigned Loop 1 marker
238     uint32_t mMarker;
239     // 2 unsigned Loop 1 fine length (65536ths)
240     uint16_t mFineLength;
241     // 4 unsigned Loop 1 coarse length (words)
242     uint32_t mCoarseLength;
243     // 2 unsigned Loop 1 time (msec. or 9999=infinite)
244     uint16_t mTime;
245     private:
246     friend class AkaiSample;
247     bool Load(DiskImage* pDisk);
248     };
249    
250     class AkaiSample : public AkaiDiskElement
251     {
252     public:
253     AkaiDirEntry GetDirEntry();
254     // Length Format Description
255     // --------------------------------------------------------------
256     // 1 3
257     // 1 Not important: 0 for 22050Hz, 1 for 44100Hz
258     // 1 unsigned MIDI root note (C3=60)
259     uint8_t mMidiRootNote;
260     // 12 AKAII Filename
261     String mName;
262     // 1 128
263     // 1 unsigned Number of active loops
264     uint8_t mActiveLoops;
265     // 1 unsigned char First active loop (0 for none)
266     uint8_t mFirstActiveLoop;
267     // 1 0
268     // 1 unsigned Loop mode: 0=in release 1=until release
269     // 2=none 3=play to end
270     uint8_t mLoopMode;
271     // 1 signed Cents tune -50...+50
272     int8_t mTuneCents;
273     // 1 signed Semi tune -50...+50
274     int8_t mTuneSemitones;
275     // 4 0,8,2,0
276     //
277     // 4 unsigned Number of sample words
278     uint32_t mNumberOfSamples;
279     // 4 unsigned Start marker
280     uint32_t mStartMarker;
281     // 4 unsigned End marker
282     uint32_t mEndMarker;
283     //
284     // 4 unsigned Loop 1 marker
285     // 2 unsigned Loop 1 fine length (65536ths)
286     // 4 unsigned Loop 1 coarse length (words)
287     // 2 unsigned Loop 1 time (msec. or 9999=infinite)
288     //
289     // 84 [as above] Loops 2 to 8
290     //
291     AkaiSampleLoop mLoops[8];
292     // 4 0,0,255,255
293     // 2 unsigned Sampling frequency
294     uint16_t mSamplingFrequency;
295     // 1 signed char Loop tune offset -50...+50
296     int8_t mLoopTuneOffset;
297     // 10 0,0,0...
298    
299     int16_t* mpSamples;
300    
301     bool LoadSampleData(); ///< Load sample into RAM
302     void ReleaseSampleData(); ///< release the samples once you used them if you don't want to be bothered to
303     int SetPos(int Where, akai_stream_whence_t Whence = akai_stream_start); ///< Use this method and Read() if you don't want to load the sample into RAM, thus for disk streaming.
304     int Read(void* pBuffer, uint SampleCount); ///< Use this method and SetPos() if you don't want to load the sample into RAM, thus for disk streaming.
305     bool LoadHeader();
306     private:
307     AkaiSample(DiskImage* pDisk, AkaiVolume* pParent, const AkaiDirEntry& DirEntry);
308     virtual ~AkaiSample();
309    
310     friend class AkaiVolume;
311    
312     AkaiVolume* mpParent;
313     DiskImage* mpDisk;
314     AkaiDirEntry mDirEntry;
315     bool mHeaderOK;
316     int mPos;
317     int mImageOffset; // actual position in the image where sample starts
318     };
319    
320     class AkaiKeygroupSample : public AkaiDiskElement
321     {
322     public:
323     // 35-46 sample 1 name 10,10,10... AKAII character set
324     String mName;
325     // 47 low vel 0 0..127
326     uint8_t mLowLevel;
327     // 48 high vel 127 0..127
328     uint8_t mHighLevel;
329     // 49 tune cents 0 -128..127 (-50..50 cents)
330     int8_t mTuneCents;
331     // 50 tune semitones 0 -50..50
332     int8_t mTuneSemitones;
333     // 51 loudness 0 -50..+50
334     int8_t mLoudness;
335     // 52 filter 0 -50..+50
336     int8_t mFilter;
337     // 53 pan 0 -50..+50
338     int8_t mPan;
339     // 54 loop mode 0 0=AS_SAMPLE 1=LOOP_IN_REL
340     // 2=LOOP_UNTIL_REL 3=NO_LOOP
341     // 4=PLAY_TO_END
342     uint8_t mLoopMode;
343     // 55 (internal use) 255
344     // 56 (internal use) 255
345     // 57-58 (internal use) 44,1
346     //
347     private:
348     friend class AkaiKeygroup;
349     bool Load(DiskImage* pDisk);
350     };
351    
352     class AkaiEnveloppe
353     {
354     public:
355     // 13 env1 attack 0 0..99
356     uint8_t mAttack;
357     // 14 env1 decay 30 0..99
358     uint8_t mDecay;
359     // 15 env1 sustain 99 0..99
360     uint8_t mSustain;
361     // 16 env1 release 45 0..99
362     uint8_t mRelease;
363     // 17 env1 vel>attack 0 -50..50
364     int8_t mVelocityToAttack;
365     // 18 env1 vel>release 0 -50..50
366     int8_t mVelocityToRelease;
367     // 19 env1 offvel>release 0 -50..50
368     int8_t mOffVelocityToRelease;
369     // 20 env1 key>dec&rel 0 -50..50
370     int8_t mKeyToDecayAndRelease;
371     private:
372     friend class AkaiKeygroup;
373     bool Load(DiskImage* pDisk);
374     };
375    
376     class AkaiKeygroup
377     {
378     public:
379     // byte description default range/comments
380     // ---------------------------------------------------------------------------
381     // 1 keygroup ID 2
382     // 2-3 next keygroup address 44,1 300,450,600,750.. (16-bit)
383     // 4 low key 24 24..127
384     uint8_t mLowKey;
385     // 5 high key 127 24..127
386     uint8_t mHighKey;
387     // 6 tune cents 0 -128..127 (-50..50 cents)
388     int8_t mTuneCents;
389     // 7 tune semitones 0 -50..50
390     int8_t mTuneSemitones;
391     // 8 filter 99 0..99
392     uint8_t mFilter;
393     // 9 key>filter 12 0..24 semitone/oct
394     uint8_t mKeyToFilter;
395     // 10 vel>filt 0 -50..50
396     uint8_t mVelocityToFilter;
397     // 11 pres>filt 0 -50..50
398     uint8_t mPressureToFilter;
399     // 12 env2>filt 0 -50..50
400     uint8_t mEnveloppe2ToFilter;
401    
402     // 13 env1 attack 0 0..99
403     // 14 env1 decay 30 0..99
404     // 15 env1 sustain 99 0..99
405     // 16 env1 release 45 0..99
406     // 17 env1 vel>attack 0 -50..50
407     // 18 env1 vel>release 0 -50..50
408     // 19 env1 offvel>release 0 -50..50
409     // 20 env1 key>dec&rel 0 -50..50
410     // 21 env2 attack 0 0..99
411     // 22 env2 decay 50 0..99
412     // 23 env2 sustain 99 0..99
413     // 24 env2 release 45 0..99
414     // 25 env2 vel>attack 0 -50..50
415     // 26 env2 vel>release 0 -50..50
416     // 27 env2 offvel>release 0 -50..50
417     // 28 env2 key>dec&rel 0 -50..50
418     AkaiEnveloppe mEnveloppes[2];
419    
420     // 29 vel>env2>filter 0 -50..50
421     int8_t mVelocityToEnveloppe2ToFilter;
422     // 30 env2>pitch 0 -50..50
423     int8_t mEnveloppe2ToPitch;
424     // 31 vel zone crossfade 1 0=OFF 1=ON
425     bool mVelocityZoneCrossfade;
426     // 32 vel zones used 4
427     uint mVelocityZoneUsed;
428     // 33 (internal use) 255
429     // 34 (internal use) 255
430     //
431    
432     // 35-46 sample 1 name 10,10,10... AKAII character set
433     // 47 low vel 0 0..127
434     // 48 high vel 127 0..127
435     // 49 tune cents 0 -128..127 (-50..50 cents)
436     // 50 tune semitones 0 -50..50
437     // 51 loudness 0 -50..+50
438     // 52 filter 0 -50..+50
439     // 53 pan 0 -50..+50
440     // 54 loop mode 0 0=AS_SAMPLE 1=LOOP_IN_REL
441     // 2=LOOP_UNTIL_REL 3=NO_LOOP
442     // 4=PLAY_TO_END
443     // 55 (internal use) 255
444     // 56 (internal use) 255
445     // 57-58 (internal use) 44,1
446     //
447     // 59-82 [repeat 35-58 for sample 2]
448     //
449     // 83-106 [repeat 35-58 for sample 3]
450     //
451     // 107-130 [repeat 35-58 for sample 4]
452     //
453     AkaiKeygroupSample mSamples[4];
454    
455     // 131 beat detune 0 -50..50
456     int8_t mBeatDetune;
457     // 132 hold attack until loop 0 0=OFF 1=ON
458     bool mHoldAttackUntilLoop;
459     // 133-136 sample 1-4 key tracking 0 0=TRACK 1=FIXED
460     bool mSampleKeyTracking[4];
461     // 137-140 sample 1-4 aux out offset 0 0..7
462     uint8_t mSampleAuxOutOffset[4];
463     // 141-148 vel>sample start 0 -9999..9999 (16-bit signed)
464     int16_t mVelocityToSampleStart[4];
465     // 149 vel>volume offset 0 -50..50
466     int8_t mVelocityToVolumeOffset[4];
467     // 150 (not used)
468    
469     private:
470     friend class AkaiProgram;
471     bool Load(DiskImage* pDisk);
472     };
473    
474     /** @brief AKAI instrument definition
475     *
476     * Represents exactly one sample based instrument on the AKAI media.
477     */
478     class AkaiProgram : public AkaiDiskElement
479     {
480     public:
481     AkaiDirEntry GetDirEntry();
482     // Samples:
483     uint ListSamples(std::list<String>& rSamples);
484     AkaiSample* GetSample(uint Index);
485     AkaiSample* GetSample(const String& rName);
486    
487     // byte description default range/comments
488     // ---------------------------------------------------------------------------
489     // 1 program ID 1
490     // 2-3 first keygroup address 150,0
491     // 4-15 program name 10,10,10... AKAII character set
492     String mName;
493     // 16 MIDI program number 0 0..127
494     uint8_t mMidiProgramNumber;
495     // 17 MIDI channel 0 0..15, 255=OMNI
496     uint8_t mMidiChannel;
497     // 18 polyphony 15 1..16
498     uint8_t mPolyphony;
499     // 19 priority 1 0=LOW 1=NORM 2=HIGH 3=HOLD
500     uint8_t mPriority;
501     // 20 low key 24 24..127
502     uint8_t mLowKey;
503     // 21 high key 127 24..127
504     uint8_t mHighKey;
505     // 22 octave shift 0 -2..2
506     int8_t mOctaveShift;
507     // 23 aux output select 255 0..7, 255=OFF
508     uint8_t mAuxOutputSelect;
509     // 24 mix output level 99 0..99
510     uint8_t mMixOutputSelect;
511     // 25 mix output pan 0 -50..50
512     int8_t mMixPan;
513     // 26 volume 80 0..99
514     uint8_t mVolume;
515     // 27 vel>volume 20 -50..50
516     int8_t mVelocityToVolume;
517     // 28 key>volume 0 -50..50
518     int8_t mKeyToVolume;
519     // 29 pres>volume 0 -50..50
520     int8_t mPressureToVolume;
521     // 30 pan lfo rate 50 0..99
522     uint8_t mPanLFORate;
523     // 31 pan lfo depth 0 0..99
524     uint8_t mPanLFODepth;
525     // 32 pan lfo delay 0 0..99
526     uint8_t mPanLFODelay;
527     // 33 key>pan 0 -50..50
528     int8_t mKeyToPan;
529     // 34 lfo rate 50 0..99
530     uint8_t mLFORate;
531     // 35 lfo depth 0 0..99
532     uint8_t mLFODepth;
533     // 36 lfo delay 0 0..99
534     uint8_t mLFODelay;
535     // 37 mod>lfo depth 30 0..99
536     uint8_t mModulationToLFODepth;
537     // 38 pres>lfo depth 0 0..99
538     uint8_t mPressureToLFODepth;
539     // 39 vel>lfo depth 0 0..99
540     uint8_t mVelocityToLFODepth;
541     // 40 bend>pitch 2 0..12 semitones
542     uint8_t mBendToPitch;
543     // 41 pres>pitch 0 -12..12 semitones
544     int8_t mPressureToPitch;
545     // 42 keygroup crossfade 0 0=OFF 1=ON
546     bool mKeygroupCrossfade;
547     // 43 number of keygroups 1 1..99
548     uint8_t mNumberOfKeygroups;
549     // 44 (internal use) 0 program number
550     // 45-56 key temperament C,C#,D... 0 -25..25 cents
551     int8_t mKeyTemperament[11];
552     // 57 fx output 0 0=OFF 1=ON
553     bool mFXOutput;
554     // 58 mod>pan 0 -50..50
555     int8_t mModulationToPan;
556     // 59 stereo coherence 0 0=OFF 1=ON
557     bool mStereoCoherence;
558     // 60 lfo desync 1 0=OFF 1=ON
559     bool mLFODesync;
560     // 61 pitch law 0 0=LINEAR
561     uint8_t mPitchLaw;
562     // 62 voice re-assign 0 0=OLDEST 1=QUIETEST
563     uint8_t mVoiceReassign;
564     // 63 softped>volume 10 0..99
565     uint8_t mSoftpedToVolume;
566     // 64 softped>attack 10 0..99
567     uint8_t mSoftpedToAttack;
568     // 65 softped>filt 10 0..99
569     uint8_t mSoftpedToFilter;
570     // 66 tune cents 0 -128..127 (-50..50 cents)
571     int8_t mSoftpedToTuneCents;
572     // 67 tune semitones 0 -50..50
573     int8_t mSoftpedToTuneSemitones;
574     // 68 key>lfo rate 0 -50..50
575     int8_t mKeyToLFORate;
576     // 69 key>lfo depth 0 -50..50
577     int8_t mKeyToLFODepth;
578     // 70 key>lfo delay 0 -50..50
579     int8_t mKeyToLFODelay;
580     // 71 voice output scale 1 0=-6dB 1=0dB 2=+12dB
581     uint8_t mVoiceOutputScale;
582     // 72 stereo output scale 0 0=0dB 1=+6dB
583     uint8_t mStereoOutputScale;
584     // 73-150 (not used)
585    
586     AkaiKeygroup* mpKeygroups;
587    
588     bool Load();
589     AkaiVolume* GetParent()
590     {
591     return mpParent;
592     }
593    
594     private:
595     AkaiProgram(DiskImage* pDisk, AkaiVolume* pParent, const AkaiDirEntry& DirEntry);
596     virtual ~AkaiProgram();
597    
598     friend class AkaiVolume;
599    
600     std::list<AkaiSample*> mpSamples;
601     AkaiVolume* mpParent;
602     DiskImage* mpDisk;
603     AkaiDirEntry mDirEntry;
604     };
605    
606     /** @brief Subdivision of an AKAI disk partition.
607     *
608     * An AKAI volume is a further subdivision of an AKAI disk partition.
609     *
610     * An AKAI volume actually provides access to the list of instruments (programs)
611     * and samples. Samples referenced by an instrument (program) are always part of
612     * the same volume.
613     */
614     class AkaiVolume : public AkaiDiskElement
615     {
616     public:
617     AkaiDirEntry GetDirEntry();
618     // Programs:
619     uint ListPrograms(std::list<AkaiDirEntry>& rPrograms);
620     AkaiProgram* GetProgram(uint Index);
621     AkaiProgram* GetProgram(const String& rName);
622    
623     // Samples:
624     uint ListSamples(std::list<AkaiDirEntry>& rSamples);
625     AkaiSample* GetSample(uint Index);
626     AkaiSample* GetSample(const String& rName);
627    
628     AkaiPartition* GetParent()
629     {
630     return mpParent;
631     }
632    
633     bool IsEmpty();
634     private:
635     AkaiVolume(DiskImage* pDisk, AkaiPartition* pParent, const AkaiDirEntry& DirEntry);
636     virtual ~AkaiVolume();
637     uint ReadDir();
638    
639     friend class AkaiPartition;
640    
641     String mName;
642     std::list<AkaiProgram*> mpPrograms;
643     std::list<AkaiSample*> mpSamples;
644     DiskImage* mpDisk;
645     AkaiPartition* mpParent;
646     AkaiDirEntry mDirEntry;
647     };
648    
649     /** @brief Encapsulates one disk partition of an AKAI disk.
650     *
651     * An object of this class represents exactly one disk partition of an AKAI disk
652     * media or of an AKAI disk image file. This is similar to a hard disk partition
653     * on other operating systems, just in AKAI's own custom format.
654     *
655     * Each AKAI disk partition is further subdivided into so called "volumes".
656     */
657     class AkaiPartition : public AkaiDiskElement
658     {
659     public:
660     // Samples:
661     uint ListVolumes(std::list<AkaiDirEntry>& rVolumes);
662     AkaiVolume* GetVolume(uint Index);
663     AkaiVolume* GetVolume(const String& rName);
664    
665     AkaiDisk* GetParent()
666     {
667     return mpParent;
668     }
669    
670     bool IsEmpty();
671     private:
672     AkaiPartition(DiskImage* pDisk, AkaiDisk* pParent);
673     virtual ~AkaiPartition();
674    
675     friend class AkaiDisk;
676    
677     String mName;
678     std::list<AkaiVolume*> mpVolumes;
679     AkaiDisk* mpParent;
680     DiskImage* mpDisk;
681     };
682    
683     /** @brief Toplevel AKAI image interpreter.
684     *
685     * This class takes an AKAI disk image as constructor argument and provides
686     * access to the individual partitions of that AKAI disk/image. The concept is
687     * similar to hard disc layout for other operating systems, which are also
688     * divided into individual partitions as topmost instance on the mass data
689     * media.
690     */
691     class AkaiDisk : public AkaiDiskElement
692     {
693     public:
694     AkaiDisk(DiskImage* pDisk);
695     virtual ~AkaiDisk();
696    
697     // Partitions:
698     uint GetPartitionCount();
699     AkaiPartition* GetPartition(uint count);
700    
701     private:
702     DiskImage* mpDisk;
703     std::list<AkaiPartition*> mpPartitions;
704     };
705    
706     #define AKAI_FILE_ENTRY_SIZE 24
707     #define AKAI_DIR_ENTRY_OFFSET 0xca
708     #define AKAI_DIR_ENTRY_SIZE 16
709     #define AKAI_ROOT_ENTRY_OFFSET 0x0
710    
711     #define AKAI_PARTITION_END_MARK 0x8000
712     #define AKAI_BLOCK_SIZE 0x2000
713    
714     #define AKAI_FAT_OFFSET 0x70a
715    
716     #define AKAI_MAX_FILE_ENTRIES_S1000 125 //should be 128 ??
717     #define AKAI_MAX_FILE_ENTRIES_S3000 509 // should be 512 ??
718     #define AKAI_MAX_DIR_ENTRIES 100
719     #define AKAI_TYPE_DIR_S1000 1
720     #define AKAI_TYPE_DIR_S3000 3
721    
722     #define AKAI_PROGRAM_ID 1
723     #define AKAI_KEYGROUP_ID 2
724     #define AKAI_SAMPLE_ID 3
725    
726     #endif // __akai_h__

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC