Пример #1
0
bool
PNetAudioDevice::initHardware (IOService *provider)
{
  if (!super::initHardware(provider)) {
    IOLog("IOAudioDevice::initHardware(%p) failed\n", provider);
    return false;
  }
  setDeviceName("Portable Network Audio Device");
  setDeviceShortName("PNetAudio");
  setManufacturerName("LowH.net");
  return createAudioEngine();
}
Пример #2
0
bool AppleIntelAC97AudioDriver::initHardware( IOService * provider )
{
    DebugLog("%s::%s(%p)\n", getName(), __FUNCTION__, provider);

    if ( super::initHardware(provider) == false )
    {
        IOLog("super::initHardware\n");
        goto fail;
    }

    setManufacturerName( "Intel" );
    setDeviceName( "AC97 Audio Controller" );

    // Keep a reference to our provider. Must be an audio codec.

    _audioCodec = OSDynamicCast( AppleIntelAC97Codec, provider );
    if ( _audioCodec == 0 )
    {
        goto fail;
    }

    // Open codec for exclusive access.

    if ( _audioCodec->open( this ) == false )
    {
        DebugLog("%s: codec open error\n", getName());
        goto fail;
    }

    // Create audio engine.

    if ( createAudioEngine() == false )
    {
        DebugLog("%s: createAudioEngine() error\n", getName());
        goto fail;
    }

    // Create audio ports, and attach them to audio engine.

    if ( createAudioPorts() == false )
    {
        DebugLog("%s: createAudioPorts() error\n", getName());
        goto fail;
    }

    // Activate audio engine.

    if ( activateAudioEngine( _audioEngine ) != kIOReturnSuccess )
    {
        DebugLog("%s: activateAudioEngine() error\n", getName());
        goto fail;
    }

    // Flush default audio control settings.

    flushAudioControls();

    return true;

fail:
    if ( _audioCodec )
    {
        _audioCodec->close( this );
        _audioCodec = 0;
    }

    return false;
}