Diff for /xmil/palm/soundmng.c between versions 1.1 and 1.2

version 1.1, 2005/02/07 16:56:32 version 1.2, 2005/02/26 03:59:50
Line 25  static BOOL  QSound_Playing = FALSE; Line 25  static BOOL  QSound_Playing = FALSE;
   
 void *Callback_sound = NULL;  void *Callback_sound = NULL;
   
 //static Err QSoundCallback(void* userDataP, SndStreamRef stream, void* bufferP, UInt32 frameCount);  
   
 Err m68k_sound_init (void* data) {  Err m68k_sound_init (void* data) {
         Err ret = 0;          Err ret = 0;
         ArgOne params;          ArgOne params;
Line 35  Err m68k_sound_init (void* data) { Line 33  Err m68k_sound_init (void* data) {
         ret = (Err)(gCall68KFuncP)(gEmulStateP, (unsigned long)Callback_sound, &params, sizeof(params));          ret = (Err)(gCall68KFuncP)(gEmulStateP, (unsigned long)Callback_sound, &params, sizeof(params));
         return(ret);          return(ret);
 }  }
 /*  
 Err ARM_SndStreamCreate (void* strem, Int8 mode, UINT32 rate, Int16 type, Int8 width, SndStreamBufferCallback cb, void* userData, UINT32 size, Boolean arm) {  
   
 typedef struct RAWDATA {  
         UINT32  s_all;  
         UINT32  m_r;  
         UINT32  r_t;  
         UINT32  w_c;  
         UINT32  c_d;  
         UINT32  d_z;  
         UINT32  z_a;  
 } param;  
   
         param   args;  
         Err ret = 0;  
           
         args.s_all = ByteSwap32(strem);  
         args.m_r = ((UINT32)mode << 8) | (ByteSwap32(rate) << 16);  
         args.r_t = ByteSwap16(rate & 0xffff) | ByteSwap32(type);  
         args.w_c = ((UINT32)width << 8) | (ByteSwap32(cb) << 16);  
         args.c_d = (ByteSwap16(cb & 0xffff)) | (ByteSwap32(userData) << 16);  
         args.d_z = (ByteSwap16(userData & 0xffff)) | (ByteSwap32(size) << 16);  
         args.z_a = (ByteSwap16(size & 0xffff)) | ByteSwap32(arm);  
   
         ret = (Err)(gCall68KFuncP)(gEmulStateP, PceNativeTrapNo(sysTrapSndStreamCreate), &args, sizeof(args));  
         return(ret);  
 }  
 //static Err QSoundCallback(void* userDataP, SndStreamRef stream, void* bufferP, UInt32 frameCount) {  
 Err QSoundCallback(void* indata) {  
   
         typedef struct {  
                 UINT8*  buffer;  
                 UINT32  frames;  
         } CALLBACKDATA;  
           
 const SINT32    *src;  
         CALLBACKDATA* data = indata;  
           
         if (QSound_Playing) {  
                 src = sound_pcmlock();  
                 if (src) {  
                         satuation_s16(data->buffer, src, data->frames);  
                         sound_pcmunlock(src);  
                 }  
         }  
   
         return(0);  
 }  
 */  
   
 static BOOL SoundBuffer_Init(UINT rate, UINT samples) {  static BOOL SoundBuffer_Init(UINT rate, UINT samples) {
   
Line 91  static BOOL SoundBuffer_Init(UINT rate,  Line 40  static BOOL SoundBuffer_Init(UINT rate, 
         Err                             err;          Err                             err;
         UINT32                  buffersize;          UINT32                  buffersize;
         SINT16*                 buffer[SOUNDBUFFERS];          SINT16*                 buffer[SOUNDBUFFERS];
 //      SndStreamRef    ref;  
         int     i;          int     i;
                   
         qs = &QSound;          qs = &QSound;
Line 107  static BOOL SoundBuffer_Init(UINT rate,  Line 55  static BOOL SoundBuffer_Init(UINT rate, 
                 ZeroMemory(buffer[i], buffersize);                  ZeroMemory(buffer[i], buffersize);
         }          }
                   
 //      err = ARM_SndStreamCreate(&ref, sndOutput, rate, sndInt16Little, sndStereo, QSoundCallback, qs, 0, true);  
         err = m68k_sound_init(qs);          err = m68k_sound_init(qs);
         if (!err) {          if (!err) {
 //              ref = ByteSwap32(ref);  
 //              err = ARM_SndStreamSetVolume(ref, sndGameVolume);  
 //              qs->hdl = ref;  
 //              qs->cb = QSoundCallback;  
                 qs->indata = SOUNDBUFFERS-1;                  qs->indata = SOUNDBUFFERS-1;
                 qs->pos = 0;                  qs->pos = 0;
                 for (i=0;i<SOUNDBUFFERS;i++) {                  for (i=0;i<SOUNDBUFFERS;i++) {
Line 154  UINT soundmng_create(UINT rate, UINT ms) Line 97  UINT soundmng_create(UINT rate, UINT ms)
         else if (rate > 44100) {          else if (rate > 44100) {
                 rate = 44100;                  rate = 44100;
         }          }
 /*  
         if (SoundChannel_Init()) {  
                 goto qsinit_err;  
         }  
 */  
         samples = rate * ms / (SOUNDBUFFERS * 1000);          samples = rate * ms / (SOUNDBUFFERS * 1000);
         samples = (samples + 3) & (~3);          samples = (samples + 3) & (~3);
         if (SoundBuffer_Init(rate, samples)) {          if (SoundBuffer_Init(rate, samples)) {
Line 176  void soundmng_destroy(void) { Line 115  void soundmng_destroy(void) {
         if (QS_Avail) {          if (QS_Avail) {
                 QS_Avail = FALSE;                  QS_Avail = FALSE;
                 SoundBuffer_Term();                  SoundBuffer_Term();
 //              SoundChannel_Term();  
         }          }
 }  }
   

Removed from v.1.1  
changed lines
  Added in v.1.2


RetroPC.NET-CVS <cvs@retropc.net>