]> git.sesse.net Git - ultimatescore/commitdiff
Make some nice mappings for the Sound Shark.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 22 Feb 2020 18:36:27 +0000 (19:36 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 22 Feb 2020 18:36:27 +0000 (19:36 +0100)
nageru/ultimate.lua
nageru/ultimate.mapping

index 6bfa1c1988319175d2485e9c20db1f20a454982f..3efaa633d0fa873176fb281f5a27621f96faaeb4 100644 (file)
@@ -724,6 +724,8 @@ function fetch_input_resolution(signals, signal_num)
        return res
 end
 
+local last_alsa_sound_shark_volume = -1   -- Always update on the first frame.
+
 function update_volume()
        if Nageru.get_num_audio_buses() < 3 or
           Nageru.get_audio_bus_name(2) ~= 'Sound Shark' then
@@ -741,6 +743,13 @@ function update_volume()
                volume_db = -100.0
        end
        cef_input:execute_javascript_async("set_sound_shark_volume_db(" .. volume_db .. ")")
+
+       local desired_alsa_sound_shark_volume = (volume_db < -40.0) and 0 or 154  -- 154 corresponds to 70% in alsamixer for this input.
+       if desired_alsa_sound_shark_volume ~= last_alsa_sound_shark_volume then
+               os.execute("amixer -D hw:CARD=USB sset 'Mix A Input 04' " .. desired_alsa_sound_shark_volume .. " &")
+               os.execute("amixer -D hw:CARD=USB sset 'Mix B Input 04' " .. desired_alsa_sound_shark_volume .. " &")
+               last_alsa_sound_shark_volume = desired_alsa_sound_shark_volume
+       end
 end
 
 local last_rate = 0.0
index b13b88fe8c8828f325fea3fd20d79e47aad27e72..4e15b0462908553f6dd35564f9a59688f380d02b 100644 (file)
@@ -5,10 +5,7 @@ device {
   alsa_name: "Scarlett 18i20 USB"
   alsa_info: "USB Audio"
   num_channels: 18
-  address: "hw:1,0"
-}
-device {
-  type: SILENCE
+  address: "hw:2,0"
 }
 bus {
   name: "Ambience mic"
@@ -24,7 +21,7 @@ bus {
 }
 bus {
   name: "Sound Shark"
-  device_index: 1
-  source_channel_left: -1
-  source_channel_right: -1
+  device_index: 0
+  source_channel_left: 6
+  source_channel_right: 6
 }