Move sound output driver selection into new preferences tab.
authorCarl Hetherington <cth@carlh.net>
Tue, 17 Dec 2019 21:51:23 +0000 (22:51 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 19 Dec 2019 20:32:16 +0000 (21:32 +0100)
31 files changed:
graphics/linux/128/dcpomatic2.png
graphics/linux/16/dcpomatic2.png
graphics/linux/22/dcpomatic2.png
graphics/linux/256/dcpomatic2.png
graphics/linux/32/dcpomatic2.png
graphics/linux/48/dcpomatic2.png
graphics/linux/512/dcpomatic2.png
graphics/linux/64/dcpomatic2.png
graphics/osx/dcpomatic2.iconset/icon_128x128.png
graphics/osx/dcpomatic2.iconset/icon_128x128@2x.png
graphics/osx/dcpomatic2.iconset/icon_16x16.png
graphics/osx/dcpomatic2.iconset/icon_16x16@2x.png
graphics/osx/dcpomatic2.iconset/icon_256x256.png
graphics/osx/dcpomatic2.iconset/icon_256x256@2x.png
graphics/osx/dcpomatic2.iconset/icon_32x32.png
graphics/osx/dcpomatic2.iconset/icon_32x32@2x.png
graphics/osx/dcpomatic2.iconset/icon_512x512.png
graphics/osx/dcpomatic2.iconset/icon_512x512@2x.png
graphics/osx/preferences/sound.png [new file with mode: 0644]
graphics/src/sound.svg [new file with mode: 0644]
graphics/update
graphics/web/favicon-128x128.png
graphics/web/favicon-16x16.png
graphics/web/favicon-256x256.png
graphics/web/favicon-32x32.png
graphics/web/favicon-64x64.png
graphics/web/logo.png
src/wx/config_dialog.cc
src/wx/config_dialog.h
src/wx/full_config_dialog.cc
src/wx/player_config_dialog.cc

index ef8484970efd470621975455f1e0777d5bfe2e8d..6b12c5e602f397b3341dda0376318bfec7525068 100644 (file)
Binary files a/graphics/linux/128/dcpomatic2.png and b/graphics/linux/128/dcpomatic2.png differ
index 2d177e7e3eea296b97468d6f038710ad6059e0d6..d6ba7590ab7c26abcaeb74527a754e434a44a7c1 100644 (file)
Binary files a/graphics/linux/16/dcpomatic2.png and b/graphics/linux/16/dcpomatic2.png differ
index 0f29bbffb3da99fe90ac4c408d44511f4ba14f37..116a7827df6621fd3e1a17039686036ccfdad9db 100644 (file)
Binary files a/graphics/linux/22/dcpomatic2.png and b/graphics/linux/22/dcpomatic2.png differ
index c39b1fe3bf753e66237dea15910c5f45c649ebe1..cd0640f12b6ffc08752df639c5337b04c54c3fe7 100644 (file)
Binary files a/graphics/linux/256/dcpomatic2.png and b/graphics/linux/256/dcpomatic2.png differ
index 7fb1a414062e14d1f93638bbb868f5e16c9ebed6..ee170e4691442dd22d0fa0d4851ab2462d2e143d 100644 (file)
Binary files a/graphics/linux/32/dcpomatic2.png and b/graphics/linux/32/dcpomatic2.png differ
index 5e8aba8e706c9e15caf5b1e24d122c163f9e5dbe..8aec7be36a03874b84277fa6a36c213b3b18dc87 100644 (file)
Binary files a/graphics/linux/48/dcpomatic2.png and b/graphics/linux/48/dcpomatic2.png differ
index cab55bbe5a7dc13035ab9557ed5f6896cec84aaa..f591f1c7e5c3005ebdb3494d7b75ad9e5f382426 100644 (file)
Binary files a/graphics/linux/512/dcpomatic2.png and b/graphics/linux/512/dcpomatic2.png differ
index 40fe43090bb1aed65a3b5232287734825db924f5..685bd9bb9f0c90aa175572e874bc39c1edf988c9 100644 (file)
Binary files a/graphics/linux/64/dcpomatic2.png and b/graphics/linux/64/dcpomatic2.png differ
index ef8484970efd470621975455f1e0777d5bfe2e8d..6b12c5e602f397b3341dda0376318bfec7525068 100644 (file)
Binary files a/graphics/osx/dcpomatic2.iconset/icon_128x128.png and b/graphics/osx/dcpomatic2.iconset/icon_128x128.png differ
index ef8484970efd470621975455f1e0777d5bfe2e8d..6b12c5e602f397b3341dda0376318bfec7525068 100644 (file)
Binary files a/graphics/osx/dcpomatic2.iconset/icon_128x128@2x.png and b/graphics/osx/dcpomatic2.iconset/icon_128x128@2x.png differ
index 2d177e7e3eea296b97468d6f038710ad6059e0d6..d6ba7590ab7c26abcaeb74527a754e434a44a7c1 100644 (file)
Binary files a/graphics/osx/dcpomatic2.iconset/icon_16x16.png and b/graphics/osx/dcpomatic2.iconset/icon_16x16.png differ
index 2d177e7e3eea296b97468d6f038710ad6059e0d6..d6ba7590ab7c26abcaeb74527a754e434a44a7c1 100644 (file)
Binary files a/graphics/osx/dcpomatic2.iconset/icon_16x16@2x.png and b/graphics/osx/dcpomatic2.iconset/icon_16x16@2x.png differ
index c39b1fe3bf753e66237dea15910c5f45c649ebe1..cd0640f12b6ffc08752df639c5337b04c54c3fe7 100644 (file)
Binary files a/graphics/osx/dcpomatic2.iconset/icon_256x256.png and b/graphics/osx/dcpomatic2.iconset/icon_256x256.png differ
index c39b1fe3bf753e66237dea15910c5f45c649ebe1..cd0640f12b6ffc08752df639c5337b04c54c3fe7 100644 (file)
Binary files a/graphics/osx/dcpomatic2.iconset/icon_256x256@2x.png and b/graphics/osx/dcpomatic2.iconset/icon_256x256@2x.png differ
index 7fb1a414062e14d1f93638bbb868f5e16c9ebed6..ee170e4691442dd22d0fa0d4851ab2462d2e143d 100644 (file)
Binary files a/graphics/osx/dcpomatic2.iconset/icon_32x32.png and b/graphics/osx/dcpomatic2.iconset/icon_32x32.png differ
index 7fb1a414062e14d1f93638bbb868f5e16c9ebed6..ee170e4691442dd22d0fa0d4851ab2462d2e143d 100644 (file)
Binary files a/graphics/osx/dcpomatic2.iconset/icon_32x32@2x.png and b/graphics/osx/dcpomatic2.iconset/icon_32x32@2x.png differ
index cab55bbe5a7dc13035ab9557ed5f6896cec84aaa..f591f1c7e5c3005ebdb3494d7b75ad9e5f382426 100644 (file)
Binary files a/graphics/osx/dcpomatic2.iconset/icon_512x512.png and b/graphics/osx/dcpomatic2.iconset/icon_512x512.png differ
index cab55bbe5a7dc13035ab9557ed5f6896cec84aaa..f591f1c7e5c3005ebdb3494d7b75ad9e5f382426 100644 (file)
Binary files a/graphics/osx/dcpomatic2.iconset/icon_512x512@2x.png and b/graphics/osx/dcpomatic2.iconset/icon_512x512@2x.png differ
diff --git a/graphics/osx/preferences/sound.png b/graphics/osx/preferences/sound.png
new file mode 100644 (file)
index 0000000..b5a80d7
Binary files /dev/null and b/graphics/osx/preferences/sound.png differ
diff --git a/graphics/src/sound.svg b/graphics/src/sound.svg
new file mode 100644 (file)
index 0000000..0970fc0
--- /dev/null
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   id="svg4217"
+   viewBox="-553676.6 0 0 1052.3622"
+   version="1.0"
+   inkscape:version="0.92.3 (2405546, 2018-03-11)"
+   width="450"
+   height="450"
+   sodipodi:docname="sound.svg"
+   inkscape:export-filename="/home/carl/src/dcpomatic/icons/kdm_email.png"
+   inkscape:export-xdpi="6.5100002"
+   inkscape:export-ydpi="6.5100002">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1920"
+     inkscape:window-height="1025"
+     id="namedview6320"
+     showgrid="false"
+     inkscape:zoom="0.85295919"
+     inkscape:cx="29.780284"
+     inkscape:cy="94.540107"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="svg4217" />
+  <defs
+     id="defs4219">
+    <linearGradient
+       id="linearGradient3594"
+       y2="742.5"
+       gradientUnits="userSpaceOnUse"
+       x2="-886.76001"
+       gradientTransform="matrix(-0.84033,-0.84033,-0.84033,0.84033,-405.66871,-1194.2782)"
+       y1="742.5"
+       x1="-772.01001">
+      <stop
+         id="stop4687"
+         stop-color="#fff"
+         offset="0" />
+      <stop
+         id="stop4689"
+         stop-color="#fff"
+         stop-opacity="0"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3601"
+       y2="613.94"
+       gradientUnits="userSpaceOnUse"
+       x2="385.04001"
+       gradientTransform="matrix(0.70711,-0.70711,0.70711,0.70711,-745.96871,253.33182)"
+       y1="63.870998"
+       x1="386.39001">
+      <stop
+         id="stop3797"
+         stop-color="#ffe800"
+         offset="0" />
+      <stop
+         id="stop3799"
+         stop-color="#dfb300"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3609"
+       y2="161.84"
+       gradientUnits="userSpaceOnUse"
+       x2="212.92999"
+       y1="358.29999"
+       x1="409.38"
+       gradientTransform="translate(-619.78872,-118.87818)">
+      <stop
+         id="stop4034"
+         stop-color="#dfb300"
+         offset="0" />
+      <stop
+         id="stop3374"
+         stop-color="#dfb300"
+         offset=".5" />
+      <stop
+         id="stop3376"
+         stop-color="#dfb300"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3632"
+       y2="448.35001"
+       gradientUnits="userSpaceOnUse"
+       x2="382.89999"
+       gradientTransform="matrix(0.70711,-0.70711,0.70711,0.70711,-745.96871,253.33182)"
+       y1="448.35001"
+       x1="403.63">
+      <stop
+         id="stop3636"
+         stop-color="#ffe800"
+         stop-opacity=".39216"
+         offset="0" />
+      <stop
+         id="stop3638"
+         stop-color="#dfb300"
+         stop-opacity=".39216"
+         offset="1" />
+    </linearGradient>
+  </defs>
+  <metadata
+     id="metadata6318">
+    <rdf:RDF>
+      <cc:Work>
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <cc:license
+           rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" />
+        <dc:publisher>
+          <cc:Agent
+             rdf:about="http://openclipart.org/">
+            <dc:title>Openclipart</dc:title>
+          </cc:Agent>
+        </dc:publisher>
+        <dc:title></dc:title>
+        <dc:date>2007-02-27T15:15:43</dc:date>
+        <dc:description>A key icon.</dc:description>
+        <dc:source>http://openclipart.org/detail/3330/key-by-barretr</dc:source>
+        <dc:creator>
+          <cc:Agent>
+            <dc:title>barretr</dc:title>
+          </cc:Agent>
+        </dc:creator>
+        <dc:subject>
+          <rdf:Bag>
+            <rdf:li>clip art</rdf:li>
+            <rdf:li>clipart</rdf:li>
+            <rdf:li>icon</rdf:li>
+            <rdf:li>image</rdf:li>
+            <rdf:li>key</rdf:li>
+            <rdf:li>media</rdf:li>
+            <rdf:li>png</rdf:li>
+            <rdf:li>public domain</rdf:li>
+            <rdf:li>svg</rdf:li>
+          </rdf:Bag>
+        </dc:subject>
+      </cc:Work>
+      <cc:License
+         rdf:about="http://creativecommons.org/publicdomain/zero/1.0/">
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Reproduction" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Distribution" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
+  <rect
+     style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ff0000;fill-opacity:0;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;marker:none;enable-background:accumulate"
+     id="rect6322"
+     width="442.68826"
+     height="442.68826"
+     x="-457.43286"
+     y="2.3376961" />
+  <rect
+     style="opacity:1;vector-effect:none;fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:25;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-end:none;paint-order:stroke fill markers"
+     id="rect831"
+     width="100.12302"
+     height="152.50291"
+     x="18.758173"
+     y="150.65996" />
+  <path
+     style="opacity:1;vector-effect:none;fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:25;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-end:none;paint-order:stroke fill markers"
+     d="M 252.06369,383.67683 118.88119,303.16287 V 150.65996 L 252.0637,70.146007 Z"
+     id="path882"
+     inkscape:connector-curvature="0" />
+  <path
+     style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#333333;stroke-width:14;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-end:none;paint-order:stroke fill markers"
+     id="path897"
+     sodipodi:type="arc"
+     sodipodi:cx="188.16844"
+     sodipodi:cy="226.6599"
+     sodipodi:rx="169.41022"
+     sodipodi:ry="169.41022"
+     sodipodi:start="5.4977871"
+     sodipodi:end="0.78539816"
+     d="m 307.95955,106.86878 a 169.41022,169.41022 0 0 1 49.61911,119.79111 169.41022,169.41022 0 0 1 -49.6191,119.79112"
+     sodipodi:open="true" />
+  <path
+     style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#999999;stroke-width:14;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-end:none;paint-order:stroke fill markers"
+     id="path897-6"
+     sodipodi:type="arc"
+     sodipodi:cx="203.15329"
+     sodipodi:cy="227.77385"
+     sodipodi:rx="227.83228"
+     sodipodi:ry="218.6208"
+     sodipodi:start="5.4977871"
+     sodipodi:end="0.78539816"
+     d="M 364.25503,73.18559 A 227.83228,218.6208 0 0 1 430.98557,227.77384 227.83228,218.6208 0 0 1 364.25504,382.3621"
+     sodipodi:open="true" />
+</svg>
index 94cbbf88eb101d4172b5bddaae602c0d3247b7b3..f0d91bf8976b2c07446e94e1b3f359bb2eab9e6b 100755 (executable)
@@ -63,7 +63,7 @@ else
     # OS X preferences icons
     # servers.png does not have an SVG version
     mkdir -p osx/preferences
-    for i in colour_conversions defaults email kdm_email cover_sheet keys tms notifications accounts locations; do
+    for i in colour_conversions defaults email kdm_email cover_sheet keys tms notifications accounts locations sound; do
        $INKSCAPE osx/preferences/$i.png src/$i.svg -w 32 -h 32
     done
 
index d67c8921ca1d969ba6ad8e496418f2bd995d0fcb..658bf796e788cb6ab03a3877f5131da550e03a26 100644 (file)
Binary files a/graphics/web/favicon-128x128.png and b/graphics/web/favicon-128x128.png differ
index 400d4b9b93bf0d77ec5567bd9a1c295abda9b757..68e4f96c4e1e453b4b7e3a89cd731efa60784e0c 100644 (file)
Binary files a/graphics/web/favicon-16x16.png and b/graphics/web/favicon-16x16.png differ
index 82467c21323c32f72d6a2cfb0393797871fef13d..f5b5e758da58e00b8e3948982d45ad00efdee56d 100644 (file)
Binary files a/graphics/web/favicon-256x256.png and b/graphics/web/favicon-256x256.png differ
index 4463386699d814aeac7c1b1c7b042a6d8e58f5a2..75fd6ed7186bd620d05fabdaecca390ffed05a1e 100644 (file)
Binary files a/graphics/web/favicon-32x32.png and b/graphics/web/favicon-32x32.png differ
index 3318ae2803cf5fd662734d8fa1cd5a19d96e8b29..f7e5ca6fc8435c618ec7e0416a50f067b7d1548b 100644 (file)
Binary files a/graphics/web/favicon-64x64.png and b/graphics/web/favicon-64x64.png differ
index c9b04f07e66a9cffa1dfea54f99c698d4d249042..9a57085b2f7a383c0ab107b6e227812d7102429f 100644 (file)
Binary files a/graphics/web/logo.png and b/graphics/web/logo.png differ
index 98a1a1a8e231c29505ab2385fc41a4e892aede45..14948afe8d13e65fd5ee739a484fb991e68d5efb 100644 (file)
@@ -154,36 +154,6 @@ GeneralPage::add_language_controls (wxGridBagSizer* table, int& r)
        _language->Bind     (wxEVT_CHOICE,   bind (&GeneralPage::language_changed,     this));
 }
 
