1 /* 2 playAudio.h 3 PortAudio v19 header file for playAudio.c 4 Depends on: 5 portaudio.h 6 7 Copyright (C) 2008 Bret Logan 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 2 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 24 //IMPORTANT: PortAudio was used for multi-platform compatibility. PortAudio v18 25 //still uses OSS, which is a problem because most linux systems now are ALSA, 26 //and therefore only emulate OSS. And the drawback: ALSA doesn't mix OSS apps 27 //well or at all. This means that a cheap soundcard with no onboard mixers 28 //(most, actually), can only run one OSS a time (unlike real OSS, which did 29 //software mixing). 30 //PortAudio v19 has ALSA in it; this file represents the last stable v18 31 //before Gnaural switches to v19, which is sometimes called "PortAudio2" 32 33 #ifndef _PLAYAUDIO_H_ 34 #define _PLAYAUDIO_H_ 35 36 #include <portaudio.h> 37 38 #define GNAURAL_SAMPLE_RATE (BB_AUDIOSAMPLERATE) 39 //20081128: buffer reduced from 4096 to 1024 because MacOS didn't like it: 40 //20090107: turns out Win32 doesn't like 1024! Adding #ifdef for MacOSX and 41 // upping buffer for others to 8192 so Vista might stop stuttering: 42 #ifdef GNAURAL_MACOSX 43 #define GNAURAL_FRAMES_PER_BUFFER (1024) 44 #else 45 #define GNAURAL_FRAMES_PER_BUFFER (8192) 46 #endif 47 #define GNAURAL_OUTPUT_DEVICE Pa_GetDefaultOutputDeviceID() 48 49 //START Globals for Port Audio handling: 50 extern PaStream *playAudio_SoundStream; //this will equal NULL if the sound system wasn't detected, so use to check 51 extern PaDeviceIndex playAudio_SoundDevice; 52 53 extern int playAudio_SoundInit (char *result_str); //pass it a string >= 1024 54 extern void playAudio_SoundStart (); 55 extern void playAudio_SoundCleanup (); 56 57 //NOTE: in main.c also has static int playAudio_MyCallback (); 58 59 #endif 60