aboutsummaryrefslogtreecommitdiff
path: root/pd/src/s_audio.c
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2005-10-15 23:14:28 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2005-10-15 23:14:28 +0000
commit9ac980fd47d057cccd89eb52909bd2afec79569a (patch)
tree84594bdc9f730e873c051d3085317827610b00fc /pd/src/s_audio.c
parentc23dc858c7362d6f72b797e5d06f3f81280d67b9 (diff)
Bug fixes, notably for mac if no audio input device is available; also
worked around a problem in ASIO support on MSW (but need to fix it better.) svn path=/trunk/; revision=3717
Diffstat (limited to 'pd/src/s_audio.c')
-rw-r--r--pd/src/s_audio.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/pd/src/s_audio.c b/pd/src/s_audio.c
index ad4e862d..cbfd6f0c 100644
--- a/pd/src/s_audio.c
+++ b/pd/src/s_audio.c
@@ -25,6 +25,12 @@ typedef long t_pa_sample;
#define SYS_BYTESPERCHAN (DEFDACBLKSIZE * SYS_SAMPLEWIDTH)
#define SYS_XFERSAMPS (SYS_DEFAULTCH*DEFDACBLKSIZE)
#define SYS_XFERSIZE (SYS_SAMPLEWIDTH * SYS_XFERSAMPS)
+#define MAXNDEV 20
+#define DEVDESCSIZE 80
+
+static void audio_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int *canmulti,
+ int maxndev, int devdescsize);
/* these are set in this file when opening audio, but then may be reduced,
even to zero, in the system dependent open_audio routines. */
@@ -167,6 +173,11 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
int inchans, outchans;
int realinchans[MAXAUDIOINDEV], realoutchans[MAXAUDIOOUTDEV];
+ char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
+ int indevs = 0, outdevs = 0, canmulti = 0;
+ audio_getdevs(indevlist, &indevs, outdevlist, &outdevs, &canmulti,
+ MAXNDEV, DEVDESCSIZE);
+
if (sys_externalschedlib)
{
return;
@@ -188,10 +199,14 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
{ /* no input audio devices specified */
if (nchindev == -1)
{
- nchindev=1;
- chindev[0] = defaultchannels;
- naudioindev = 1;
- audioindev[0] = DEFAULTAUDIODEV;
+ if (indevs >= 1)
+ {
+ nchindev=1;
+ chindev[0] = defaultchannels;
+ naudioindev = 1;
+ audioindev[0] = DEFAULTAUDIODEV;
+ }
+ else naudioindev = nchindev = 0;
}
else
{
@@ -234,10 +249,14 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
{ /* not set */
if (nchoutdev == -1)
{
- nchoutdev=1;
- choutdev[0]=defaultchannels;
- naudiooutdev=1;
- audiooutdev[0] = DEFAULTAUDIODEV;
+ if (outdevs >= 1)
+ {
+ nchoutdev=1;
+ choutdev[0]=defaultchannels;
+ naudiooutdev=1;
+ audiooutdev[0] = DEFAULTAUDIODEV;
+ }
+ else nchoutdev = naudiooutdev = 0;
}
else
{
@@ -500,9 +519,6 @@ void sys_reportidle(void)
{
}
-#define MAXNDEV 20
-#define DEVDESCSIZE 80
-
static void audio_getdevs(char *indevlist, int *nindevs,
char *outdevlist, int *noutdevs, int *canmulti,
int maxndev, int devdescsize)
@@ -605,6 +621,7 @@ static void sys_listaudiodevs(void )
post("API number %d\n", sys_audioapi);
}
+
/* start an audio settings dialog window */
void glob_audio_properties(t_pd *dummy, t_floatarg flongform)
{