Subversion Repositories Kolibri OS

Rev

Rev 376 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 376 Rev 570
Line 20... Line 20...
20
#include "sound.h"
20
#include "sound.h"
Line 21... Line 21...
21
 
21
 
22
#define MP3_ERROR_OUT_OF_BUFFER  5
22
#define MP3_ERROR_OUT_OF_BUFFER  5
Line 23... Line 23...
23
int m_last_error;
23
int m_last_error;
-
 
24
 
-
 
25
void _stdcall thread_proc(void *param);
-
 
26
void _stdcall create_thread(void *proc, void *param, int stack_size);
24
 
27
void _stdcall send_ipc(int dst, DWORD code);
25
void thread_proc();
28
 
26
void touch(char *buf, int size);
29
void touch(char *buf, int size);
Line 27... Line 30...
27
int mp3FindSync(byte* buf, int size, int* sync);
30
int mp3FindSync(byte* buf, int size, int* sync);
Line 39... Line 42...
39
CTRL_INFO info;
42
CTRL_INFO info;
Line 40... Line 43...
40
 
43
 
Line 41... Line 44...
41
FILEINFO   fileinfo;
44
FILEINFO   fileinfo;
42
 
45
 
43
int m_vol;
46
int m_vol;
44
int l_vol=-500;
47
int l_vol=-700;     //-7db
Line 45... Line 48...
45
int r_vol=-500;
48
int r_vol=-700;
46
int pan =0;
49
int pan =0;
47
 
50
 
Line 108... Line 111...
108
    str++;
111
    str++;
109
  }
112
  }
110
}
113
}
Line 111... Line 114...
111
 
114
 
-
 
115
int main(int argc, char *argv[])      //int argc, char *argv[])
112
int main(int argc, char *argv[])      //int argc, char *argv[])
116
{
113
{ DWORD fmt;
-
 
114
   char *thread_stack;
117
   DWORD fmt;
115
   DWORD r_bytes;
118
   DWORD r_bytes;
116
   int retval;
119
   int retval;
117
   int err;
120
   int err;
Line 118... Line 121...
118
   int ver;
121
   int ver;
-
 
122
    
119
    
123
   fname = argv[1];
-
 
124
   debug_out_str("\n\rPlay file ");
Line 120... Line 125...
120
   fname = argv[1];
125
   debug_out_str(fname); 
121
   //debug_out_str(fname); 
126
   debug_out_str("\n\r");
-
 
127
    
122
    
128
   InitHeap(1024*1024);
123
   InitHeap(1024*1024);
129
   if(get_fileinfo(fname, &fileinfo)==FILE_NOT_FOUND)
Line 124... Line 130...
124
   if(get_fileinfo(fname, &fileinfo)==FILE_NOT_FOUND)
130
   {  debug_out_str("\n\rfile not found\n\r"); 
125
      return 0;
131
      return 0;
126
 
132
   };
127
   
133
 
128
   if(err = InitSound(&ver))
134
   if(err = InitSound(&ver))
Line -... Line 135...
-
 
135
   {  
129
   {  
136
     debug_out_str("Sound service not installed\n\r"); 
130
     debug_out_str("Sound service not installed\n\r"); 
137
     return 0;
131
     return 0;
138
   }
132
   }
139
   
133
   
140
   if( (SOUND_VERSION>(ver&0xFFFF)) ||
Line 174... Line 181...
174
   status = ST_PLAY;
181
   status = ST_PLAY;
Line 175... Line 182...
175
   
182
   
176
   if (err = CreateBuffer(fmt,0, &hBuff))
183
   if (err = CreateBuffer(fmt,0, &hBuff))
177
   {
184
   {
178
     debug_out_str("create buffer return error\n\r"); 
185
     debug_out_str("create buffer return error\n\r"); 
179
     return 0;
186
    ; return 0;
Line 180... Line 187...
180
   }
187
   }
181
       
188
       
182
   SetVolume(hBuff,l_vol,r_vol);
-
 
Line 183... Line 189...
183
   thread_stack = UserAlloc(4096);
189
   SetVolume(hBuff,l_vol,r_vol);
Line 184... Line 190...
184
   thread_stack+=4092;
190
   GetVolume(hBuff,&l_vol,&r_vol); 
185
 
191
 
186
   CreateThread(thread_proc, thread_stack);
192
   create_thread(thread_proc, 0, 4096);
187
 
193
 
Line 287... Line 293...
287
      };
293
      };
288
    }
294
    }
289
    else
295
    else
290
      if(totalout < 8192)
296
      if(totalout < 8192)
291
        continue;
297
        continue;
292
/*       
-
 
293
     _asm
-
 
294
  {  push edx
-
 
295
      push eax 
-
 
296
      mov eax, 0xFF
-
 
297
      mov edx, 0x400
-
 
298
      out dx, al
-
 
299
      pop eax
-
 
300
      pop edx  
-
 
301
  };  
-
 
302
*/      
-
 
303
    outPtr = outbuf;      
298
    outPtr = outbuf;      
304
    while (totalout >= 4096)
299
    while (totalout >= 4096)
305
    { 
300
    { 
Line 306... Line 301...
306
    
301
    
Line 349... Line 344...
349
void snd_stop()
344
void snd_stop()
350
{
345
{
351
  StopBuffer(hBuff);
346
  StopBuffer(hBuff);
352
};
347
};
Line 353... Line 348...
353
 
348
 
354
void thread_proc()
349
void _stdcall thread_proc(void *param)
355
{  int evnt;
350
{  int evnt;
356
   int pos;
351
   int pos;
Line 357... Line 352...
357
   int key;
352
   int key;