VirtualBox

Changeset 356 in vbox for trunk


Ignore:
Timestamp:
Jan 26, 2007 2:15:26 PM (18 years ago)
Author:
vboxsync
Message:

some more detailed LogRel about the reason why opening an OSS audio device failed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/ossaudio.c

    r1 r356  
    9999}
    100100
     101#ifndef VBOX
    101102static void GCC_FMT_ATTR (3, 4) oss_logerr2 (
    102103    int err,
     
    116117    AUD_log (AUDIO_CAP, "Reason: %s\n", strerror (err));
    117118}
     119#endif
    118120
    119121static void oss_anal_close (int *fdp)
     
    222224    fd = open (dspname, (in ? O_RDONLY : O_WRONLY) | O_NONBLOCK);
    223225    if (-1 == fd) {
     226#ifndef VBOX
    224227        oss_logerr2 (errno, typ, "Failed to open `%s'\n", dspname);
    225         LogRel(("Audio/OSS: Failed to open '%s' as %s\n", dspname, typ));
     228#else
     229        LogRel(("Audio/OSS: Failed to open %s for %s (%s)\n",
     230                 dspname, typ, strerror(errno)));
     231#endif
    226232        return -1;
    227233    }
     234
     235#ifdef VBOX
     236    LogRel(("Audio/OSS: Successfully opened %s for %s\n", dspname, typ));
     237#endif
    228238
    229239    freq = req->freq;
     
    232242
    233243    if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &fmt)) {
     244#ifndef VBOX
    234245        oss_logerr2 (errno, typ, "Failed to set sample size %d\n", req->fmt);
     246#else
     247        LogRel(("Audio/OSS: Failed to set sample size %d (%s)\n",
     248                 req->fmt, strerror(errno)));
     249#endif
    235250        goto err;
    236251    }
    237252
    238253    if (ioctl (fd, SNDCTL_DSP_CHANNELS, &nchannels)) {
     254#ifndef VBOX
    239255        oss_logerr2 (errno, typ, "Failed to set number of channels %d\n",
    240256                     req->nchannels);
     257#else
     258        LogRel(("Audio/OSS: Failed to set nchannels=%d (%s)\n",
     259                 req->nchannels, strerror(errno)));
     260#endif
    241261        goto err;
    242262    }
    243263
    244264    if (ioctl (fd, SNDCTL_DSP_SPEED, &freq)) {
     265#ifndef VBOX
    245266        oss_logerr2 (errno, typ, "Failed to set frequency %d\n", req->freq);
     267#else
     268        LogRel(("Audio/OSS: Failed to set freq=%dHZ\n", req->freq, strerror(errno)));
     269#endif
    246270        goto err;
    247271    }
    248272
    249273    if (ioctl (fd, SNDCTL_DSP_NONBLOCK)) {
     274#ifndef VBOX
    250275        oss_logerr2 (errno, typ, "Failed to set non-blocking mode\n");
     276#else
     277        LogRel(("Audio/OSS: Failed to set non-blocking mode (%s)\n", strerror(errno)));
     278#endif
    251279        goto err;
    252280    }
     
    254282    mmmmssss = (req->nfrags << 16) | lsbindex (req->fragsize);
    255283    if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) {
     284#ifndef VBOX
    256285        oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)\n",
    257286                     req->nfrags, req->fragsize);
     287#else
     288        LogRel(("Audio/OSS: Failed to set buffer_length=%d,%d (%s)\n",
     289                req->nfrags, req->fragsize, strerror(errno)));
     290#endif
    258291        goto err;
    259292    }
    260293
    261294    if (ioctl (fd, in ? SNDCTL_DSP_GETISPACE : SNDCTL_DSP_GETOSPACE, &abinfo)) {
     295#ifndef VBOX
    262296        oss_logerr2 (errno, typ, "Failed to get buffer length\n");
     297#else
     298        LogRel(("Audio/OSS: Failed to get buffer length (%s)\n", strerror(errno)));
     299#endif
    263300        goto err;
    264301    }
     
    289326 err:
    290327    oss_anal_close (&fd);
     328#ifdef VBOX
     329    LogRel(("Audio/OSS: Closed %s for %s\n",
     330            in ? conf.devpath_in : conf.devpath_out, in ? "ADC" : "DAC"));
     331#endif
    291332    return -1;
    292333}
     
    440481    ldebug ("oss_fini\n");
    441482    oss_anal_close (&oss->fd);
     483#ifdef VBOX
     484    LogRel(("Audio/OSS: Closed %s for DAC\n", conf.devpath_out));
     485#endif
    442486
    443487    if (oss->pcm_buf) {
     
    485529    if (err) {
    486530        oss_anal_close (&fd);
     531#ifdef VBOX
     532    LogRel(("Audio/OSS: Closed %s for DAC\n", conf.devpath_out));
     533#endif
    487534        return -1;
    488535    }
     
    563610                );
    564611            oss_anal_close (&fd);
     612#ifdef VBOX
     613    LogRel(("Audio/OSS: Closed %s for DAC\n", conf.devpath_out));
     614#endif
    565615            return -1;
    566616        }
     
    636686    if (err) {
    637687        oss_anal_close (&fd);
     688#ifdef VBOX
     689    LogRel(("Audio/OSS: Closed %s for ADC\n", conf.devpath_in));
     690#endif
    638691        return -1;
    639692    }
     
    659712               hw->samples, 1 << hw->info.shift);
    660713        oss_anal_close (&fd);
     714#ifdef VBOX
     715    LogRel(("Audio/OSS: Closed %s for ADC\n", conf.devpath_in));
     716#endif
    661717        return -1;
    662718    }
     
    671727
    672728    oss_anal_close (&oss->fd);
     729#ifdef VBOX
     730    LogRel(("Audio/OSS: Closed %s for ADC\n", conf.devpath_in));
     731#endif
    673732
    674733    if (oss->pcm_buf) {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette