X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fwin%2Fsound.c;fp=drivers%2Fwin%2Fsound.c;h=0000000000000000000000000000000000000000;hb=987332078d2c97ba37b73d2b946377906fb486d7;hp=d9c29c572fe24414c9db9c2251c979be394bc5d7;hpb=5232c20c0fa2c80964fe1d3f597c239bcf93d6fc;p=fceu.git diff --git a/drivers/win/sound.c b/drivers/win/sound.c deleted file mode 100644 index d9c29c5..0000000 --- a/drivers/win/sound.c +++ /dev/null @@ -1,457 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Ben Parnell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -FILE *soundlog=0; -void WriteWaveData(int32 *Buffer, int Count); -DWORD WINAPI DSThread(LPVOID lpParam); -LPDIRECTSOUND ppDS=0; -LPDIRECTSOUNDBUFFER ppbuf=0; -LPDIRECTSOUNDBUFFER ppbufsec=0; -LPDIRECTSOUNDBUFFER ppbufw; - -DSBUFFERDESC DSBufferDesc; -WAVEFORMATEX wfa; -WAVEFORMATEX wf; - -static int DSBufferSize=0; -static int bittage; - -void TrashSound(void) -{ - FCEUI_Sound(0); - if(ppbufsec) - { - IDirectSoundBuffer_Stop(ppbufsec); - IDirectSoundBuffer_Release(ppbufsec); - ppbufsec=0; - } - if(ppbuf) - { - IDirectSoundBuffer_Stop(ppbuf); - IDirectSoundBuffer_Release(ppbuf); - ppbuf=0; - } - if(ppDS) - { - IDirectSound_Release(ppDS); - ppDS=0; - } -} - - - static VOID *feegle[2]; - static DWORD dook[2]; - static DWORD writepos=0,playpos=0,lplaypos=0; -void CheckDStatus(void) -{ - DWORD status; - status=0; - IDirectSoundBuffer_GetStatus(ppbufw, &status); - - if(status&DSBSTATUS_BUFFERLOST) - { - IDirectSoundBuffer_Restore(ppbufw); - } - - if(!(status&DSBSTATUS_PLAYING)) - { - lplaypos=0; - writepos=((soundbufsize)<>8))^128; - } - else - { - for(P=0;P=DSBufferSize) - if(playpos=(playpos+(soundbufsize<>=1; - if(stime>=5) - Sleep(stime); - k=1; - } - } - else if(soundsleep==2) - { - int stime; - stime=writepos-(playpos+(soundbufsize<>=1; - if(stime>=2) - Sleep(stime); - } - } - BlockingCheck(); - if(!soundo || NoWaiting) return; - goto ilicpo; - } - - if(netplaytype && netplayon) - { - if(writepos<=playpos+128) - writepos=playpos+(soundbufsize<>16)) - switch(wParam&0xFFFF) - { - case 1: - gornk: - soundoptions=0; - if(IsDlgButtonChecked(hwndDlg,122)==BST_CHECKED) - soundoptions|=SO_FORCE8BIT; - if(IsDlgButtonChecked(hwndDlg,123)==BST_CHECKED) - soundoptions|=SO_SECONDARY; - if(IsDlgButtonChecked(hwndDlg,124)==BST_CHECKED) - soundoptions|=SO_GFOCUS; - if(IsDlgButtonChecked(hwndDlg,126)==BST_CHECKED) - soundo=1; - else - soundo=0; - x=GetDlgItemInt(hwndDlg,200,0,0); - if(x<8192 || x>65535) - { - FCEUD_PrintError("Sample rate is out of range(8192-65535)."); - break; - } - else - soundrate=x; - - soundvolume=200-SendDlgItemMessage(hwndDlg,500,TBM_GETPOS,0,0); - FCEUI_SetSoundVolume(soundvolume); - soundsleep=SendDlgItemMessage(hwndDlg,129,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); - EndDialog(hwndDlg,0); - break; - } - } - return 0; -} - - -void ConfigSound(void) -{ - int backo=soundo,sr=soundrate; - int so=soundoptions; - - DialogBox(fceu_hInstance,"SOUNDCONFIG",hAppWnd,SoundConCallB); - - if(((backo?1:0)!=(soundo?1:0))) - { - if(!soundo) - TrashSound(); - else - soundo=InitSound(); - } - else if(( soundoptions!=so || (sr!=soundrate)) && soundo) - { - TrashSound(); - soundo=InitSound(); - } - soundbufsize=(soundbuftime*soundrate/1000); -} - - -void StopSound(void) -{ - if(soundo) - IDirectSoundBuffer_Stop(ppbufw); -} - -#include "wave.c"