MCPcopy
hub / github.com/ebitengine/oto / newWinMMContext

Function newWinMMContext

driver_winmm_windows.go:93–113  ·  view source on GitHub ↗
(sampleRate, channelCount int, mux *mux.Mux, bufferSizeInBytes int)

Source from the content-addressed store, hash-verified

91var theWinMMContext *winmmContext
92
93func 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
115func (c *winmmContext) start() error {
116 const bitsPerSample = 32

Callers 1

newContextFunction · 0.85

Calls 2

startMethod · 0.95
LoadMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…