openalbridge/common.h
changeset 2454 c8b1fb10003c
parent 2445 5033848d3afa
child 2458 14296bd366d2
equal deleted inserted replaced
2453:fdb76012b688 2454:c8b1fb10003c
    15  * You should have received a copy of the GNU Lesser General Public License
    15  * You should have received a copy of the GNU Lesser General Public License
    16  * along with this program; if not, write to the Free Software
    16  * along with this program; if not, write to the Free Software
    17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    18  */
    18  */
    19 
    19 
    20 #ifndef COMMON_H
    20 
    21 #define COMMON_H
       
    22 
    21 
    23 #include <stdio.h>
    22 #include <stdio.h>
    24 #include <stdlib.h>
    23 #include <stdlib.h>
    25 #include <stdint.h>
    24 #include <stdint.h>
    26 #include <string.h>
    25 #include <string.h>
    36 #include <process.h>
    35 #include <process.h>
    37 #define syslog(x,y) fprintf(stderr,y)
    36 #define syslog(x,y) fprintf(stderr,y)
    38 #define LOG_INFO 6
    37 #define LOG_INFO 6
    39 #define LOG_ERR 3
    38 #define LOG_ERR 3
    40 #endif
    39 #endif
       
    40 
       
    41 #ifndef COMMON_H
       
    42 #define COMMON_H
    41 
    43 
    42 /* magics */
    44 /* magics */
    43 #define OGG_FILE_FORMAT 0x4F676753
    45 #define OGG_FILE_FORMAT 0x4F676753
    44 #define WAV_FILE_FORMAT 0x52494646
    46 #define WAV_FILE_FORMAT 0x52494646
    45 #define WAV_HEADER_SUBCHUNK2ID 0x64617461
    47 #define WAV_HEADER_SUBCHUNK2ID 0x64617461
    75 #define ENDIAN_BIG_32(x)    x
    77 #define ENDIAN_BIG_32(x)    x
    76 #define ENDIAN_LITTLE_16(x) bswap_16(x)
    78 #define ENDIAN_LITTLE_16(x) bswap_16(x)
    77 #define ENDIAN_BIG_16(x)    x    
    79 #define ENDIAN_BIG_16(x)    x    
    78 #endif
    80 #endif
    79 
    81 
       
    82 /** 1.0 02/03/10 - Defines cross-platform sleep, usleep, etc. [Wu Yongwei] **/
       
    83 #ifndef _SLEEP_H
       
    84 #define _SLEEP_H
       
    85 #ifdef _WIN32
       
    86 # if defined(_NEED_SLEEP_ONLY) && (defined(_MSC_VER) || defined(__MINGW32__))
       
    87 #  include <stdlib.h>
       
    88 #  define sleep(t) _sleep((t) * 1000)
       
    89 # else
       
    90 #  define WIN32_LEAN_AND_MEAN
       
    91 #  include <windows.h>
       
    92 #  define sleep(t)  Sleep((t) * 1000)
       
    93 # endif
       
    94 # ifndef _NEED_SLEEP_ONLY
       
    95 #  define msleep(t) Sleep(t)
       
    96 #  define usleep(t) Sleep((t) / 1000)
       
    97 # endif
       
    98 #else
       
    99 # include <unistd.h>
       
   100 # ifndef _NEED_SLEEP_ONLY
       
   101 #  define msleep(t) usleep((t) * 1000)
       
   102 # endif
       
   103 #endif
       
   104 #endif /* _SLEEP_H */
       
   105 
    80 #pragma pack(1)
   106 #pragma pack(1)
    81 typedef struct _WAV_header_t {
   107 typedef struct _WAV_header_t {
    82         uint32_t ChunkID;
   108         uint32_t ChunkID;
    83         uint32_t ChunkSize;
   109         uint32_t ChunkSize;
    84         uint32_t Format;
   110         uint32_t Format;