Browse Source

Audio supports custom sample rate;

bjorn 3 years ago
parent
commit
1b6840b45a
2 changed files with 24 additions and 0 deletions
  1. 18 0
      api/lovr/audio/getSampleRate.lua
  2. 6 0
      api/lovr/callbacks/conf.lua

+ 18 - 0
api/lovr/audio/getSampleRate.lua

@@ -0,0 +1,18 @@
+return {
+  tag = 'devices',
+  summary = 'Get the playback device sample rate.',
+  description = [[
+    Returns the sample rate used by the playback device.  This can be changed using `lovr.conf`.
+  ]],
+  arguments = {},
+  returns = {
+    {
+      name = 'rate',
+      type = 'number',
+      description = 'The sample rate of the playback device, in Hz.'
+    }
+  },
+  related = {
+    'lovr.conf'
+  }
+}

+ 6 - 0
api/lovr/callbacks/conf.lua

@@ -105,6 +105,11 @@ return {
                 them are attempted.
                 them are attempted.
               ]]
               ]]
             },
             },
+            {
+              name = 'samplerate',
+              type = 'number',
+              description = 'The sample rate to use for audio playback.'
+            },
             {
             {
               name = 'start',
               name = 'start',
               type = 'boolean',
               type = 'boolean',
@@ -267,6 +272,7 @@ return {
 
 
           -- Audio
           -- Audio
           t.audio.spatializer = nil
           t.audio.spatializer = nil
+          t.audio.samplerate = 48000
           t.audio.start = true
           t.audio.start = true
 
 
           -- Graphics
           -- Graphics