Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4869cfc authored by Steve Kondik's avatar Steve Kondik
Browse files

Revert "Revert "audio: Omit FM code when HAVE_FM_RADIO is not set""

Cleaned it up, and fixed a misplaced ifdef that broke the whole damn
thing.

This reverts commit 568f674b8ef1a83b7ba948b0e53e0dd86207d115.

Change-Id: I99fde73b2cf283dde7e9bcb1e73cf86e553324d3
parent d5b54a81
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -45,7 +45,9 @@ public:
        ENFORCED_AUDIBLE = 7, // Sounds that cannot be muted by user and must be routed to speaker
        DTMF             = 8,
        TTS              = 9,
#ifdef HAVE_FM_RADIO
        FM              = 10,
#endif
        NUM_STREAM_TYPES
    };

@@ -222,7 +224,9 @@ public:
        size_t* buffSize);

    static status_t setVoiceVolume(float volume);
#ifdef HAVE_FM_RADIO
    static status_t setFmVolume(float volume);
#endif

    // return the number of audio frames written by AudioFlinger to audio HAL and
    // audio dsp to DAC since the output on which the specificed stream is playing
@@ -253,10 +257,16 @@ public:
        DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100,
        DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200,
        DEVICE_OUT_AUX_DIGITAL = 0x400,
#ifdef HAVE_FM_RADIO
        DEVICE_OUT_FM = 0x800,
#endif
        DEVICE_OUT_DEFAULT = 0x8000,
        DEVICE_OUT_ALL = (DEVICE_OUT_EARPIECE | DEVICE_OUT_SPEAKER | DEVICE_OUT_WIRED_HEADSET |
#ifdef HAV_FM_RADIO
                DEVICE_OUT_WIRED_HEADPHONE | DEVICE_OUT_FM | DEVICE_OUT_BLUETOOTH_SCO | DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
#else
                DEVICE_OUT_WIRED_HEADPHONE | DEVICE_OUT_BLUETOOTH_SCO | DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
#endif
                DEVICE_OUT_BLUETOOTH_SCO_CARKIT | DEVICE_OUT_BLUETOOTH_A2DP | DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
                DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER | DEVICE_OUT_AUX_DIGITAL | DEVICE_OUT_DEFAULT),
        DEVICE_OUT_ALL_A2DP = (DEVICE_OUT_BLUETOOTH_A2DP | DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
@@ -271,13 +281,20 @@ public:
        DEVICE_IN_AUX_DIGITAL = 0x200000,
        DEVICE_IN_VOICE_CALL = 0x400000,
        DEVICE_IN_BACK_MIC = 0x800000,
#ifdef HAVE_FM_RADIO
        DEVICE_IN_FM_RX = 0x1000000,
        DEVICE_IN_FM_RX_A2DP = 0x2000000,
#endif
        DEVICE_IN_DEFAULT = 0x80000000,

        DEVICE_IN_ALL = (DEVICE_IN_COMMUNICATION | DEVICE_IN_AMBIENT | DEVICE_IN_BUILTIN_MIC |
                DEVICE_IN_BLUETOOTH_SCO_HEADSET | DEVICE_IN_WIRED_HEADSET | DEVICE_IN_AUX_DIGITAL |
#ifdef HAVE_FM_RADIO
                DEVICE_IN_VOICE_CALL | DEVICE_IN_BACK_MIC | DEVICE_IN_FM_RX | DEVICE_IN_FM_RX_A2DP | DEVICE_IN_DEFAULT)
#else
                DEVICE_IN_VOICE_CALL | DEVICE_IN_BACK_MIC | DEVICE_IN_DEFAULT)
#endif

    };

    // device connection states used for setDeviceConnectionState()
@@ -381,7 +398,9 @@ public:
    static bool isOutputDevice(audio_devices device);
    static bool isInputDevice(audio_devices device);
    static bool isA2dpDevice(audio_devices device);
#ifdef HAVE_FM_RADIO
    static bool isFmDevice(audio_devices device);
#endif
    static bool isBluetoothScoDevice(audio_devices device);
    static bool isLowVisibility(stream_type stream);
    static bool isOutputChannel(uint32_t channel);
@@ -460,8 +479,10 @@ public:
    static const char *keyFormat;
    static const char *keyChannels;
    static const char *keyFrameCount;
#ifdef HAVE_FM_RADIO
    static const char *keyFmOn;
    static const char *keyFmOff;
#endif

    String8 toString();

+2 −1
Original line number Diff line number Diff line
@@ -134,8 +134,9 @@ public:
    virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output) = 0;

    virtual unsigned int  getInputFramesLost(int ioHandle) = 0;
 
#ifdef HAVE_FM_RADIO
    virtual status_t setFmVolume(float volume) = 0;
#endif
};


+4 −1
Original line number Diff line number Diff line
@@ -44,10 +44,13 @@ enum audio_source {
    AUDIO_SOURCE_VOICE_CALL = 4,
    AUDIO_SOURCE_CAMCORDER = 5,
    AUDIO_SOURCE_VOICE_RECOGNITION = 6,
#ifdef HAVE_FM_RADIO
    AUDIO_SOURCE_FM_RX = 7,
    AUDIO_SOURCE_FM_RX_A2DP = 8,
    AUDIO_SOURCE_MAX = AUDIO_SOURCE_FM_RX_A2DP,

#else
    AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_RECOGNITION,
#endif
    AUDIO_SOURCE_LIST_END  // must be last - used to validate audio source type
};

+2 −0
Original line number Diff line number Diff line
@@ -205,10 +205,12 @@ status_t A2dpAudioInterface::setVoiceVolume(float v)
    return mHardwareInterface->setVoiceVolume(v);
}

#ifdef HAVE_FM_RADIO
status_t A2dpAudioInterface::setFmVolume(float v)
{
    return mHardwareInterface->setFmVolume(v);
}
#endif

status_t A2dpAudioInterface::setMasterVolume(float v)
{
+3 −1
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ public:
    virtual status_t    initCheck();

    virtual status_t    setVoiceVolume(float volume);
    virtual status_t    setFmVolume(float volume);
    virtual status_t    setMasterVolume(float volume);

    virtual status_t    setMode(int mode);
@@ -68,6 +67,9 @@ public:
                                status_t *status,
                                AudioSystem::audio_in_acoustics acoustics);
    virtual    void        closeInputStream(AudioStreamIn* in);
#ifdef HAVE_FM_RADIO
    virtual status_t    setFmVolume(float volume);
#endif
//    static AudioHardwareInterface* createA2dpInterface();

protected:
Loading