-void
-GeneralPage::add_play_sound_controls (wxGridBagSizer* table, int& r)
-{
-       _sound = new CheckBox (_panel, _("Play sound via"));
-       table->Add (_sound, wxGBPosition (r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
-       wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-       _sound_output = new wxChoice (_panel, wxID_ANY);
-       s->Add (_sound_output, 0);
-       _sound_output_details = new wxStaticText (_panel, wxID_ANY, wxT(""));
-       s->Add (_sound_output_details, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, DCPOMATIC_SIZER_X_GAP);
-       table->Add (s, wxGBPosition(r, 1));
-       ++r;
-
-       wxFont font = _sound_output_details->GetFont();
-       font.SetStyle (wxFONTSTYLE_ITALIC);
-       font.SetPointSize (font.GetPointSize() - 1);
-       _sound_output_details->SetFont (font);
-
-       RtAudio audio (DCPOMATIC_RTAUDIO_API);
-       for (unsigned int i = 0; i < audio.getDeviceCount(); ++i) {
-               RtAudio::DeviceInfo dev = audio.getDeviceInfo (i);
-               if (dev.probed && dev.outputChannels > 0) {
-                       _sound_output->Append (std_to_wx (dev.name));
-               }
-       }
-
-       _sound->Bind        (wxEVT_CHECKBOX, bind (&GeneralPage::sound_changed, this));
-       _sound_output->Bind (wxEVT_CHOICE,   bind (&GeneralPage::sound_output_changed, this));
-}
-
 void
 GeneralPage::add_update_controls (wxGridBagSizer* table, int& r)
 {
@@ -233,62 +203,6 @@ GeneralPage::config_changed ()
        checked_set (_check_for_updates, config->check_for_updates ());
        checked_set (_check_for_test_updates, config->check_for_test_updates ());
 
-       checked_set (_sound, config->sound ());
-
-       optional<string> const current_so = get_sound_output ();
-       optional<string> configured_so;
-
-       if (config->sound_output()) {
-               configured_so = config->sound_output().get();
-       } else {
-               /* No configured output means we should use the default */
-               RtAudio audio (DCPOMATIC_RTAUDIO_API);
-               try {
-                       configured_so = audio.getDeviceInfo(audio.getDefaultOutputDevice()).name;
-               } catch (RtAudioError& e) {
-                       /* Probably no audio devices at all */
-               }
-       }
-
-       if (configured_so && current_so != configured_so) {
-               /* Update _sound_output with the configured value */
-               unsigned int i = 0;
-               while (i < _sound_output->GetCount()) {
-                       if (_sound_output->GetString(i) == std_to_wx(*configured_so)) {
-                               _sound_output->SetSelection (i);
-                               break;
-                       }
-                       ++i;
-               }
-       }
-
-       RtAudio audio (DCPOMATIC_RTAUDIO_API);
-
-       map<int, wxString> apis;
-       apis[RtAudio::MACOSX_CORE]    = _("CoreAudio");
-       apis[RtAudio::WINDOWS_ASIO]   = _("ASIO");
-       apis[RtAudio::WINDOWS_DS]     = _("Direct Sound");
-       apis[RtAudio::WINDOWS_WASAPI] = _("WASAPI");
-       apis[RtAudio::UNIX_JACK]      = _("JACK");
-       apis[RtAudio::LINUX_ALSA]     = _("ALSA");
-       apis[RtAudio::LINUX_PULSE]    = _("PulseAudio");
-       apis[RtAudio::LINUX_OSS]      = _("OSS");
-       apis[RtAudio::RTAUDIO_DUMMY]  = _("Dummy");
-
-       int channels = 0;
-       if (configured_so) {
-               for (unsigned int i = 0; i < audio.getDeviceCount(); ++i) {
-                       RtAudio::DeviceInfo info = audio.getDeviceInfo(i);
-                       if (info.name == *configured_so && info.outputChannels > 0) {
-                               channels = info.outputChannels;
-                       }
-               }
-       }
-
-       _sound_output_details->SetLabel (
-               wxString::Format(_("%d channels on %s"), channels, apis[audio.getCurrentApi()])
-               );
-
        setup_sensitivity ();
 }
 
@@ -297,19 +211,6 @@ GeneralPage::setup_sensitivity ()
 {
        _language->Enable (_set_language->GetValue ());
        _check_for_test_updates->Enable (_check_for_updates->GetValue ());
-       _sound_output->Enable (_sound->GetValue ());
-}
-
-/** @return Currently-selected preview sound output in the dialogue */
-optional<string>
-GeneralPage::get_sound_output ()
-{
-       int const sel = _sound_output->GetSelection ();
-       if (sel == wxNOT_FOUND) {
-               return optional<string> ();
-       }
-
-       return wx_to_std (_sound_output->GetString (sel));
 }
 
 void
@@ -346,24 +247,6 @@ GeneralPage::check_for_test_updates_changed ()
        Config::instance()->set_check_for_test_updates (_check_for_test_updates->GetValue ());
 }
 
-void
-GeneralPage::sound_changed ()
-{
-       Config::instance()->set_sound (_sound->GetValue ());
-}
-
-void
-GeneralPage::sound_output_changed ()
-{
-       RtAudio audio (DCPOMATIC_RTAUDIO_API);
-       optional<string> const so = get_sound_output();
-       if (!so || *so == audio.getDeviceInfo(audio.getDefaultOutputDevice()).name) {
-               Config::instance()->unset_sound_output ();
-       } else {
-               Config::instance()->set_sound_output (*so);
-       }
-}
-
 CertificateChainEditor::CertificateChainEditor (
        wxWindow* parent,
        wxString title,
@@ -965,3 +848,144 @@ KeysPage::export_decryption_certificate ()
 
        d->Destroy ();
 }
+
+wxString
+SoundPage::GetName () const
+{
+       return _("Sound");
+}
+
+void
+SoundPage::setup ()
+{
+       wxGridBagSizer* table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+       _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
+
+       int r = 0;
+
+       _sound = new CheckBox (_panel, _("Play sound via"));
+       table->Add (_sound, wxGBPosition (r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+       wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+       _sound_output = new wxChoice (_panel, wxID_ANY);
+       s->Add (_sound_output, 0);
+       _sound_output_details = new wxStaticText (_panel, wxID_ANY, wxT(""));
+       s->Add (_sound_output_details, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, DCPOMATIC_SIZER_X_GAP);
+       table->Add (s, wxGBPosition(r, 1));
+       ++r;
+
+       wxFont font = _sound_output_details->GetFont();
+       font.SetStyle (wxFONTSTYLE_ITALIC);
+       font.SetPointSize (font.GetPointSize() - 1);
+       _sound_output_details->SetFont (font);
+
+       RtAudio audio (DCPOMATIC_RTAUDIO_API);
+       for (unsigned int i = 0; i < audio.getDeviceCount(); ++i) {
+               RtAudio::DeviceInfo dev = audio.getDeviceInfo (i);
+               if (dev.probed && dev.outputChannels > 0) {
+                       _sound_output->Append (std_to_wx (dev.name));
+               }
+       }
+
+       _sound->Bind        (wxEVT_CHECKBOX, bind (&SoundPage::sound_changed, this));
+       _sound_output->Bind (wxEVT_CHOICE,   bind (&SoundPage::sound_output_changed, this));
+}
+
+void
+SoundPage::sound_changed ()
+{
+       Config::instance()->set_sound (_sound->GetValue ());
+}
+
+void
+SoundPage::sound_output_changed ()
+{
+       RtAudio audio (DCPOMATIC_RTAUDIO_API);
+       optional<string> const so = get_sound_output();
+       if (!so || *so == audio.getDeviceInfo(audio.getDefaultOutputDevice()).name) {
+               Config::instance()->unset_sound_output ();
+       } else {
+               Config::instance()->set_sound_output (*so);
+       }
+}
+
+void
+SoundPage::config_changed ()
+{
+       Config* config = Config::instance ();
+
+       checked_set (_sound, config->sound ());
+
+       optional<string> const current_so = get_sound_output ();
+       optional<string> configured_so;
+
+       if (config->sound_output()) {
+               configured_so = config->sound_output().get();
+       } else {
+               /* No configured output means we should use the default */
+               RtAudio audio (DCPOMATIC_RTAUDIO_API);
+               try {
+                       configured_so = audio.getDeviceInfo(audio.getDefaultOutputDevice()).name;
+               } catch (RtAudioError& e) {
+                       /* Probably no audio devices at all */
+               }
+       }
+
+       if (configured_so && current_so != configured_so) {
+               /* Update _sound_output with the configured value */
+               unsigned int i = 0;
+               while (i < _sound_output->GetCount()) {
+                       if (_sound_output->GetString(i) == std_to_wx(*configured_so)) {
+                               _sound_output->SetSelection (i);
+                               break;
+                       }
+                       ++i;
+               }
+       }
+
+       RtAudio audio (DCPOMATIC_RTAUDIO_API);
+
+       map<int, wxString> apis;
+       apis[RtAudio::MACOSX_CORE]    = _("CoreAudio");
+       apis[RtAudio::WINDOWS_ASIO]   = _("ASIO");
+       apis[RtAudio::WINDOWS_DS]     = _("Direct Sound");
+       apis[RtAudio::WINDOWS_WASAPI] = _("WASAPI");
+       apis[RtAudio::UNIX_JACK]      = _("JACK");
+       apis[RtAudio::LINUX_ALSA]     = _("ALSA");
+       apis[RtAudio::LINUX_PULSE]    = _("PulseAudio");
+       apis[RtAudio::LINUX_OSS]      = _("OSS");
+       apis[RtAudio::RTAUDIO_DUMMY]  = _("Dummy");
+
+       int channels = 0;
+       if (configured_so) {
+               for (unsigned int i = 0; i < audio.getDeviceCount(); ++i) {
+                       RtAudio::DeviceInfo info = audio.getDeviceInfo(i);
+                       if (info.name == *configured_so && info.outputChannels > 0) {
+                               channels = info.outputChannels;
+                       }
+               }
+       }
+
+       _sound_output_details->SetLabel (
+               wxString::Format(_("%d channels on %s"), channels, apis[audio.getCurrentApi()])
+               );
+
+       setup_sensitivity ();
+}
+
+void
+SoundPage::setup_sensitivity ()
+{
+       _sound_output->Enable (_sound->GetValue());
+}
+
+/** @return Currently-selected preview sound output in the dialogue */
+optional<string>
+SoundPage::get_sound_output ()
+{
+       int const sel = _sound_output->GetSelection ();
+       if (sel == wxNOT_FOUND) {
+               return optional<string> ();
+       }
+
+       return wx_to_std (_sound_output->GetString (sel));
+}
index ac90cd42da2af4ae7a2356485a2aedde6ceb1858..1a9d97a436f0eee010a34ddac1941c596f108b62 100644 (file)
@@ -89,25 +89,18 @@ public:
 
 protected:
        void add_language_controls (wxGridBagSizer* table, int& r);
-       void add_play_sound_controls (wxGridBagSizer* table, int& r);
        void add_update_controls (wxGridBagSizer* table, int& r);
        virtual void config_changed ();
 
 private:
        void setup_sensitivity ();
-        boost::optional<std::string> get_sound_output ();
        void set_language_changed ();
        void language_changed ();
        void check_for_updates_changed ();
        void check_for_test_updates_changed ();
-       void sound_changed ();
-        void sound_output_changed ();
 
        wxCheckBox* _set_language;
        wxChoice* _language;
-       wxCheckBox* _sound;
-       wxChoice* _sound_output;
-       wxStaticText* _sound_output_details;
        wxCheckBox* _check_for_updates;
        wxCheckBox* _check_for_test_updates;
 };
@@ -185,4 +178,34 @@ private:
 };
 
 
+class SoundPage : public StandardPage
+{
+public:
+       SoundPage (wxSize panel_size, int border)
+               : StandardPage (panel_size, border)
+       {}
+
+       wxString GetName() const;
+
+#ifdef DCPOMATIC_OSX
+       wxBitmap GetLargeIcon () const
+       {
+               return wxBitmap ("sound", wxBITMAP_TYPE_PNG_RESOURCE);
+       }
+#endif
+
+private:
+
+       void setup ();
+       void config_changed ();
+        boost::optional<std::string> get_sound_output ();
+       void sound_changed ();
+        void sound_output_changed ();
+       void setup_sensitivity ();
+
+       wxCheckBox* _sound;
+       wxChoice* _sound_output;
+       wxStaticText* _sound_output_details;
+};
+
 #endif
index 1c5a9e3f668f3cb604683f54cd916a783f31e4d0..f586672a8e6d60fc6fa76ce8ec2dc095aa415d8e 100644 (file)
@@ -116,8 +116,6 @@ private:
                table->Add (export_cinemas, wxGBPosition (r, 2));
                ++r;
 
-               add_play_sound_controls (table, r);
-
 #ifdef DCPOMATIC_HAVE_EBUR128_PATCHED_FFMPEG
                _analyse_ebur128 = new CheckBox (_panel, _("Find integrated loudness, true peak and loudness range when analysing audio"));
                table->Add (_analyse_ebur128, wxGBPosition (r, 0), wxGBSpan (1, 2));
@@ -1678,6 +1676,7 @@ create_full_config_dialog ()
 #endif
 
        e->AddPage (new FullGeneralPage (ps, border));
+       e->AddPage (new SoundPage (ps, border));
        e->AddPage (new DefaultsPage (ps, border));
        e->AddPage (new EncodingServersPage (ps, border));
        e->AddPage (new KeysPage (ps, border));
index 20ddde99202ce1321b6429580a7dbdb670f771b8..508b91746f0a09302a2b20343b8892697495a6c6 100644 (file)
@@ -85,7 +85,6 @@ private:
 
                int r = 0;
                add_language_controls (table, r);
-               add_play_sound_controls (table, r);
                add_update_controls (table, r);
 
                add_label_to_sizer (table, _panel, _("Start player as"), true, wxGBPosition(r, 0));
@@ -684,6 +683,7 @@ create_player_config_dialog ()
 #endif
 
        e->AddPage (new PlayerGeneralPage(wxSize(-1, 500), border));
+       e->AddPage (new SoundPage(ps, border));
        e->AddPage (new LocationsPage(ps, border));
        e->AddPage (new KeysPage(ps, border));
 #ifdef DCPOMATIC_VARIANT_SWAROOP