jbclements / RSound

A cross-platform sound library for DrRacket
http://www.brinckerhoff.org/clements
Other
45 stars 11 forks source link

Unwanted noisy output on instantiation #43

Open zyrolasting opened 4 years ago

zyrolasting commented 4 years ago

I'm trying to suppress (but later redirect) some messages that appear on the right of the below screenshot. It appears that these are messages that come from the RSound library itself, and redirecting output via current-*-port to nowhere doesn't have an effect.

I can still use the library fine. The problem is that I use rsound on a different thread, and it would be competing out of band for standard ports. If I can't capture these messages somehow, then this adds noise to my logs.

Here's a copyable version of my attempt to silence rsound noise on the left side of the screenshot. Problem is that I don't know if you'll be able to reproduce these messages because you don't have my hardware. Please tell me of any information I can provide that can help you.

#lang racket

(provide (all-defined-out))
(require "shared.rkt")

(define nowhere (open-output-nowhere))
(define-syntax-rule (silent-begin body ...)
  (parameterize ([current-output-port nowhere]
                 [current-error-port nowhere])
    body ...))

(define (dynreq s)
  (silent-begin (dynamic-require 'rsound s)))

(define-syntax-rule (silent/proc id ...)
  (begin
    (begin
      (provide id)
      (define (id . args) (apply (dynreq 'id) args)))
    ...))

(define-syntax-rule (silent/id id ...)
  (begin
    (begin
      (provide id)
      (define id (dynreq 'id)))
    ...))

; Try to silence noise.
(silent/proc rs-write rs-append*)
(silent/id clap-1 snare bassdrum clap-2 kick)

image