/[projet1]/public/pc/tools/osdk/main/Ym2Mym/sources/Ym2Mym.cpp
Defence Force logotype

Diff of /public/pc/tools/osdk/main/Ym2Mym/sources/Ym2Mym.cpp

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

revision 1283 by dbug, Fri Dec 12 20:38:39 2014 UTC revision 1284 by dbug, Sun May 31 14:38:39 2015 UTC
# Line 39  AYC information: http://www.cpcwiki.eu/i Line 39  AYC information: http://www.cpcwiki.eu/i
39  #define OFFNUM  14   //  Bits needed to store off+num of FRAG  #define OFFNUM  14   //  Bits needed to store off+num of FRAG
40    
41    
42    enum DurationMode
43    {
44      DurationModeKeepAll,
45      DurationModeTruncateMode,
46      DurationModeFade
47    };
48    
49    
50  void writebits(unsigned data,int bits,char* &ptrWrite);  void writebits(unsigned data,int bits,char* &ptrWrite);
51    
# Line 80  int main(int argc,char *argv[]) Line 87  int main(int argc,char *argv[])
87      "       -m0 => No size limit [default]\r\n"      "       -m0 => No size limit [default]\r\n"
88      "       -m1234 => Outputs an error if the exported size is too large\r\n"      "       -m1234 => Outputs an error if the exported size is too large\r\n"
89      "\r\n"      "\r\n"
90        " -dxn  Duration mode.\r\n"
91        "       -dt1234 => Truncate at frame 1234\r\n"
92        "       -df1234 => Fade out at frame 1234\r\n"
93        "\r\n"
94      );      );
95    
96    int maxSize=0;    int maxSize=0;
97      int duration=0;
98      DurationMode durationMode=DurationModeKeepAll;
99    int retune_music=1;    int retune_music=1;
100    bool flagVerbosity=false;    bool flagVerbosity=false;
101    bool flag_header=false;    bool flag_header=false;
# Line 123  int main(int argc,char *argv[]) Line 136  int main(int argc,char *argv[])
136        //        other => maximum size        //        other => maximum size
137        maxSize=argumentParser.GetIntegerValue(0);        maxSize=argumentParser.GetIntegerValue(0);
138      }      }
139        else
140        if (argumentParser.IsSwitch("-dt"))
141        {
142          if (durationMode!=DurationModeKeepAll)
143          {
144            ShowError("Can't use -dt and -df at the same time");
145          }
146          durationMode=DurationModeTruncateMode;
147          duration=argumentParser.GetIntegerValue(0);
148        }
149        else
150        if (argumentParser.IsSwitch("-df"))
151        {
152          if (durationMode!=DurationModeKeepAll)
153          {
154            ShowError("Can't use -dt and -df at the same time");
155          }
156          durationMode=DurationModeFade;
157          duration=argumentParser.GetIntegerValue(0);
158        }
159    }    }
160    
161    int adress_start=0;    int adress_start=0;
# Line 401  int main(int argc,char *argv[]) Line 434  int main(int argc,char *argv[])
434      }      }
435    }    }
436    
437      //
438      // Handle the music truncation/fade
439      //
440      if ( (durationMode!=DurationModeKeepAll) && (frameCount>duration) )
441      {
442        length=duration*REGS;
443    
444        if (durationMode==DurationModeFade)
445        {
446          int fadeDuration=50;
447          if (fadeDuration>duration)
448          {
449            fadeDuration=duration;
450          }
451    
452          int fadeStartPosition=duration-fadeDuration;
453          for (n=8;n<10;n++)
454          {
455            for (row=fadeStartPosition;row<duration;row++)
456            {
457              unsigned char startVolume=data[n][fadeStartPosition];
458              if (startVolume>15)
459              {
460                startVolume=15;
461              }
462              data[n][row]=startVolume-(startVolume*row)/duration;
463            }
464          }
465    
466        }
467    
468        // Make sure the last entry plays nothing
469        data[7][duration-1]=255;    // Active sound channels registers
470      }
471    
472    
473    
474    char* destinationBuffer=(char*)malloc(cBufferSize);    char* destinationBuffer=(char*)malloc(cBufferSize);
475    char* ptrWrite=destinationBuffer;    char* ptrWrite=destinationBuffer;

Legend:
Removed from v.1283  
changed lines
  Added in v.1284

  ViewVC Help
Powered by ViewVC 1.1.26