Notification sound added. Docs updated.
This commit is contained in:
1 parent
4c9a267897
commit
81cc630319
29 files changed
+845
-57
No files matched your search
@@ -36,7 +36,9 @@ func open_pulse(s *Service, _ string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("connect sound server: %w", err)
|
||||
}
|
||||
stream, err := client.NewPlayback(pulse.Float32Reader(s.read_samples), pulse.PlaybackStereo, pulse.PlaybackSampleRate(sampleRate), pulse.PlaybackLatency(0.02), pulse.PlaybackMediaName("Fenrir sound cues"))
|
||||
drainRequests := make(chan *notificationPlayback, 1)
|
||||
read := func(samples []float32) (int, error) { return s.read_pulse_samples(samples, drainRequests) }
|
||||
stream, err := client.NewPlayback(pulse.Float32Reader(read), pulse.PlaybackStereo, pulse.PlaybackSampleRate(sampleRate), pulse.PlaybackLatency(0.02), pulse.PlaybackMediaName("Fenrir sound cues"))
|
||||
if err != nil {
|
||||
client.Close()
|
||||
return err
|
||||
@@ -56,6 +58,11 @@ func open_pulse(s *Service, _ string) error {
|
||||
select {
|
||||
case <-s.done:
|
||||
return
|
||||
case request := <-drainRequests:
|
||||
if err := s.drain_notification(request, s.drainBackend); err != nil {
|
||||
s.errors <- fmt.Errorf("notification sound drain: %w", err)
|
||||
return
|
||||
}
|
||||
case <-tick.C:
|
||||
if stream.Closed() {
|
||||
s.errors <- fmt.Errorf("sound server connection closed")
|
||||
|
||||
Reference in new issue
Block a user