/* audio wrapper for SDL Copyright (C) 2000 Martin Vogt This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation. For more information look at the file COPYRIGHT in this package */ #include "../../input/bufferInputStream.h" #include #include #if defined WIN32 #include #include #else #include #include #endif //static SDL_AudioSpec actual; static BufferInputStream* audioRing; static TimeStamp* dummy; static int lOpen=false; int audioConstruct() { cout << "audioConstruct ********* SDL"<open("audioSDL"); dummy=new TimeStamp(); lOpen=false; return true; } void audioDestruct() { delete audioRing; delete dummy; } int audioOpen() { return true; } void audioClose() { lOpen=false; SDL_CloseAudio(); } void audioCallback(void *, Uint8 *stream, int len) { char* startPtr; TimeStamp* start; int bytePos; int read=audioRing->readRemote(&startPtr,len); SDL_MixAudio(stream, (Uint8*) startPtr, read, SDL_MIX_MAXVOLUME); audioRing->forwardReadPtr(read); // dequeue time stamps bytePos=audioRing->getBytePosition(); start=audioRing->getTimeStamp(bytePos); } void audioInit(int sampleSize,int frequency, int stereo, int sign, int big) { if( sign == 0 ) { fprintf(stderr, "%s, %d: expecting signed audio data, " "initialized unsigned (ignored)\n", __FILE__, __LINE__ ); } if( big != 0 ) { fprintf(stderr, "%s, %d: expecting little endian audio data, " "initialized big endian (ignored)\n", __FILE__, __LINE__ ); } cout << "SDL audioInit: " << " sampleSize:"< return"<write(buffer,count,dummy); return count; } int getAudioFd() { return false; } int getAudioBufferSize() { int buf=1024*65; return buf; }