audio: Remove unneeded C files

This commit is contained in:
Hajime Hoshi 2016-04-15 02:07:35 +09:00
parent 98be54fe60
commit 4b5243579c
2 changed files with 1 additions and 42 deletions

View File

@ -1,31 +0,0 @@
// Copyright 2015 Hajime Hoshi
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <windows.h>
#include <mmsystem.h>
void releaseSemaphore(void);
static void CALLBACK soundFilled(HWAVEOUT waveOut, UINT msg, DWORD_PTR instance, DWORD_PTR param1, DWORD_PTR param2)
{
if (msg != WOM_DONE) {
return;
}
releaseSemaphore();
}
MMRESULT waveOutOpen2(HWAVEOUT* waveOut, WAVEFORMATEX* format)
{
return waveOutOpen(waveOut, WAVE_MAPPER, format, (DWORD_PTR)soundFilled, 0, CALLBACK_FUNCTION);
}

View File

@ -20,8 +20,6 @@ package driver
// #include <mmsystem.h> // #include <mmsystem.h>
// //
// #define sizeOfWavehdr (sizeof(WAVEHDR)) // #define sizeOfWavehdr (sizeof(WAVEHDR))
//
// MMRESULT waveOutOpen2(HWAVEOUT* waveOut, WAVEFORMATEX* format);
import "C" import "C"
import ( import (
@ -67,13 +65,6 @@ func (h *header) Write(waveOut C.HWAVEOUT, data []byte) error {
const numHeader = 8 const numHeader = 8
var sem = make(chan struct{}, numHeader)
//export releaseSemaphore
func releaseSemaphore() {
<-sem
}
type Player struct { type Player struct {
out C.HWAVEOUT out C.HWAVEOUT
buffer []byte buffer []byte
@ -93,7 +84,7 @@ func NewPlayer(sampleRate, channelNum, bytesPerSample int) (*Player, error) {
nBlockAlign: C.WORD(numBlockAlign), nBlockAlign: C.WORD(numBlockAlign),
} }
var w C.HWAVEOUT var w C.HWAVEOUT
if err := C.waveOutOpen2(&w, &f); err != C.MMSYSERR_NOERROR { if err := C.waveOutOpen(&w, C.WAVE_MAPPER, &f, 0, 0, C.CALLBACK_NULL); err != C.MMSYSERR_NOERROR {
return nil, fmt.Errorf("driver: waveOutOpen error: %d", err) return nil, fmt.Errorf("driver: waveOutOpen error: %d", err)
} }
p := &Player{ p := &Player{
@ -116,7 +107,6 @@ func (p *Player) Proceed(data []byte) error {
if bufferSize > len(p.buffer) { if bufferSize > len(p.buffer) {
return nil return nil
} }
sem <- struct{}{}
headerToWrite := (*header)(nil) headerToWrite := (*header)(nil)
for _, h := range p.headers { for _, h := range p.headers {
// TODO: Need to check WHDR_DONE? // TODO: Need to check WHDR_DONE?