(sampleRate, channelCount int, mux *mux.Mux, bufferSizeInBytes int)
| 91 | var theWinMMContext *winmmContext |
| 92 | |
| 93 | func newWinMMContext(sampleRate, channelCount int, mux *mux.Mux, bufferSizeInBytes int) (*winmmContext, error) { |
| 94 | // winmm.dll is not available on Xbox. |
| 95 | if err := winmm.Load(); err != nil { |
| 96 | return nil, fmt.Errorf("oto: loading winmm.dll failed: %w", err) |
| 97 | } |
| 98 | |
| 99 | c := &winmmContext{ |
| 100 | sampleRate: sampleRate, |
| 101 | channelCount: channelCount, |
| 102 | bufferSizeInBytes: bufferSizeInBytes, |
| 103 | mux: mux, |
| 104 | cond: sync.NewCond(&sync.Mutex{}), |
| 105 | suspendedCond: sync.NewCond(&sync.Mutex{}), |
| 106 | } |
| 107 | theWinMMContext = c |
| 108 | |
| 109 | if err := c.start(); err != nil { |
| 110 | return nil, err |
| 111 | } |
| 112 | return c, nil |
| 113 | } |
| 114 | |
| 115 | func (c *winmmContext) start() error { |
| 116 | const bitsPerSample = 32 |
no test coverage detected
searching dependent graphs…