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

Diff of /libgig/trunk/src/Akai.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3052 by schoenebeck, Sun Jun 1 00:28:46 2014 UTC revision 3053 by schoenebeck, Wed Dec 14 18:55:08 2016 UTC
# Line 153  static kern_return_t GetBSDPath(io_itera Line 153  static kern_return_t GetBSDPath(io_itera
153    
154  // Given the path to a CD drive, open the drive.  // Given the path to a CD drive, open the drive.
155  // Return the file descriptor associated with the device.  // Return the file descriptor associated with the device.
156  static int OpenDrive(const char *bsdPath) {  /*static int OpenDrive(const char *bsdPath) {
157      int fileDescriptor;      int fileDescriptor;
158            
159      // This open() call will fail with a permissions error if the sample has been changed to      // This open() call will fail with a permissions error if the sample has been changed to
# Line 168  static int OpenDrive(const char *bsdPath Line 168  static int OpenDrive(const char *bsdPath
168      }      }
169            
170      return fileDescriptor;      return fileDescriptor;
171  }  }*/
172    
173  // Given the file descriptor for a whole-media CD device, read a sector from the drive.  // Given the file descriptor for a whole-media CD device, read a sector from the drive.
174  // Return true if successful, otherwise false.  // Return true if successful, otherwise false.
175  static Boolean ReadSector(int fileDescriptor) {  /*static Boolean ReadSector(int fileDescriptor) {
176      char *buffer;      char *buffer;
177      ssize_t numBytes;      ssize_t numBytes;
178      u_int32_t blockSize;      u_int32_t blockSize;
# Line 202  static Boolean ReadSector(int fileDescri Line 202  static Boolean ReadSector(int fileDescri
202      free(buffer);      free(buffer);
203            
204      return numBytes == blockSize ? true : false;      return numBytes == blockSize ? true : false;
205  }  }*/
206    
207  // Given the file descriptor for a device, close that device.  // Given the file descriptor for a device, close that device.
208  static void CloseDrive(int fileDescriptor) {  /*static void CloseDrive(int fileDescriptor) {
209      close(fileDescriptor);      close(fileDescriptor);
210  }  }*/
211    
212  // path is the BSD path to a raw device such as /dev/rdisk1  // path is the BSD path to a raw device such as /dev/rdisk1
213  static struct _CDTOC * ReadTOC(const char *devpath) {  static struct _CDTOC * ReadTOC(const char *devpath) {
# Line 514  bool AkaiProgram::Load() Line 514  bool AkaiProgram::Load()
514      return false;      return false;
515    }    }
516    //     2-3     first keygroup address      150,0          //     2-3     first keygroup address      150,0      
517    uint16_t KeygroupAddress = mpDisk->ReadInt16();    /*uint16_t KeygroupAddress =*/ mpDisk->ReadInt16();
518    //     4-15    program name                10,10,10... AKAII character set    //     4-15    program name                10,10,10... AKAII character set
519    char buffer[13];    char buffer[13];
520    mpDisk->Read(buffer, 12, 1);    mpDisk->Read(buffer, 12, 1);
# Line 660  bool AkaiKeygroup::Load(DiskImage* pDisk Line 660  bool AkaiKeygroup::Load(DiskImage* pDisk
660    if (pDisk->ReadInt8() != AKAI_KEYGROUP_ID)    if (pDisk->ReadInt8() != AKAI_KEYGROUP_ID)
661      return false;      return false;
662    //     2-3     next keygroup address       44,1        300,450,600,750.. (16-bit)    //     2-3     next keygroup address       44,1        300,450,600,750.. (16-bit)
663    uint16_t NextKeygroupAddress = pDisk->ReadInt16();    /*uint16_t NextKeygroupAddress =*/ pDisk->ReadInt16();
664    //     4       low key                     24          24..127    //     4       low key                     24          24..127
665    mLowKey = pDisk->ReadInt8();    mLowKey = pDisk->ReadInt8();
666    //     5       high key                    127         24..127    //     5       high key                    127         24..127
# Line 790  bool AkaiKeygroupSample::Load(DiskImage* Line 790  bool AkaiKeygroupSample::Load(DiskImage*
790    //     47      low vel                     0           0..127    //     47      low vel                     0           0..127
791    mLowLevel = pDisk->ReadInt8();    mLowLevel = pDisk->ReadInt8();
792    //     48      high vel                    127         0..127    //     48      high vel                    127         0..127
793    uint8_t mHighLevel = pDisk->ReadInt8();    /*uint8_t mHighLevel =*/ pDisk->ReadInt8();
794    //     49      tune cents                  0           -128..127 (-50..50 cents)    //     49      tune cents                  0           -128..127 (-50..50 cents)
795    int8_t mTuneCents = pDisk->ReadInt8();    /*int8_t mTuneCents =*/ pDisk->ReadInt8();
796    //     50      tune semitones              0           -50..50    //     50      tune semitones              0           -50..50
797    int8_t mTuneSemitones = pDisk->ReadInt8();    /*int8_t mTuneSemitones =*/ pDisk->ReadInt8();
798    //     51      loudness                    0           -50..+50    //     51      loudness                    0           -50..+50
799    int8_t mLoudness = pDisk->ReadInt8();    /*int8_t mLoudness =*/ pDisk->ReadInt8();
800    //     52      filter                      0           -50..+50    //     52      filter                      0           -50..+50
801    int8_t mFilter = pDisk->ReadInt8();    /*int8_t mFilter =*/ pDisk->ReadInt8();
802    //     53      pan                         0           -50..+50    //     53      pan                         0           -50..+50
803    int8_t mPan = pDisk->ReadInt8();    /*int8_t mPan =*/ pDisk->ReadInt8();
804    //     54      loop mode                   0           0=AS_SAMPLE 1=LOOP_IN_REL    //     54      loop mode                   0           0=AS_SAMPLE 1=LOOP_IN_REL
805    //                                                     2=LOOP_UNTIL_REL 3=NO_LOOP    //                                                     2=LOOP_UNTIL_REL 3=NO_LOOP
806    //                                                     4=PLAY_TO_END    //                                                     4=PLAY_TO_END
807    uint8_t mLoopMode = pDisk->ReadInt8();    /*uint8_t mLoopMode =*/ pDisk->ReadInt8();
808    //     55      (internal use)              255    //     55      (internal use)              255
809    pDisk->ReadInt8();    pDisk->ReadInt8();
810    //     56      (internal use)              255    //     56      (internal use)              255
# Line 1525  DiskImage::DiskImage(int disk) Line 1525  DiskImage::DiskImage(int disk)
1525          // get the address of the immediately previous (or following depending          // get the address of the immediately previous (or following depending
1526          // on how you look at it).  The difference in the sector numbers          // on how you look at it).  The difference in the sector numbers
1527          // is returned as the sized of the data track.          // is returned as the sized of the data track.
1528          for (int i=toc_entries - 1; i>=0; i-- )          for (ssize_t i=toc_entries - 1; i>=0; i-- )
1529          {          {
1530            if ( start_sector != -1 )            if ( start_sector != -1 )
1531            {            {
# Line 1559  DiskImage::DiskImage(int disk) Line 1559  DiskImage::DiskImage(int disk)
1559      {      {
1560        printf("opened file: %s\n",bsdPath);        printf("opened file: %s\n",bsdPath);
1561    
1562              mSize = lseek(mFile,1000000000,SEEK_SET);              mSize = (int) lseek(mFile,1000000000,SEEK_SET);
1563              printf("size %d\n",mSize);              printf("size %d\n",mSize);
1564              lseek(mFile,0,SEEK_SET);              lseek(mFile,0,SEEK_SET);
1565    
# Line 1686  int DiskImage::Read(void* pData, uint Wo Line 1686  int DiskImage::Read(void* pData, uint Wo
1686        if (mCluster * mClusterSize != lseek(mFile, mCluster * mClusterSize, SEEK_SET))        if (mCluster * mClusterSize != lseek(mFile, mCluster * mClusterSize, SEEK_SET))
1687          return readbytes / WordSize;          return readbytes / WordSize;
1688  //          printf("trying to read %d bytes from device!\n",mClusterSize);  //          printf("trying to read %d bytes from device!\n",mClusterSize);
1689        int size = read(mFile, mpCache, mClusterSize);        /*int size =*/ read(mFile, mpCache, mClusterSize);
1690  //          printf("read %d bytes from device!\n",size);  //          printf("read %d bytes from device!\n",size);
1691  #endif  #endif
1692      }      }
# Line 1802  void DiskImage::OpenStream(const char* p Line 1802  void DiskImage::OpenStream(const char* p
1802    if (S_ISREG(filestat.st_mode)) { // regular file    if (S_ISREG(filestat.st_mode)) { // regular file
1803      printf("Using regular Akai image file.\n");      printf("Using regular Akai image file.\n");
1804      mRegularFile = true;      mRegularFile = true;
1805      mSize        = filestat.st_size;      mSize        = (int) filestat.st_size;
1806      mClusterSize = DISK_CLUSTER_SIZE;      mClusterSize = DISK_CLUSTER_SIZE;
1807      mpCache = (char*) malloc(mClusterSize);      mpCache = (char*) malloc(mClusterSize);
1808    } else { // CDROM    } else { // CDROM

Legend:
Removed from v.3052  
changed lines
  Added in v.3053

  ViewVC Help
Powered by ViewVC