mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
audio: Remove unneeded C files
This commit is contained in:
parent
98be54fe60
commit
4b5243579c
@ -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);
|
||||
}
|
@ -20,8 +20,6 @@ package driver
|
||||
// #include <mmsystem.h>
|
||||
//
|
||||
// #define sizeOfWavehdr (sizeof(WAVEHDR))
|
||||
//
|
||||
// MMRESULT waveOutOpen2(HWAVEOUT* waveOut, WAVEFORMATEX* format);
|
||||
import "C"
|
||||
|
||||
import (
|
||||
@ -67,13 +65,6 @@ func (h *header) Write(waveOut C.HWAVEOUT, data []byte) error {
|
||||
|
||||
const numHeader = 8
|
||||
|
||||
var sem = make(chan struct{}, numHeader)
|
||||
|
||||
//export releaseSemaphore
|
||||
func releaseSemaphore() {
|
||||
<-sem
|
||||
}
|
||||
|
||||
type Player struct {
|
||||
out C.HWAVEOUT
|
||||
buffer []byte
|
||||
@ -93,7 +84,7 @@ func NewPlayer(sampleRate, channelNum, bytesPerSample int) (*Player, error) {
|
||||
nBlockAlign: C.WORD(numBlockAlign),
|
||||
}
|
||||
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)
|
||||
}
|
||||
p := &Player{
|
||||
@ -116,7 +107,6 @@ func (p *Player) Proceed(data []byte) error {
|
||||
if bufferSize > len(p.buffer) {
|
||||
return nil
|
||||
}
|
||||
sem <- struct{}{}
|
||||
headerToWrite := (*header)(nil)
|
||||
for _, h := range p.headers {
|
||||
// TODO: Need to check WHDR_DONE?
|
||||
|
Loading…
Reference in New Issue
Block a user