这篇教程C++ AUDIO_INITINFO函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AUDIO_INITINFO函数的典型用法代码示例。如果您正苦于以下问题:C++ AUDIO_INITINFO函数的具体用法?C++ AUDIO_INITINFO怎么用?C++ AUDIO_INITINFO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AUDIO_INITINFO函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: pa_solaris_auto_formatstatic int pa_solaris_auto_format(int fd, int mode, pa_sample_spec *ss) { audio_info_t info; AUDIO_INITINFO(&info); if (mode != O_RDONLY) { info.play.sample_rate = ss->rate; info.play.channels = ss->channels; switch (ss->format) { case PA_SAMPLE_U8: info.play.precision = 8; info.play.encoding = AUDIO_ENCODING_LINEAR; break; case PA_SAMPLE_ALAW: info.play.precision = 8; info.play.encoding = AUDIO_ENCODING_ALAW; break; case PA_SAMPLE_ULAW: info.play.precision = 8; info.play.encoding = AUDIO_ENCODING_ULAW; break; case PA_SAMPLE_S16NE: info.play.precision = 16; info.play.encoding = AUDIO_ENCODING_LINEAR; break; default: return -1; } } if (mode != O_WRONLY) { info.record.sample_rate = ss->rate; info.record.channels = ss->channels; switch (ss->format) { case PA_SAMPLE_U8: info.record.precision = 8; info.record.encoding = AUDIO_ENCODING_LINEAR; break; case PA_SAMPLE_ALAW: info.record.precision = 8; info.record.encoding = AUDIO_ENCODING_ALAW; break; case PA_SAMPLE_ULAW: info.record.precision = 8; info.record.encoding = AUDIO_ENCODING_ULAW; break; case PA_SAMPLE_S16NE: info.record.precision = 16; info.record.encoding = AUDIO_ENCODING_LINEAR; break; default: return -1; } } if (ioctl(fd, AUDIO_SETINFO, &info) < 0) { if (errno == EINVAL) pa_log("AUDIO_SETINFO: Unsupported sample format."); else pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno)); return -1; } return 0;}
开发者ID:thewb,项目名称:mokoiax,代码行数:65,
示例2: Pa_QueryDevice/********************************************************************* * Try to open the named device. * If it opens, try to set various rates and formats and fill in * the device info structure. */PaError Pa_QueryDevice( const char *deviceName, internalPortAudioDevice *pad ){ int result = paHostError; int tempDevHandle; int numChannels, maxNumChannels; int numSampleRates; int sampleRate; int numRatesToTry; int ratesToTry[9] = {96000, 48000, 44100, 32000, 24000, 22050, 16000, 11025, 8000}; int i; audio_info_t solaris_info; audio_device_t device_info; /* douglas: we have to do this querying in a slightly different order. apparently some sound cards will give you different info based on their settins. e.g. a card might give you stereo at 22kHz but only mono at 44kHz. the correct order for OSS is: format, channels, sample rate */ /* to check a device for it's capabilities, it's probably better to use the equivalent "-ctl"-descriptor - MR */ char devname[strlen(deviceName) + 4]; snprintf(devname,(strlen(deviceName) + 4),"%sctl",deviceName); if ((tempDevHandle = open(devname, O_WRONLY|O_NONBLOCK)) == -1 ) { DBUG(("Pa_QueryDevice: could not open %s/n", deviceName )); return paHostError; } /* Ask OSS what formats are supported by the hardware. */ pad->pad_Info.nativeSampleFormats = 0; AUDIO_INITINFO(&solaris_info); /* SAM 12/31/01: Sparc native does mulaw, alaw and PCM. I think PCM is signed. */ for (i = 8; i <= 32; i += 8) { solaris_info.play.precision = i; solaris_info.play.encoding = AUDIO_ENCODING_LINEAR; /* If there are no errors, add the format. */ if (ioctl(tempDevHandle, AUDIO_SETINFO, &solaris_info) > -1) { switch (i) { case 8: pad->pad_Info.nativeSampleFormats |= paInt8; break; case 16: pad->pad_Info.nativeSampleFormats |= paInt16; break; case 24: pad->pad_Info.nativeSampleFormats |= paInt24; break; case 32: pad->pad_Info.nativeSampleFormats |= paInt32; break; } } } maxNumChannels = 0; for( numChannels = 1; numChannels <= 16; numChannels++ ) { int temp = numChannels; DBUG(("Pa_QueryDevice: use SNDCTL_DSP_CHANNELS, numChannels = %d/n", numChannels )) AUDIO_INITINFO(&solaris_info); solaris_info.play.channels = temp; if (ioctl(tempDevHandle, AUDIO_SETINFO, &solaris_info) < 0) { /* ioctl() failed so bail out if we already have stereo */ if( numChannels > 2 ) break; } else { /* ioctl() worked but bail out if it does not support numChannels. * We don't want to leave gaps in the numChannels supported. */ if( (numChannels > 2) && (temp != numChannels) ) break; DBUG(("Pa_QueryDevice: temp = %d/n", temp )) if( temp > maxNumChannels ) maxNumChannels = temp; /* Save maximum. */ } } pad->pad_Info.maxOutputChannels = maxNumChannels; DBUG(("Pa_QueryDevice: maxNumChannels = %d/n", maxNumChannels)) /* FIXME - for now, assume maxInputChannels = maxOutputChannels. * Eventually do separate queries for O_WRONLY and O_RDONLY */ pad->pad_Info.maxInputChannels = pad->pad_Info.maxOutputChannels; DBUG(("Pa_QueryDevice: maxInputChannels = %d/n", pad->pad_Info.maxInputChannels))//.........这里部分代码省略.........
开发者ID:greggulrajani,项目名称:squeezeslave,代码行数:101,
示例3: input_soundstatic void input_sound(unsigned int sample_rate, unsigned int overlap, const char *ifname){ audio_info_t audioinfo; audio_info_t audioinfo2; audio_device_t audiodev; int fd; short buffer[8192]; float fbuf[16384]; unsigned int fbuf_cnt = 0; int i; short *sp; if ((fd = open(ifname ? ifname : "/dev/audio", O_RDONLY)) < 0) { perror("open"); exit (10); } if (ioctl(fd, AUDIO_GETDEV, &audiodev) == -1) { perror("ioctl: AUDIO_GETDEV"); exit (10); } AUDIO_INITINFO(&audioinfo); audioinfo.record.sample_rate = sample_rate; audioinfo.record.channels = 1; audioinfo.record.precision = 16; audioinfo.record.encoding = AUDIO_ENCODING_LINEAR; /*audioinfo.record.gain = 0x20; audioinfo.record.port = AUDIO_LINE_IN; audioinfo.monitor_gain = 0;*/ if (ioctl(fd, AUDIO_SETINFO, &audioinfo) == -1) { perror("ioctl: AUDIO_SETINFO"); exit (10); } if (ioctl(fd, I_FLUSH, FLUSHR) == -1) { perror("ioctl: I_FLUSH"); exit (10); } if (ioctl(fd, AUDIO_GETINFO, &audioinfo2) == -1) { perror("ioctl: AUDIO_GETINFO"); exit (10); } fprintf(stdout, "Audio device: name %s, ver %s, config %s, " "sampling rate %d/n", audiodev.name, audiodev.version, audiodev.config, audioinfo.record.sample_rate); for (;;) { i = read(fd, sp = buffer, sizeof(buffer)); if (i < 0 && errno != EAGAIN) { perror("read"); exit(4); } if (!i) break; if (i > 0) { if(integer_only) { fbuf_cnt = i/sizeof(buffer[0]); } else { for (; i >= sizeof(buffer[0]); i -= sizeof(buffer[0]), sp++) fbuf[fbuf_cnt++] = (*sp) * (1.0/32768.0); if (i) fprintf(stderr, "warning: noninteger number of samples read/n"); } if (fbuf_cnt > overlap) { process_buffer(fbuf, buffer, fbuf_cnt-overlap); memmove(fbuf, fbuf+fbuf_cnt-overlap, overlap*sizeof(fbuf[0])); fbuf_cnt = overlap; } } } close(fd);}
开发者ID:Analias,项目名称:multimon-ng,代码行数:73,
示例4: SUNAUDIO_OpenDevicestatic intSUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture){ const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); SDL_AudioFormat format = 0; audio_info_t info; /* We don't care what the devname is...we'll try to open anything. */ /* ...but default to first name in the list... */ if (devname == NULL) { devname = SDL_GetAudioDeviceName(0, iscapture); if (devname == NULL) { return SDL_SetError("No such audio device"); } } /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); /* Open the audio device */ this->hidden->audio_fd = open(devname, flags, 0); if (this->hidden->audio_fd < 0) { return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); }#ifdef AUDIO_SETINFO int enc;#endif int desired_freq = this->spec.freq; /* Determine the audio parameters from the AudioSpec */ switch (SDL_AUDIO_BITSIZE(this->spec.format)) { case 8: { /* Unsigned 8 bit audio data */ this->spec.format = AUDIO_U8;#ifdef AUDIO_SETINFO enc = AUDIO_ENCODING_LINEAR8;#endif } break; case 16: { /* Signed 16 bit audio data */ this->spec.format = AUDIO_S16SYS;#ifdef AUDIO_SETINFO enc = AUDIO_ENCODING_LINEAR;#endif } break; default: { /* !!! FIXME: fallback to conversion on unsupported types! */ return SDL_SetError("Unsupported audio format"); } } this->hidden->audio_fmt = this->spec.format; this->hidden->ulaw_only = 0; /* modern Suns do support linear audio */#ifdef AUDIO_SETINFO for (;;) { audio_info_t info; AUDIO_INITINFO(&info); /* init all fields to "no change" */ /* Try to set the requested settings */ info.play.sample_rate = this->spec.freq; info.play.channels = this->spec.channels; info.play.precision = (enc == AUDIO_ENCODING_ULAW) ? 8 : this->spec.format & 0xff; info.play.encoding = enc; if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == 0) { /* Check to be sure we got what we wanted */ if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) { return SDL_SetError("Error getting audio parameters: %s", strerror(errno)); } if (info.play.encoding == enc && info.play.precision == (this->spec.format & 0xff) && info.play.channels == this->spec.channels) { /* Yow! All seems to be well! */ this->spec.freq = info.play.sample_rate; break; } } switch (enc) { case AUDIO_ENCODING_LINEAR8: /* unsigned 8bit apparently not supported here */ enc = AUDIO_ENCODING_LINEAR; this->spec.format = AUDIO_S16SYS; break; /* try again */ case AUDIO_ENCODING_LINEAR://.........这里部分代码省略.........
开发者ID:MichalWolodkiewicz,项目名称:wizznic-android,代码行数:101,
示例5: perrorFILE *out_file_open(char *outFile, int rate, int *channels){ FILE *fout=NULL; /*Open output file*/ if (strlen(outFile)==0) {#if defined HAVE_SYS_SOUNDCARD_H int audio_fd, format, stereo; audio_fd=open("/dev/dsp", O_WRONLY); if (audio_fd<0) { perror("Cannot open /dev/dsp"); exit(1); } format=AFMT_S16_NE;// format=AFMT_S16_LE; if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format)==-1) { perror("SNDCTL_DSP_SETFMT"); close(audio_fd); exit(1); } stereo=0; if (*channels==2) stereo=1; if (ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo)==-1) { perror("SNDCTL_DSP_STEREO"); close(audio_fd); exit(1); } if (stereo!=0) { if (*channels==1) fprintf (stderr, "Cannot set mono mode, will decode in stereo/n"); *channels=2; } if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &rate)==-1) { perror("SNDCTL_DSP_SPEED"); close(audio_fd); exit(1); } fout = fdopen(audio_fd, "w"); printf ("/dev/dsp opened"); #elif defined HAVE_SYS_AUDIOIO_H audio_info_t info; int audio_fd; audio_fd = open("/dev/audio", O_WRONLY); if (audio_fd<0) { perror("Cannot open /dev/audio"); exit(1); } AUDIO_INITINFO(&info);#ifdef AUMODE_PLAY /* NetBSD/OpenBSD */ info.mode = AUMODE_PLAY;#endif info.play.encoding = AUDIO_ENCODING_SLINEAR; info.play.precision = 16; info.play.sample_rate = rate; info.play.channels = *channels; if (ioctl(audio_fd, AUDIO_SETINFO, &info) < 0) { perror ("AUDIO_SETINFO"); exit(1); } fout = fdopen(audio_fd, "w");#elif defined WIN32 || defined _WIN32 { unsigned int speex_channels = *channels; if (Set_WIN_Params (INVALID_FILEDESC, rate, SAMPLE_SIZE, speex_channels)) { fprintf (stderr, "Can't access %s/n", "WAVE OUT"); exit(1); } }#else fprintf (stderr, "No soundcard support/n"); exit(1);#endif } return fout;}
开发者ID:aircraft008,项目名称:speex_tcp,代码行数:93,
示例6: sio_sun_setparstatic intsio_sun_setpar(struct sio_hdl *sh, struct sio_par *par){#define NRETRIES 8 struct sio_sun_hdl *hdl = (struct sio_sun_hdl *)sh; struct audio_info aui; unsigned int i, infr, ibpf, onfr, obpf; unsigned int bufsz, round; unsigned int rate, req_rate, prec, enc; /* * try to set parameters until the device accepts * a common encoding and rate for play and record */ rate = par->rate; prec = par->bits; sio_sun_enctoinfo(hdl, &enc, par); for (i = 0;; i++) { if (i == NRETRIES) { DPRINTF("sio_sun_setpar: couldn't set parameters/n"); hdl->sio.eof = 1; return 0; } AUDIO_INITINFO(&aui); if (hdl->sio.mode & SIO_PLAY) { aui.play.sample_rate = rate; aui.play.precision = prec; aui.play.encoding = enc; aui.play.channels = par->pchan; } if (hdl->sio.mode & SIO_REC) { aui.record.sample_rate = rate; aui.record.precision = prec; aui.record.encoding = enc; aui.record.channels = par->rchan; } DPRINTFN(2, "sio_sun_setpar: %i: trying pars = %u/%u/%u/n", i, rate, prec, enc); if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0 && errno != EINVAL) { DPERROR("sio_sun_setpar: setinfo(pars)"); hdl->sio.eof = 1; return 0; } if (ioctl(hdl->fd, AUDIO_GETINFO, &aui) < 0) { DPERROR("sio_sun_setpar: getinfo(pars)"); hdl->sio.eof = 1; return 0; } enc = (hdl->sio.mode & SIO_REC) ? aui.record.encoding : aui.play.encoding; switch (enc) { case AUDIO_ENCODING_SLINEAR_LE: case AUDIO_ENCODING_SLINEAR_BE: case AUDIO_ENCODING_ULINEAR_LE: case AUDIO_ENCODING_ULINEAR_BE: case AUDIO_ENCODING_SLINEAR: case AUDIO_ENCODING_ULINEAR: break; default: DPRINTF("sio_sun_setpar: couldn't set linear encoding/n"); hdl->sio.eof = 1; return 0; } if (hdl->sio.mode != (SIO_REC | SIO_PLAY)) break; if (aui.play.sample_rate == aui.record.sample_rate && aui.play.precision == aui.record.precision && aui.play.encoding == aui.record.encoding) break; if (i < NRETRIES / 2) { rate = aui.play.sample_rate; prec = aui.play.precision; enc = aui.play.encoding; } else { rate = aui.record.sample_rate; prec = aui.record.precision; enc = aui.record.encoding; } } /* * If the rate that the hardware is using is different than * the requested rate, scale buffer sizes so they will be the * same time duration as what was requested. This just gets * the rates to use for scaling, that actual scaling is done * later. */ rate = (hdl->sio.mode & SIO_REC) ? aui.record.sample_rate : aui.play.sample_rate; req_rate = rate; if (par->rate && par->rate != ~0U) req_rate = par->rate; /* * if block size and buffer size are not both set then * set the blocksize to half the buffer size */ bufsz = par->appbufsz; round = par->round; if (bufsz != ~0U) {//.........这里部分代码省略.........
开发者ID:SylvestreG,项目名称:bitrig,代码行数:101,
示例7: ReportError//PORTING: This function contains a ton of OS specific stuff. Hack and// slash at will.Error SoundCardPMO::Init(OutputInfo * info){ m_properlyInitialized = false; if (!info) { info = myInfo; } else { // got info, so this is the beginning... if ((audio_fd = open("/dev/audio", O_WRONLY, 0)) < 0) { if (errno == EBUSY) { ReportError("Audio device is busy. Please make sure that " "another program is not using the device."); return (Error) pmoError_DeviceOpenFailed; } else { ReportError("Cannot open audio device. Please make sure that " "the audio device is properly configured."); return (Error) pmoError_DeviceOpenFailed; } } m_iDataSize = info->max_buffer_size; } int fd = audio_fd; struct audio_info ainfo; if (ioctl(audio_fd, AUDIO_GETINFO, &ainfo) < 0) { ReportError("Cannot get the flags on the audio device."); return (Error) pmoError_IOCTL_F_GETFL; } audio_fd = fd; channels = info->number_of_channels; for (unsigned int i = 0; i < info->number_of_channels; ++i) bufferp[i] = buffer + i; // configure the device: int play_precision = 16;// int play_stereo = channels - 1; int play_sample_rate = info->samples_per_second; if (ioctl(audio_fd, I_FLUSH, FLUSHRW) == -1) { ReportError("Cannot reset the soundcard."); return (Error) pmoError_IOCTL_SNDCTL_DSP_RESET; } AUDIO_INITINFO(&ainfo); ainfo.play.precision = play_precision; ainfo.play.channels = channels; ainfo.play.sample_rate = play_sample_rate; ainfo.play.encoding = AUDIO_ENCODING_LINEAR; if (ioctl(audio_fd, AUDIO_SETINFO, &ainfo) == -1) { ReportError("Cannot set the soundcard's sampling speed."); return (Error) pmoError_IOCTL_SNDCTL_DSP_SPEED; } myInfo->bits_per_sample = info->bits_per_sample; myInfo->number_of_channels = info->number_of_channels; myInfo->samples_per_second = info->samples_per_second; myInfo->max_buffer_size = info->max_buffer_size; m_properlyInitialized = true; // PORTING: The GETOSPACE ioctl determines how much space the kernel's // output buffer has. Your OS may not have this. m_iTotalFragments = 2048; /* An arbitrary value of 2048. */ m_iOutputBufferSize = play_precision * m_iTotalFragments; m_iBytesPerSample = info->number_of_channels * (info->bits_per_sample / 8); return kError_NoErr;}
开发者ID:mayhem,项目名称:freeamp,代码行数:85,
示例8: rplay_audio_init//.........这里部分代码省略......... rplay_audio_table = dbri_table; /* use the dbri table */ } else { report(REPORT_ERROR, "`%s' unknown audio device detected/n", d.name); return -1; } /* Verify the precision and format. */ switch (rplay_audio_precision) { case 8: if (rplay_audio_format != RPLAY_FORMAT_ULAW && rplay_audio_format != RPLAY_FORMAT_LINEAR_8) { report(REPORT_ERROR, "rplay_audio_init: can't use %d bits with format=%d/n", rplay_audio_precision, rplay_audio_format); return -1; } break; case 16: if (rplay_audio_format != RPLAY_FORMAT_LINEAR_16) { report(REPORT_ERROR, "rplay_audio_init: can't use %d bits with format=%d/n", rplay_audio_precision, rplay_audio_format); return -1; } break; default: report(REPORT_ERROR, "rplay_audio_init: `%d' unsupported audio precision/n", rplay_audio_precision); return -1; } AUDIO_INITINFO(&a); switch (rplay_audio_format) { case RPLAY_FORMAT_ULAW: a.play.encoding = AUDIO_ENCODING_ULAW; break; case RPLAY_FORMAT_LINEAR_8: case RPLAY_FORMAT_LINEAR_16: a.play.encoding = AUDIO_ENCODING_LINEAR; break; default: report(REPORT_ERROR, "rplay_audio_init: unsupported audio format `%d'/n", rplay_audio_format); return -1; } /* Audio port. */ if (rplay_audio_port == RPLAY_AUDIO_PORT_NONE) { a.play.port = ~0; /* see AUDIO_INITINFO in /usr/include/sys/audioio.h. */ } else { a.play.port = 0; if (BIT(rplay_audio_port, RPLAY_AUDIO_PORT_LINEOUT)) {#ifdef AUDIO_LINE_OUT SET_BIT(a.play.port, AUDIO_LINE_OUT);#else CLR_BIT(rplay_audio_port, RPLAY_AUDIO_PORT_LINEOUT);#endif } if (BIT(rplay_audio_port, RPLAY_AUDIO_PORT_HEADPHONE)) {#ifdef AUDIO_HEADPHONE SET_BIT(a.play.port, AUDIO_HEADPHONE);#else CLR_BIT(rplay_audio_port, RPLAY_AUDIO_PORT_HEADPHONE);#endif } if (BIT(rplay_audio_port, RPLAY_AUDIO_PORT_SPEAKER)) {#ifdef AUDIO_SPEAKER SET_BIT(a.play.port, AUDIO_SPEAKER);#endif /* Assume speaker is okay. */ } } a.play.sample_rate = rplay_audio_sample_rate; a.play.precision = rplay_audio_precision; a.play.channels = rplay_audio_channels; if (ioctl(rplay_audio_fd, AUDIO_SETINFO, &a) < 0) { report(REPORT_ERROR, "rplay_audio_init: AUDIO_SETINFO: %s/n", sys_err_str(errno)); return -1; } return 0;}
开发者ID:boyns,项目名称:rplay,代码行数:101,
示例9: DSP_OpenAudiointDSP_OpenAudio(_THIS, SDL_AudioSpec * spec){ char audiodev[1024];#ifdef AUDIO_SETINFO int enc;#endif int desired_freq = spec->freq; /* Initialize our freeable variables, in case we fail */ audio_fd = -1; mixbuf = NULL; ulaw_buf = NULL; /* Determine the audio parameters from the AudioSpec */ switch (SDL_AUDIO_BITSIZE(spec->format)) { case 8: { /* Unsigned 8 bit audio data */ spec->format = AUDIO_U8;#ifdef AUDIO_SETINFO enc = AUDIO_ENCODING_LINEAR8;#endif } break; case 16: { /* Signed 16 bit audio data */ spec->format = AUDIO_S16SYS;#ifdef AUDIO_SETINFO enc = AUDIO_ENCODING_LINEAR;#endif } break; default: { /* !!! FIXME: fallback to conversion on unsupported types! */ SDL_SetError("Unsupported audio format"); return (-1); } } audio_fmt = spec->format; /* Open the audio device */ audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 1); if (audio_fd < 0) { SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); return (-1); } ulaw_only = 0; /* modern Suns do support linear audio */#ifdef AUDIO_SETINFO for (;;) { audio_info_t info; AUDIO_INITINFO(&info); /* init all fields to "no change" */ /* Try to set the requested settings */ info.play.sample_rate = spec->freq; info.play.channels = spec->channels; info.play.precision = (enc == AUDIO_ENCODING_ULAW) ? 8 : spec->format & 0xff; info.play.encoding = enc; if (ioctl(audio_fd, AUDIO_SETINFO, &info) == 0) { /* Check to be sure we got what we wanted */ if (ioctl(audio_fd, AUDIO_GETINFO, &info) < 0) { SDL_SetError("Error getting audio parameters: %s", strerror(errno)); return -1; } if (info.play.encoding == enc && info.play.precision == (spec->format & 0xff) && info.play.channels == spec->channels) { /* Yow! All seems to be well! */ spec->freq = info.play.sample_rate; break; } } switch (enc) { case AUDIO_ENCODING_LINEAR8: /* unsigned 8bit apparently not supported here */ enc = AUDIO_ENCODING_LINEAR; spec->format = AUDIO_S16SYS; break; /* try again */ case AUDIO_ENCODING_LINEAR: /* linear 16bit didn't work either, resort to C++ AUTHDEBUG函数代码示例 C++ AUDDBG函数代码示例
|