From bbdb522b15007d59121bf2d4ec393fb865786da2 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 9 Apr 2016 00:58:50 +0900 Subject: [PATCH] audio: Bug fix: compilation error on Windows --- exp/audio/internal/driver/driver_windows.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exp/audio/internal/driver/driver_windows.go b/exp/audio/internal/driver/driver_windows.go index 9c3e16990..d88ef5701 100644 --- a/exp/audio/internal/driver/driver_windows.go +++ b/exp/audio/internal/driver/driver_windows.go @@ -85,14 +85,14 @@ type Player struct { const bufferSize = 1024 func NewPlayer(src io.Reader, sampleRate, channelNum, bytesPerSample int) (*Player, error) { - const numBlockAlign = channelNum * bytesPerSample + numBlockAlign := channelNum * bytesPerSample f := C.WAVEFORMATEX{ wFormatTag: C.WAVE_FORMAT_PCM, - nChannels: channelNum, + nChannels: C.WORD(channelNum), nSamplesPerSec: C.DWORD(sampleRate), - nAvgBytesPerSec: C.DWORD(sampleRate) * numBlockAlign, - wBitsPerSample: bytesPerSample * 8, - nBlockAlign: numBlockAlign, + nAvgBytesPerSec: C.DWORD(sampleRate * numBlockAlign), + wBitsPerSample: C.WORD(bytesPerSample * 8), + nBlockAlign: C.WORD(numBlockAlign), } var w C.HWAVEOUT if err := C.waveOutOpen2(&w, &f); err != C.MMSYSERR_NOERROR {