Changeset 295 for libmpc/trunk/libwavformat/input.c
- Timestamp:
- 04/23/07 21:30:30 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/trunk/libwavformat/input.c
r68 r295 16 16 for(n=0;n<p_sample_count;n++) 17 17 { 18 t_wav_ uint32temp;19 20 temp = (t_wav_uint32) (21 ( (t_wav_uint32)p_input[0] ) | 22 ( (t_wav_uint32)p_input[1] << 8) | 23 ( (t_wav_uint32)p_input[2] << 16) | 24 ( (t_wav_uint32)p_input[3] << 24) 18 t_wav_conv temp; 19 20 temp.n = (t_wav_uint32) ( 21 ( (t_wav_uint32)p_input[0] ) | 22 ( (t_wav_uint32)p_input[1] << 8) | 23 ( (t_wav_uint32)p_input[2] << 16) | 24 ( (t_wav_uint32)p_input[3] << 24) 25 25 ); 26 26 27 27 p_input += 4; 28 28 29 p_sample_buffer[n] = *(t_wav_float32*)&temp;29 p_sample_buffer[n] = temp.f; 30 30 } 31 31 } … … 36 36 for(n=0;n<p_sample_count;n++) 37 37 { 38 t_wav_ uint32temp;38 t_wav_conv temp; 39 39 t_wav_int32 tempi; 40 temp = (t_wav_uint32) (41 ( (t_wav_uint32)p_input[0] ) | 42 ( (t_wav_uint32)p_input[1] << 8) | 43 ( (t_wav_uint32)p_input[2] << 16) | 44 ( (t_wav_uint32)p_input[3] << 24) 40 temp.n = (t_wav_uint32) ( 41 ( (t_wav_uint32)p_input[0] ) | 42 ( (t_wav_uint32)p_input[1] << 8) | 43 ( (t_wav_uint32)p_input[2] << 16) | 44 ( (t_wav_uint32)p_input[3] << 24) 45 45 ); 46 46 47 47 p_input += 4; 48 48 49 tempi = (t_wav_int32)( *(t_wav_float32*)&temp* 0x8000);49 tempi = (t_wav_int32)(temp.f * 0x8000); 50 50 if (tempi < -0x8000) tempi = -0x8000; 51 51 else if (tempi > 0x7FFF) tempi = 0x7FFF; … … 61 61 { 62 62 t_wav_int32 temp = (t_wav_int32) ( 63 ( (t_wav_uint32)p_input[0] ) | 64 ( (t_wav_uint32)p_input[1] << 8) | 65 ( (t_wav_uint32)p_input[2] << 16) | 66 ( (t_wav_uint32)p_input[3] << 24) 63 ( (t_wav_uint32)p_input[0] ) | 64 ( (t_wav_uint32)p_input[1] << 8) | 65 ( (t_wav_uint32)p_input[2] << 16) | 66 ( (t_wav_uint32)p_input[3] << 24) 67 67 ); 68 68 … … 79 79 { 80 80 t_wav_int32 temp = (t_wav_int32) ( 81 ( (t_wav_uint32)p_input[0] ) | 82 ( (t_wav_uint32)p_input[1] << 8) | 83 ( (t_wav_uint32)p_input[2] << 16) | 81 ( (t_wav_uint32)p_input[0] ) | 82 ( (t_wav_uint32)p_input[1] << 8) | 83 ( (t_wav_uint32)p_input[2] << 16) | 84 84 ( (t_wav_uint32)p_input[3] << 24) 85 85 ); … … 97 97 { 98 98 t_wav_int32 temp = (t_wav_int32) ( 99 ( (t_wav_uint32)p_input[0] ) | 100 ( (t_wav_uint32)p_input[1] << 8) | 99 ( (t_wav_uint32)p_input[0] ) | 100 ( (t_wav_uint32)p_input[1] << 8) | 101 101 ( (t_wav_int32)(t_wav_int8)p_input[2] << 16) 102 102 ); … … 114 114 { 115 115 t_wav_int32 temp = (t_wav_int32) ( 116 ( (t_wav_uint32)p_input[0] ) | 117 ( (t_wav_uint32)p_input[1] << 8) | 116 ( (t_wav_uint32)p_input[0] ) | 117 ( (t_wav_uint32)p_input[1] << 8) | 118 118 ( (t_wav_int32)(t_wav_int8)p_input[2] << 16) 119 119 ); … … 131 131 { 132 132 t_wav_int16 temp = (t_wav_int16) 133 ( 133 ( 134 134 (t_wav_uint16)p_input[0] | 135 135 ( (t_wav_uint16)p_input[1] << 8 ) … … 148 148 { 149 149 t_wav_int16 temp = (t_wav_int16) 150 ( 150 ( 151 151 (t_wav_uint16)p_input[0] | 152 152 ( (t_wav_uint16)p_input[1] << 8 ) … … 201 201 delta = p_bytes - done; 202 202 if (delta > sizeof(dummy)) delta = sizeof(dummy); 203 203 204 204 delta_done = waveformat_read(p_file,dummy,delta); 205 205 … … 222 222 t_wav_uint8 temp[4]; 223 223 if (waveformat_read(p_file,&temp,sizeof(temp)) != sizeof(temp)) return 0; 224 * p_value = 224 * p_value = 225 225 ((t_wav_uint32)temp[0]) | 226 226 ((t_wav_uint32)temp[1] << 8) | … … 234 234 t_wav_uint8 temp[2]; 235 235 if (waveformat_read(p_file,&temp,sizeof(temp)) != sizeof(temp)) return 0; 236 * p_value = 236 * p_value = 237 237 ((t_wav_uint16)temp[0]) | 238 238 ((t_wav_uint16)temp[1] << 8); … … 295 295 296 296 p_file->m_bytes_per_sample = p_file->m_bits_per_sample / 8; 297 297 298 298 if (p_file->m_bytes_per_sample == 0) return 0; 299 299 … … 351 351 if (waveformat_skip(p_file,fmt_remaining) != fmt_remaining) return 0; 352 352 } 353 353 354 354 main_offset += chunk_size; 355 355 if (chunk_size & 1) main_offset++; … … 372 372 373 373 if (waveformat_skip(p_file,toskip) != toskip) return 0; 374 374 375 375 main_offset += toskip; 376 376 } … … 392 392 { 393 393 t_wav_uint32 delta, deltaread; 394 394 395 395 delta = p_sample_count - samples_read; 396 396 if (delta > p_file->m_buffer_size) delta = p_file->m_buffer_size; 397 397 398 398 deltaread = waveformat_read(p_file,p_file->m_workbuffer,delta * p_file->m_bytes_per_sample) / p_file->m_bytes_per_sample; 399 399 400 400 if (deltaread > 0) 401 401 { 402 402 p_file->m_input_handler.m_convert_float32(p_file->m_workbuffer,p_sample_buffer + samples_read,deltaread); 403 403 404 404 samples_read += deltaread; 405 405 } … … 425 425 { 426 426 t_wav_uint32 delta, deltaread; 427 427 428 428 delta = p_sample_count - samples_read; 429 429 if (delta > p_file->m_buffer_size) delta = p_file->m_buffer_size; 430 430 431 431 deltaread = waveformat_read(p_file,p_file->m_workbuffer,delta * p_file->m_bytes_per_sample) / p_file->m_bytes_per_sample; 432 432 433 433 if (deltaread > 0) 434 434 { 435 435 p_file->m_input_handler.m_convert_int16(p_file->m_workbuffer,p_sample_buffer + samples_read,deltaread); 436 436 437 437 samples_read += deltaread; 438 438 }
Note: See TracChangeset
for help on using the changeset viewer.