33 #if !defined(_CARBON_) && !defined(__APPLE__) && !defined(WIN32)
44 #include <sys/types.h>
47 # include <sys/fcntl.h>
49 #if defined(_CARBON_) || defined(__APPLE__) || LINUX
50 # include <sys/ioctl.h>
54 typedef unsigned int uint;
57 # include <linux/cdrom.h>
60 typedef std::string String;
61 typedef std::streampos streampos;
70 akai_stream_ready = 0,
71 akai_stream_end_reached = 1,
72 akai_stream_closed = 2
73 } akai_stream_state_t;
77 akai_stream_start = 0,
78 akai_stream_curpos = 1,
80 } akai_stream_whence_t;
94 # define CD_FRAMESIZE 2048
97 #define DISK_CLUSTER_SIZE 61440
99 typedef std::string String;
119 virtual akai_stream_state_t GetState()
const;
120 virtual int GetPos()
const;
121 virtual int SetPos(
int Where, akai_stream_whence_t Whence = akai_stream_start);
123 virtual int Available (uint WordSize = 1);
124 virtual int Read (
void* pData, uint WordCount, uint WordSize);
126 void ReadInt8(uint8_t* pData, uint WordCount);
127 void ReadInt16(uint16_t* pData, uint WordCount);
128 void ReadInt32(uint32_t* pData, uint WordCount);
129 int ReadInt8(uint8_t* pData);
130 int ReadInt16(uint16_t* pData);
131 int ReadInt32(uint32_t* pData);
133 uint16_t ReadInt16();
134 uint32_t ReadInt32();
137 virtual uint GetError()
const
150 #elif defined _CARBON_ || defined(__APPLE__) || LINUX
163 void OpenStream(
const char* path);
164 inline void swapBytes_16(
void* Word);
165 inline void swapBytes_32(
void* Word);
212 class AkaiDiskElement :
public Resource
215 AkaiDiskElement(uint Offset = 0)
226 void SetOffset(uint Offset)
231 void AkaiToAscii(
char * buffer,
int length);
244 uint16_t mFineLength;
246 uint32_t mCoarseLength;
250 friend class AkaiSample;
254 class AkaiSample :
public AkaiDiskElement
257 AkaiDirEntry GetDirEntry();
263 uint8_t mMidiRootNote;
268 uint8_t mActiveLoops;
270 uint8_t mFirstActiveLoop;
278 int8_t mTuneSemitones;
282 uint32_t mNumberOfSamples;
284 uint32_t mStartMarker;
295 AkaiSampleLoop mLoops[8];
298 uint16_t mSamplingFrequency;
300 int8_t mLoopTuneOffset;
305 bool LoadSampleData();
306 void ReleaseSampleData();
307 int SetPos(
int Where, akai_stream_whence_t Whence = akai_stream_start);
308 int Read(
void* pBuffer, uint SampleCount);
312 virtual ~AkaiSample();
318 AkaiDirEntry mDirEntry;
324 class AkaiKeygroupSample :
public AkaiDiskElement
336 int8_t mTuneSemitones;
352 friend class AkaiKeygroup;
368 int8_t mVelocityToAttack;
370 int8_t mVelocityToRelease;
372 int8_t mOffVelocityToRelease;
374 int8_t mKeyToDecayAndRelease;
376 friend class AkaiKeygroup;
394 int8_t mTuneSemitones;
398 uint8_t mKeyToFilter;
400 uint8_t mVelocityToFilter;
402 uint8_t mPressureToFilter;
404 uint8_t mEnveloppe2ToFilter;
422 AkaiEnveloppe mEnveloppes[2];
425 int8_t mVelocityToEnveloppe2ToFilter;
427 int8_t mEnveloppe2ToPitch;
429 bool mVelocityZoneCrossfade;
431 uint mVelocityZoneUsed;
457 AkaiKeygroupSample mSamples[4];
462 bool mHoldAttackUntilLoop;
464 bool mSampleKeyTracking[4];
466 uint8_t mSampleAuxOutOffset[4];
468 int16_t mVelocityToSampleStart[4];
470 int8_t mVelocityToVolumeOffset[4];
485 AkaiDirEntry GetDirEntry();
487 uint ListSamples(std::list<String>& rSamples);
488 AkaiSample* GetSample(uint Index);
489 AkaiSample* GetSample(
const String& rName);
498 uint8_t mMidiProgramNumber;
500 uint8_t mMidiChannel;
512 uint8_t mAuxOutputSelect;
514 uint8_t mMixOutputSelect;
520 int8_t mVelocityToVolume;
524 int8_t mPressureToVolume;
528 uint8_t mPanLFODepth;
530 uint8_t mPanLFODelay;
540 uint8_t mModulationToLFODepth;
542 uint8_t mPressureToLFODepth;
544 uint8_t mVelocityToLFODepth;
546 uint8_t mBendToPitch;
548 int8_t mPressureToPitch;
550 bool mKeygroupCrossfade;
552 uint8_t mNumberOfKeygroups;
555 int8_t mKeyTemperament[11];
559 int8_t mModulationToPan;
561 bool mStereoCoherence;
567 uint8_t mVoiceReassign;
569 uint8_t mSoftpedToVolume;
571 uint8_t mSoftpedToAttack;
573 uint8_t mSoftpedToFilter;
575 int8_t mSoftpedToTuneCents;
577 int8_t mSoftpedToTuneSemitones;
579 int8_t mKeyToLFORate;
581 int8_t mKeyToLFODepth;
583 int8_t mKeyToLFODelay;
585 uint8_t mVoiceOutputScale;
587 uint8_t mStereoOutputScale;
590 AkaiKeygroup* mpKeygroups;
604 std::list<AkaiSample*> mpSamples;
607 AkaiDirEntry mDirEntry;
621 AkaiDirEntry GetDirEntry();
623 uint ListPrograms(std::list<AkaiDirEntry>& rPrograms);
628 uint ListSamples(std::list<AkaiDirEntry>& rSamples);
629 AkaiSample* GetSample(uint Index);
630 AkaiSample* GetSample(
const String& rName);
646 std::list<AkaiProgram*> mpPrograms;
647 std::list<AkaiSample*> mpSamples;
650 AkaiDirEntry mDirEntry;
665 uint ListVolumes(std::list<AkaiDirEntry>& rVolumes);
682 std::list<AkaiVolume*> mpVolumes;
702 uint GetPartitionCount();
707 std::list<AkaiPartition*> mpPartitions;
710 #define AKAI_FILE_ENTRY_SIZE 24
711 #define AKAI_DIR_ENTRY_OFFSET 0xca
712 #define AKAI_DIR_ENTRY_SIZE 16
713 #define AKAI_ROOT_ENTRY_OFFSET 0x0
715 #define AKAI_PARTITION_END_MARK 0x8000
716 #define AKAI_BLOCK_SIZE 0x2000
718 #define AKAI_FAT_OFFSET 0x70a
720 #define AKAI_MAX_FILE_ENTRIES_S1000 125
721 #define AKAI_MAX_FILE_ENTRIES_S3000 509
722 #define AKAI_MAX_DIR_ENTRIES 100
723 #define AKAI_TYPE_DIR_S1000 1
724 #define AKAI_TYPE_DIR_S3000 3
726 #define AKAI_PROGRAM_ID 1
727 #define AKAI_KEYGROUP_ID 2
728 #define AKAI_SAMPLE_ID 3
Toplevel AKAI image interpreter.
Encapsulates one disk partition of an AKAI disk.
AKAI instrument definition.
Subdivision of an AKAI disk partition.
Accessing AKAI image either from file or a drive (i.e.
bool WriteImage(const char *path)
Extract Akai data track and write it into a regular file.
virtual int Read(void *pData, uint WordCount, uint WordSize)
Returns number of successfully read words.
DiskImage(const char *path)
Open an image from a file.