changeset 8741:46d21c0f36aa

(nicer) endianness fix for every plugin except pl_format
author colin
date Fri, 03 Jan 2003 15:12:18 +0000
parents cd67631ae382
children 241f40ef5e28
files libao2/afmt.h libao2/pl_eq.c libao2/pl_extrastereo.c libao2/pl_resample.c libao2/pl_surround.c libao2/pl_volnorm.c libao2/pl_volume.c
diffstat 7 files changed, 13 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/afmt.h	Fri Jan 03 14:51:49 2003 +0000
+++ b/libao2/afmt.h	Fri Jan 03 15:12:18 2003 +0000
@@ -9,6 +9,8 @@
 #endif
 #endif
 
+#include "../config.h" /* for native endianness */
+
 /* standard, old OSS audio formats */
 #ifndef AFMT_MU_LAW
 #	define AFMT_MU_LAW		0x00000001
--- a/libao2/pl_eq.c	Fri Jan 03 14:51:49 2003 +0000
+++ b/libao2/pl_eq.c	Fri Jan 03 15:12:18 2003 +0000
@@ -122,7 +122,7 @@
   float F[KM] = CF;
   
   // Check input format
-  if(ao_plugin_data.format != AFMT_S16_LE){
+  if(ao_plugin_data.format != AFMT_S16_NE){
     fprintf(stderr,"[pl_eq] Input audio format not yet supported. \n");
     return 0;
   }
--- a/libao2/pl_extrastereo.c	Fri Jan 03 14:51:49 2003 +0000
+++ b/libao2/pl_extrastereo.c	Fri Jan 03 15:12:18 2003 +0000
@@ -20,7 +20,6 @@
 #include "audio_plugin.h"
 #include "audio_plugin_internal.h"
 #include "afmt.h"
-#include "../config.h"
 
 static ao_info_t info = {
         "Extra stereo plugin",
@@ -58,11 +57,7 @@
 // return: 1=success 0=fail
 static int init(){
   switch(ao_plugin_data.format){
-#ifndef WORDS_BIGENDIAN
-  case(AFMT_S16_LE):
-#else
-  case(AFMT_S16_BE):
-#endif
+  case(AFMT_S16_NE):
     break;
   default:
     fprintf(stderr,"[pl_extrastereo] Audio format not yet suported \n");
@@ -92,11 +87,7 @@
 static int play(){
 
   switch(pl_extrastereo.format){
-#ifndef WORDS_BIGENDIAN
-  case(AFMT_S16_LE): {
-#else
-  case(AFMT_S16_BE): {
-#endif
+  case(AFMT_S16_NE): {
 
     int16_t* data=(int16_t*)ao_plugin_data.data;
     int len=ao_plugin_data.len / 2; // 16 bits samples
--- a/libao2/pl_resample.c	Fri Jan 03 14:51:49 2003 +0000
+++ b/libao2/pl_resample.c	Fri Jan 03 15:12:18 2003 +0000
@@ -24,7 +24,6 @@
 #include "audio_plugin.h"
 #include "audio_plugin_internal.h"
 #include "afmt.h"
-#include "../config.h"
 
 static ao_info_t info =
 {
@@ -120,11 +119,7 @@
   pl_resample.up=UP;
 
   // Sheck input format
-#ifndef WORDS_BIGENDIAN
-  if(ao_plugin_data.format != AFMT_S16_LE){
-#else
-  if(ao_plugin_data.format != AFMT_S16_BE){
-#endif	  
+  if(ao_plugin_data.format != AFMT_S16_NE){
     fprintf(stderr,"[pl_resample] Input audio format not yet suported. \n");
     return 0;
   }
--- a/libao2/pl_surround.c	Fri Jan 03 14:51:49 2003 +0000
+++ b/libao2/pl_surround.c	Fri Jan 03 15:12:18 2003 +0000
@@ -108,8 +108,8 @@
     pl_surround.passthrough = 1;
     return 1;
   }
-  if (ao_plugin_data.format != AFMT_S16_LE) {
-    fprintf(stderr, "pl_surround: I'm dumb and can only handle AFMT_S16_LE audio format, using passthrough mode\n");
+  if (ao_plugin_data.format != AFMT_S16_NE) {
+    fprintf(stderr, "pl_surround: I'm dumb and can only handle AFMT_S16_NE audio format, using passthrough mode\n");
     pl_surround.passthrough = 1;
     return 1;
   }
--- a/libao2/pl_volnorm.c	Fri Jan 03 14:51:49 2003 +0000
+++ b/libao2/pl_volnorm.c	Fri Jan 03 15:12:18 2003 +0000
@@ -31,7 +31,6 @@
 #include "audio_plugin.h"
 #include "audio_plugin_internal.h"
 #include "afmt.h"
-#include "../config.h"
 
 static ao_info_t info = {
         "Volume normalizer",
@@ -117,11 +116,7 @@
 // return: 1=success 0=fail
 static int init(){
   switch(ao_plugin_data.format){
-#ifndef WORDS_BIGENDIAN
-    case(AFMT_S16_LE):
-#else
-    case(AFMT_S16_BE):
-#endif
+    case(AFMT_S16_NE):
       break;
     default:
       fprintf(stderr,"[pl_volnorm] Audio format not yet supported.\n");
@@ -147,11 +142,7 @@
   int i;
   mul = MUL_INIT;
   switch(ao_plugin_data.format) {
-#ifndef WORDS_BIGENDIAN
-    case(AFMT_S16_LE):
-#else
-    case(AFMT_S16_BE):
-#endif
+    case(AFMT_S16_NE):
 #if AVG==1
       lastavg = MID_S16;
 #elif AVG==2
@@ -174,11 +165,7 @@
 static int play(){
 
   switch(pl_volnorm.format){
-#ifndef WORDS_BIGENDIAN
-  case(AFMT_S16_LE): {
-#else
-  case(AFMT_S16_BE): {
-#endif
+  case(AFMT_S16_NE): {
 #define CLAMP(x,m,M) do { if ((x)<(m)) (x) = (m); else if ((x)>(M)) (x) = (M); } while(0)
 
     int16_t* data=(int16_t*)ao_plugin_data.data;
--- a/libao2/pl_volume.c	Fri Jan 03 14:51:49 2003 +0000
+++ b/libao2/pl_volume.c	Fri Jan 03 15:12:18 2003 +0000
@@ -81,7 +81,7 @@
   // Sanity sheck this plugin supports AFMT_U8 and AFMT_S16_LE
   switch(ao_plugin_data.format){
   case(AFMT_U8):
-  case(AFMT_S16_LE):
+  case(AFMT_S16_NE):
     break;
   default: 
     fprintf(stderr,"[pl_volume] Audio format not yet suported \n");
@@ -135,7 +135,7 @@
       }
       break;
   }
-  case(AFMT_S16_LE):{
+  case(AFMT_S16_NE):{
     register int len=ao_plugin_data.len>>1;
     register int16_t* data=(int16_t*)ao_plugin_data.data;
     register int x;