1 /* 2 * Komposter 3 * 4 * Copyright (c) 2010 Noora Halme et al. (see AUTHORS) 5 * 6 * This code is licensed under the GNU General Public 7 * License version 2. See LICENSE for full text. 8 * 9 * Audio playback and rendering 10 * 11 */ 12 13 #ifndef __AUDIO_H__ 14 #define __AUDIO_H__ 15 16 #include "arch.h" 17 18 #define AUDIOBUFFER_LEN 1024 19 20 // You may need to use larger playback buffers in 21 // some Linux machines to cure stuttering sound 22 //#define AUDIOBUFFER_LEN 4096 23 24 // how many buffers to render ahead of playback. 25 // this and bufferlen above have a direct effect 26 // on the latency. 27 #define AUDIO_RENDER_AHEAD 2 28 29 #define OUTPUTFREQ 44100 30 31 #define AUDIOMODE_MUTE 0 32 #define AUDIOMODE_COMPOSING 1 33 #define AUDIOMODE_PATTERNPLAY 2 34 #define AUDIOMODE_PLAY 3 35 36 #define RENDER_STOPPED 0 37 #define RENDER_START 1 38 #define RENDER_IN_PROGRESS 2 39 #define RENDER_COMPLETE 3 40 #define RENDER_PLAYBACK 4 41 #define RENDER_LIVE 5 42 #define RENDER_LIVE_COMPLETE 6 43 44 int audio_initialize(void); 45 int audio_isplaying(void); 46 void audio_release(void); 47 int audio_update(int cs); 48 int audio_process(short *buffer, long bufferlen); 49 50 void audio_loadpatch(int voice, int synth, int patch); 51 void audio_trignote(int voice, int note); 52 53 void audio_panic(void); 54 void audio_resetsynth(int voice); 55 56 int audio_exportwav(); //char *filename); 57 58 #endif 59