4 Copyright 1998-1999, Michael Pruett <michael@68k.org>
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of
9 the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be
12 useful, but WITHOUT ANY WARRANTY; without even the implied
13 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the GNU General Public License for more details.
16 You should have received a copy of the GNU General Public
17 License along with this program; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 These routines are used in SGI-specific test programs.
35 #include <audiofile.h>
37 #include <dmedia/audio.h>
40 Set the sample width of an audio configuration.
42 void setwidth (ALconfig config
, int sampleWidth
)
46 printf("setting width to 8\n");
47 alSetWidth(config
, AL_SAMPLE_8
);
49 else if (sampleWidth
<= 16)
51 printf("setting width to 16\n");
52 alSetWidth(config
, AL_SAMPLE_16
);
54 else if (sampleWidth
<= 24)
56 printf("setting width to 24\n");
57 alSetWidth(config
, AL_SAMPLE_24
);
62 Set the sample format of an audio configuration.
64 void setsampleformat (ALconfig config
, int audioFileSampleFormat
)
66 if (audioFileSampleFormat
== AF_SAMPFMT_TWOSCOMP
)
68 printf("setting sample format to 2's complement\n");
69 alSetSampFmt(config
, AL_SAMPFMT_TWOSCOMP
);
71 else if (audioFileSampleFormat
== AF_SAMPFMT_FLOAT
)
73 printf("setting sample format to float\n");
74 alSetSampFmt(config
, AL_SAMPFMT_FLOAT
);
76 else if (audioFileSampleFormat
== AF_SAMPFMT_DOUBLE
)
78 printf("setting sample format to double\n");
79 alSetSampFmt(config
, AL_SAMPFMT_DOUBLE
);
84 Set the sample rate of an audio port.
86 void setrate (ALport port
, double rate
)
91 rv
= alGetResource(port
);
93 params
.param
= AL_RATE
;
94 params
.value
.ll
= alDoubleToFixed(rate
);
96 if (alSetParams(rv
, ¶ms
, 1) < 0)
98 printf("alSetParams failed: %s\n", alGetErrorString(oserror()));
103 Wait until the audio port has no more samples to play.
105 void waitport (ALport port
)
107 while (alGetFilled(port
) > 0)