From 06192d9c879cf70171139597b8f722a41fb88a37 Mon Sep 17 00:00:00 2001 From: blmpl Date: Sat, 15 Oct 2016 10:10:52 +0200 Subject: Support binding to a specific network interface Closes #597. # Conflicts: # src/ui.c --- src/settings.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/settings.h') diff --git a/src/settings.h b/src/settings.h index 78d0e45..e6067f3 100644 --- a/src/settings.h +++ b/src/settings.h @@ -93,6 +93,7 @@ typedef struct { char *password, *passwordCmd; char *controlProxy; /* non-american listeners need this */ char *proxy; + char *bindTo; char *autostartStation; char *eventCmd; char *loveIcon; -- cgit v1.2.3 From c934c373e16acc7b7db6a374b1047649a0875dc3 Mon Sep 17 00:00:00 2001 From: Sean Greenslade Date: Tue, 14 Mar 2017 19:36:24 -0700 Subject: Added gain_mul setting to soften effect of replaygain. --- contrib/pianobar.1 | 6 ++++++ src/main.c | 3 ++- src/settings.c | 3 +++ src/settings.h | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/settings.h') diff --git a/contrib/pianobar.1 b/contrib/pianobar.1 index 910af9a..0619735 100644 --- a/contrib/pianobar.1 +++ b/contrib/pianobar.1 @@ -366,6 +366,12 @@ Your pandora.com username. .B volume = 0 Initial volume correction in dB. Usually between -30 and +5. +.TP +.B gain_mul = 1.0 +Pandora sends a ReplayGain value with every song. This sets a multiplier so that the gain adjustment can be +reduced. 0.0 means no gain adjustment, 1.0 means full gain adjustment, values inbetween reduce the magnitude +of gain adjustment. + .SH REMOTE CONTROL .B pianobar can be controlled through a fifo. You have to create it yourself by executing diff --git a/src/main.c b/src/main.c index 3e6e85f..4f4214a 100644 --- a/src/main.c +++ b/src/main.c @@ -31,6 +31,7 @@ THE SOFTWARE. #include "ui.h" #include "ui_dispatch.h" #include "ui_readline.h" +#include "settings.h" /* authenticate user */ @@ -238,7 +239,7 @@ static void BarMainStartPlayback(BarApp_t *app) } else { - BarPlayer2SetGain(app->player, curSong->fileGain); + BarPlayer2SetGain(app->player, curSong->fileGain * app->settings.gainMul); BarPlayer2Open(app->player, curSong->audioUrl); /* throw event */ diff --git a/src/settings.c b/src/settings.c index b15053d..4f0ef8c 100644 --- a/src/settings.c +++ b/src/settings.c @@ -172,6 +172,7 @@ void BarSettingsRead (BarSettings_t *settings) { settings->autoselect = true; settings->history = 5; settings->volume = 0; + settings->gainMul = 1.0; settings->maxPlayerErrors = 5; settings->sortOrder = BAR_SORT_NAME_AZ; settings->loveIcon = strdup (" <3"); @@ -378,6 +379,8 @@ void BarSettingsRead (BarSettings_t *settings) { settings->atIcon = strdup (val); } else if (streq ("volume", key)) { settings->volume = atoi (val); + } else if (streq ("gain_mul", key)) { + settings->gainMul = (float)atof (val); } else if (streq ("format_nowplaying_song", key)) { free (settings->npSongFormat); settings->npSongFormat = strdup (val); diff --git a/src/settings.h b/src/settings.h index e6067f3..f8225ce 100644 --- a/src/settings.h +++ b/src/settings.h @@ -87,6 +87,7 @@ typedef struct { bool autoselect; unsigned int history, maxPlayerErrors; int volume; + float gainMul; BarStationSorting_t sortOrder; PianoAudioQuality_t audioQuality; char *username; -- cgit v1.2.3 From 21b167532b07f631b107968837dcfdf93025239b Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 25 Mar 2017 12:30:33 +0100 Subject: Switch to #pragma once # Conflicts: # src/http/http.h # src/player.h --- src/config.h | 4 +--- src/console.h | 4 +--- src/http/http.h | 5 +---- src/libpiano/crypt.h | 4 +--- src/libpiano/piano.h | 4 +--- src/libpiano/piano_private.h | 4 +--- src/main.h | 5 +---- src/player/backends/media_foundation.h | 7 +------ src/player/backends/utility/com_ptr.h | 4 ---- src/player/backends/utility/optional.h | 5 ----- src/player/player2.h | 4 ---- src/player/player2_private.h | 3 --- src/settings.h | 6 +++--- src/ui.h | 4 +--- src/ui_act.h | 4 +--- src/ui_dispatch.h | 5 +---- src/ui_readline.h | 5 +---- src/ui_types.h | 4 +--- 18 files changed, 16 insertions(+), 65 deletions(-) (limited to 'src/settings.h') diff --git a/src/config.h b/src/config.h index c408542..8679001 100644 --- a/src/config.h +++ b/src/config.h @@ -1,5 +1,4 @@ -#ifndef SRC_CONFIG_H_S6A1C09K -#define SRC_CONFIG_H_S6A1C09K +# pragma once /* package name */ #define PACKAGE "pianobar" @@ -25,4 +24,3 @@ #define CURL_STATICLIB -#endif /* SRC_CONFIG_H_S6A1C09K */ diff --git a/src/console.h b/src/console.h index de5d951..627e77b 100644 --- a/src/console.h +++ b/src/console.h @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_CONSOLE_H_WY8F3MNH -#define SRC_CONSOLE_H_WY8F3MNH +# pragma once #include "config.h" #include @@ -49,4 +48,3 @@ void BarConsolePuts(const char* c); void BarConsolePrint(const char* format, ...); void BarConsolePrintV(const char* format, va_list args); -#endif /* SRC_CONSOLE_H_WY8F3MNH */ diff --git a/src/http/http.h b/src/http/http.h index a321cd3..5ea617f 100644 --- a/src/http/http.h +++ b/src/http/http.h @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_HTTP_H_CN979RE9 -#define SRC_HTTP_H_CN979RE9 +#pragma once #include "config.h" @@ -42,5 +41,3 @@ bool HttpSetProxy(http_t, const char*); bool HttpRequest (http_t, PianoRequest_t * const); const char* HttpGetError (http_t); -#endif /* SRC_HTTP_H_CN979RE9 */ - diff --git a/src/libpiano/crypt.h b/src/libpiano/crypt.h index 890b8c1..30d2294 100644 --- a/src/libpiano/crypt.h +++ b/src/libpiano/crypt.h @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_LIBPIANO_CRYPT_H_O832IVGK -#define SRC_LIBPIANO_CRYPT_H_O832IVGK +#pragma once #include "piano.h" @@ -34,4 +33,3 @@ char *PianoDecryptString (PianoCipher_t, const char * const, size_t * const); char *PianoEncryptString (PianoCipher_t, const char *); -#endif /* SRC_LIBPIANO_CRYPT_H_O832IVGK */ diff --git a/src/libpiano/piano.h b/src/libpiano/piano.h index ca33626..2dbf607 100644 --- a/src/libpiano/piano.h +++ b/src/libpiano/piano.h @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_LIBPIANO_PIANO_H_MFBT13PN -#define SRC_LIBPIANO_PIANO_H_MFBT13PN +#pragma once #include "../config.h" @@ -366,4 +365,3 @@ PianoStation_t *PianoFindStationById (PianoStation_t * const, const char * const); const char *PianoErrorToStr (PianoReturn_t); -#endif /* SRC_LIBPIANO_PIANO_H_MFBT13PN */ diff --git a/src/libpiano/piano_private.h b/src/libpiano/piano_private.h index bc0cc0e..ffc14c8 100644 --- a/src/libpiano/piano_private.h +++ b/src/libpiano/piano_private.h @@ -21,12 +21,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_LIBPIANO_PIANO_PRIVATE_H_C35CDGGL -#define SRC_LIBPIANO_PIANO_PRIVATE_H_C35CDGGL +#pragma once #include "piano.h" void PianoDestroyStation (PianoStation_t *station); void PianoDestroyUserInfo (PianoUserInfo_t *user); -#endif /* SRC_LIBPIANO_PIANO_PRIVATE_H_C35CDGGL */ diff --git a/src/main.h b/src/main.h index e5e988d..192ffdb 100644 --- a/src/main.h +++ b/src/main.h @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_MAIN_H_4ZGSCG6X -#define SRC_MAIN_H_4ZGSCG6X +# pragma once //#include @@ -50,5 +49,3 @@ typedef struct { unsigned int playerErrors; } BarApp_t; -#endif /* SRC_MAIN_H_4ZGSCG6X */ - diff --git a/src/player/backends/media_foundation.h b/src/player/backends/media_foundation.h index cf10122..6ad4966 100644 --- a/src/player/backends/media_foundation.h +++ b/src/player/backends/media_foundation.h @@ -1,5 +1,3 @@ -# ifndef __TD__BASIC_MEDIA_PLAYER_H__ -# define __TD__BASIC_MEDIA_PLAYER_H__ # pragma once # include @@ -98,7 +96,7 @@ private: com_ptr m_SimpleAudioVolume; com_ptr m_PresentationClock; com_ptr m_StreamAudioVolume; - + optional m_SetMasterVolume; mutable float m_MasterVolume; mutable float m_ReplayGain; @@ -110,6 +108,3 @@ private: State m_State; HANDLE m_CloseEvent; }; - - -# endif // __TD__BASIC_MEDIA_PLAYER_H__ \ No newline at end of file diff --git a/src/player/backends/utility/com_ptr.h b/src/player/backends/utility/com_ptr.h index 23534b2..519caef 100644 --- a/src/player/backends/utility/com_ptr.h +++ b/src/player/backends/utility/com_ptr.h @@ -1,5 +1,3 @@ -# ifndef __TD__COM_PTR_H__ -# define __TD__COM_PTR_H__ # pragma once template @@ -144,5 +142,3 @@ template inline bool operator<=(const com_ptr& a, const com_ptr< template inline bool operator>(const com_ptr& a, const com_ptr& b) { return std::greater()(a.get(), b.get()); } template inline bool operator>=(const com_ptr& a, const com_ptr& b) { return std::greater_equal()(a.get(), b.get()); } template void swap(com_ptr & lhs, com_ptr & rhs) { lhs.swap(rhs); } - -# endif // __TD__COM_PTR_H__ \ No newline at end of file diff --git a/src/player/backends/utility/optional.h b/src/player/backends/utility/optional.h index 9ee0b71..dcdc59a 100644 --- a/src/player/backends/utility/optional.h +++ b/src/player/backends/utility/optional.h @@ -1,8 +1,6 @@ //------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ -# ifndef __TD__OPTIONAL_H__ -# define __TD__OPTIONAL_H__ # pragma once # include @@ -512,6 +510,3 @@ inline bool operator>=(const T& v, const optional& opt) using namespace std; return static_cast(opt) ? greater_equal(v, *opt) : true; } - - -# endif // __TD__OPTIONAL_H__ diff --git a/src/player/player2.h b/src/player/player2.h index 710b35d..3ac29c2 100644 --- a/src/player/player2.h +++ b/src/player/player2.h @@ -21,8 +21,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef __PIANOBAR_PLAYER2_H__ -#define __PIANOBAR_PLAYER2_H__ #pragma once #include "config.h" @@ -49,5 +47,3 @@ bool BarPlayer2IsPaused(player2_t player); bool BarPlayer2IsStopped(player2_t player); bool BarPlayer2IsFinished(player2_t player); -#endif /* __PIANOBAR_PLAYER2_H__ */ - diff --git a/src/player/player2_private.h b/src/player/player2_private.h index 757a07e..b76eb8b 100644 --- a/src/player/player2_private.h +++ b/src/player/player2_private.h @@ -1,5 +1,3 @@ -#ifndef __PIANOBAR_PLAYER2_PRIVATE_H__ -#define __PIANOBAR_PLAYER2_PRIVATE_H__ #pragma once #include "config.h" @@ -32,4 +30,3 @@ typedef struct _player2_iface extern player2_iface player2_direct_show; extern player2_iface player2_windows_media_foundation; -#endif /* __PIANOBAR_PLAYER2_PRIVATE_H__ */ diff --git a/src/settings.h b/src/settings.h index f8225ce..0edb544 100644 --- a/src/settings.h +++ b/src/settings.h @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_SETTINGS_H_IPL0ON9L -#define SRC_SETTINGS_H_IPL0ON9L +#pragma once #include @@ -83,6 +82,8 @@ typedef struct { char *postfix; } BarMsgFormatStr_t; +#include "ui_types.h" + typedef struct { bool autoselect; unsigned int history, maxPlayerErrors; @@ -116,4 +117,3 @@ void BarSettingsDestroy (BarSettings_t *); void BarSettingsRead (BarSettings_t *); void BarSettingsWrite (PianoStation_t *, BarSettings_t *); -#endif /* SRC_SETTINGS_H_IPL0ON9L */ diff --git a/src/ui.h b/src/ui.h index 705bbab..126f6bb 100644 --- a/src/ui.h +++ b/src/ui.h @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_UI_H_46P20TS0 -#define SRC_UI_H_46P20TS0 +#pragma once #include @@ -54,4 +53,3 @@ int BarUiPianoCall (BarApp_t * const, PianoRequestType_t, void *, PianoReturn_t *); void BarUiHistoryPrepend (BarApp_t *app, PianoSong_t *song); -#endif /* SRC_UI_H_46P20TS0 */ diff --git a/src/ui_act.h b/src/ui_act.h index 676fbb4..fb4457b 100644 --- a/src/ui_act.h +++ b/src/ui_act.h @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_UI_ACT_H_1FEFTC06 -#define SRC_UI_ACT_H_1FEFTC06 +#pragma once #include @@ -63,4 +62,3 @@ BarUiActCallback(BarUiActManageStation); BarUiActCallback(BarUiActVolReset); BarUiActCallback(BarUiActSettings); -#endif /* SRC_UI_ACT_H_1FEFTC06 */ diff --git a/src/ui_dispatch.h b/src/ui_dispatch.h index 24b68bb..7e34393 100644 --- a/src/ui_dispatch.h +++ b/src/ui_dispatch.h @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_UI_DISPATCH_H_PV2JON1Z -#define SRC_UI_DISPATCH_H_PV2JON1Z +#pragma once /* bit-mask */ typedef enum { @@ -114,5 +113,3 @@ static const BarUiDispatchAction_t dispatchActions[BAR_KS_COUNT] = { BarKeyShortcutId_t BarUiDispatch (BarApp_t *, const char, PianoStation_t *, PianoSong_t *, const bool, BarUiDispatchContext_t); -#endif /* SRC_UI_DISPATCH_H_PV2JON1Z */ - diff --git a/src/ui_readline.h b/src/ui_readline.h index 9343e1a..83214b9 100644 --- a/src/ui_readline.h +++ b/src/ui_readline.h @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_UI_READLINE_H_IFRX74VM -#define SRC_UI_READLINE_H_IFRX74VM +#pragma once #include "config.h" @@ -46,5 +45,3 @@ size_t BarReadlineStr (char *, const size_t, size_t BarReadlineInt (int *, BarReadline_t); bool BarReadlineYesNo (bool, BarReadline_t); -#endif /* SRC_UI_READLINE_H_IFRX74VM */ - diff --git a/src/ui_types.h b/src/ui_types.h index aab4199..ecd32d4 100644 --- a/src/ui_types.h +++ b/src/ui_types.h @@ -21,8 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SRC_UI_TYPES_H_2HR75RII -#define SRC_UI_TYPES_H_2HR75RII +# pragma once typedef enum { MSG_NONE = 0, @@ -36,4 +35,3 @@ typedef enum { MSG_COUNT = 8, /* invalid type */ } BarUiMsg_t; -#endif /* SRC_UI_TYPES_H_2HR75RII */ -- cgit v1.2.3