1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-06 01:10:23 +00:00

Reenable _SNDRAW and _SNDPLAYFILE

This commit is contained in:
Luke Ceddia 2017-08-11 21:19:52 +10:00
parent 237f42799b
commit 8c9390173e
2 changed files with 7 additions and 34 deletions

View file

@ -245,28 +245,15 @@ got_seq:
} }
void sub__sndplayfile(qbs *filename,int32 sync,double volume,int32 passed){ void sub__sndplayfile(qbs *filename, int32 sync, double volume, int32 passed){
if (new_error) return; if (new_error) return;
sndsetup(); sndsetup();
static int32 handle; int32 handle;
static int32 setvolume; handle = func__sndopen(filename, NULL, 0);
static qbs *syncstr=NULL; if (!syncstr) syncstr=qbs_new(0,0); if (!handle) return;
setvolume=0; if (passed & 2) {
if (passed&2){ sub__sndvol(handle, volume);
if ((volume<0)||(volume>1)){error(5); return;}
if (volume!=1) setvolume=1;
} }
if ((!setvolume)&&(!sync)) syncstr->len=0;
if ((setvolume)&&(!sync)) qbs_set(syncstr,qbs_new_txt("VOL"));
if ((!setvolume)&&(sync)) qbs_set(syncstr,qbs_new_txt("SYNC"));
if ((setvolume)&&(sync)) qbs_set(syncstr,qbs_new_txt("SYNC,VOL"));
if (syncstr->len){
handle=func__sndopen(filename,syncstr,1);
}else{
handle=func__sndopen(filename,NULL,0);
}
if (handle==0) return;
if (setvolume) sub__sndvol(handle,volume);
sub__sndplay(handle); sub__sndplay(handle);
sub__sndclose(handle); sub__sndclose(handle);
} }

View file

@ -287,7 +287,6 @@ void snd_init(){
int32 snd_raw_channel=0; int32 snd_raw_channel=0;
int32 func__sndopenraw(){ int32 func__sndopenraw(){
/*
static int32 handle; handle=list_add(snd_handles); static int32 handle; handle=list_add(snd_handles);
static snd_struct *snd; snd=(snd_struct*)list_get(snd_handles,handle); static snd_struct *snd; snd=(snd_struct*)list_get(snd_handles,handle);
snd->internal=0; snd->internal=0;
@ -309,7 +308,6 @@ int32 func__sndopenraw(){
snd->al_buffer_state=(uint8*)calloc(4,1); snd->al_buffer_state=(uint8*)calloc(4,1);
snd->al_buffer_index=(int32*)calloc(4,4); snd->al_buffer_index=(int32*)calloc(4,4);
return handle; return handle;
*/
} }
@ -317,7 +315,6 @@ int32 func__sndopenraw(){
void sub__sndraw(float left,float right,int32 handle,int32 passed){ void sub__sndraw(float left,float right,int32 handle,int32 passed){
/*
if (passed&2){ if (passed&2){
if (handle==0) return;//note: this would be an invalid handle if (handle==0) return;//note: this would be an invalid handle
}else{ }else{
@ -374,7 +371,7 @@ void sub__sndraw(float left,float right,int32 handle,int32 passed){
error: error:
error(5); error(5);
return; return;
*/
} }
void snd_mainloop(){ void snd_mainloop(){
@ -409,15 +406,9 @@ void snd_mainloop(){
}//2 }//2
/*
if (snd->type==1){//RAW if (snd->type==1){//RAW
if (snd->close!=2){ if (snd->close!=2){
if (snd->stream_buffer_start){ if (snd->stream_buffer_start){
static int32 repeat; static int32 repeat;
do{ do{
repeat=0; repeat=0;
@ -577,13 +568,8 @@ gotbuffer:
}//not playing }//not playing
}//time>3 secs }//time>3 secs
}//sndclose==1 }//sndclose==1
}//RAW }//RAW
*/
}//list_index loop }//list_index loop
} }
int32 sndupdate_dont_free_resources=0; int32 sndupdate_dont_free_resources=0;