Skip to content

Commit 5e84721

Browse files
rbnpisamaaron
authored andcommitted
Add pulseaudio support for RPi
1 parent 40d3b59 commit 5e84721

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

app/server/ruby/lib/sonicpi/scsynthexternal.rb

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -404,18 +404,12 @@ def boot_server_raspberry_pi
404404
else
405405
puts "Booting on Raspberry Pi (32bit OS)"
406406
end
407-
begin
408-
asoundrc = File.read(Dir.home + "/.asoundrc")
409-
audio_card = (asoundrc.match(/pcm.output\s+{[^}]+\n\s+card\s+([0-9]+)/m))[1]
410-
rescue
411-
audio_card = "0"
412-
end
413407

414408
#Start Jack if not already running
415409
if `ps cax | grep jackd`.split(" ").first.nil?
416410
#Jack not running - start a new instance
417411
puts "Jackd not running on system. Starting..."
418-
jackCmd="jackd -R -p 32 -d alsa -d hw:#{audio_card} -n 3 -p 2048 -o2 -r 44100 "
412+
jackCmd="jackd -T -ddummy -r48000 -p1024"
419413
jack_pid = spawn "exec #{jackCmd}"
420414
register_process jack_pid
421415
else
@@ -435,11 +429,13 @@ def boot_server_raspberry_pi
435429

436430
boot_and_wait(scsynth_path, scsynth_opts)
437431

438-
`jack_connect SuperCollider:out_1 system:playback_1`
439-
`jack_connect SuperCollider:out_2 system:playback_2`
440432
`jack_connect SuperCollider:in_1 system_capture_1`
441433
`jack_connect SuperCollider:in_2 system_capture_2`
442-
434+
`pactl load-module module-jack-source connect=0 client_name=JACK_to_PulseAudio`
435+
`pactl load-module module-loopback source=jack_in`
436+
`jack_connect SuperCollider:out_1 JACK_to_PulseAudio:front-left`
437+
`jack_connect SuperCollider:out_2 JACK_to_PulseAudio:front-right`
438+
443439
sleep 3
444440
end
445441

0 commit comments

Comments
 (0)