annotate src/psf2/peops2/xa.c @ 3161:6dd886b5c72b

revive stdio plugin for now. gio cannot write id3 tags.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 13 Jul 2009 23:53:41 +0900
parents 62cc6d667119
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2737
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
1 /***************************************************************************
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
2 xa.c - description
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
3 -------------------
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
4 begin : Wed May 15 2002
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
5 copyright : (C) 2002 by Pete Bernert
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
6 email : BlackDove@addcom.de
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
7 ***************************************************************************/
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
8
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
9 /***************************************************************************
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
10 * *
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify *
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by *
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or *
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
14 * (at your option) any later version. See also the license.txt file for *
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
15 * additional informations. *
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
16 * *
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
17 ***************************************************************************/
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
18
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
19 //*************************************************************************//
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
20 // History of changes:
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
21 //
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
22 // 2003/02/18 - kode54
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
23 // - added gaussian interpolation
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
24 //
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
25 // 2002/05/15 - Pete
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
26 // - generic cleanup for the Peops release
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
27 //
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
28 //*************************************************************************//
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
29
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
30 #include "stdafx.h"
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
31
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
32 #define _IN_XA
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
33
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
34 // will be included from spu.c
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
35 #ifdef _IN_SPU
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
36
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
37 ////////////////////////////////////////////////////////////////////////
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
38 // XA GLOBALS
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
39 ////////////////////////////////////////////////////////////////////////
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
40
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
41 xa_decode_t * xapGlobal=0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
42
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
43 unsigned long * XAFeed = NULL;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
44 unsigned long * XAPlay = NULL;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
45 unsigned long * XAStart = NULL;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
46 unsigned long * XAEnd = NULL;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
47
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
48 unsigned long XARepeat = 0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
49 unsigned long XALastVal = 0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
50
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
51 int iLeftXAVol = 32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
52 int iRightXAVol = 32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
53
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
54 static int gauss_ptr = 0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
55 static int gauss_window[8] = {0, 0, 0, 0, 0, 0, 0, 0};
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
56
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
57 #define gvall0 gauss_window[gauss_ptr]
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
58 #define gvall(x) gauss_window[(gauss_ptr+x)&3]
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
59 #define gvalr0 gauss_window[4+gauss_ptr]
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
60 #define gvalr(x) gauss_window[4+((gauss_ptr+x)&3)]
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
61
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
62 ////////////////////////////////////////////////////////////////////////
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
63 // MIX XA
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
64 ////////////////////////////////////////////////////////////////////////
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
65
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
66 INLINE void MixXA(void)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
67 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
68 int ns;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
69
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
70 for(ns=0;ns<NSSIZE && XAPlay!=XAFeed;ns++)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
71 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
72 XALastVal=*XAPlay++;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
73 if(XAPlay==XAEnd) XAPlay=XAStart;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
74 SSumL[ns]+=(((short)(XALastVal&0xffff)) * iLeftXAVol)/32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
75 SSumR[ns]+=(((short)((XALastVal>>16)&0xffff)) * iRightXAVol)/32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
76 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
77
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
78 if(XAPlay==XAFeed && XARepeat)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
79 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
80 XARepeat--;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
81 for(;ns<NSSIZE;ns++)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
82 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
83 SSumL[ns]+=(((short)(XALastVal&0xffff)) * iLeftXAVol)/32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
84 SSumR[ns]+=(((short)((XALastVal>>16)&0xffff)) * iRightXAVol)/32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
85 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
86 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
87 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
88
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
89 ////////////////////////////////////////////////////////////////////////
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
90 // FEED XA
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
91 ////////////////////////////////////////////////////////////////////////
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
92
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
93 INLINE void FeedXA(xa_decode_t *xap)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
94 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
95 int sinc,spos,i,iSize,iPlace,vl,vr;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
96
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
97 if(!bSPUIsOpen) return;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
98
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
99 xapGlobal = xap; // store info for save states
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
100 XARepeat = 100; // set up repeat
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
101
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
102 iSize=((44100*xap->nsamples)/xap->freq); // get size
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
103 if(!iSize) return; // none? bye
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
104
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
105 if(XAFeed<XAPlay) iPlace=XAPlay-XAFeed; // how much space in my buf?
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
106 else iPlace=(XAEnd-XAFeed) + (XAPlay-XAStart);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
107
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
108 if(iPlace==0) return; // no place at all
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
109
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
110 //----------------------------------------------------//
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
111 if(iXAPitch) // pitch change option?
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
112 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
113 static DWORD dwLT=0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
114 static DWORD dwFPS=0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
115 static int iFPSCnt=0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
116 static int iLastSize=0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
117 static DWORD dwL1=0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
118 DWORD dw=timeGetTime(),dw1,dw2;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
119
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
120 iPlace=iSize;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
121
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
122 dwFPS+=dw-dwLT;iFPSCnt++;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
123
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
124 dwLT=dw;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
125
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
126 if(iFPSCnt>=10)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
127 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
128 if(!dwFPS) dwFPS=1;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
129 dw1=1000000/dwFPS;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
130 if(dw1>=(dwL1-100) && dw1<=(dwL1+100)) dw1=dwL1;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
131 else dwL1=dw1;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
132 dw2=(xap->freq*100/xap->nsamples);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
133 if((!dw1)||((dw2+100)>=dw1)) iLastSize=0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
134 else
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
135 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
136 iLastSize=iSize*dw2/dw1;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
137 if(iLastSize>iPlace) iLastSize=iPlace;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
138 iSize=iLastSize;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
139 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
140 iFPSCnt=0;dwFPS=0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
141 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
142 else
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
143 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
144 if(iLastSize) iSize=iLastSize;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
145 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
146 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
147 //----------------------------------------------------//
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
148
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
149 spos=0x10000L;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
150 sinc = (xap->nsamples << 16) / iSize; // calc freq by num / size
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
151
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
152 if(xap->stereo)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
153 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
154 unsigned long * pS=(unsigned long *)xap->pcm;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
155 unsigned long l=0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
156
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
157 if(iXAPitch)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
158 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
159 long l1,l2;short s;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
160 for(i=0;i<iSize;i++)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
161 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
162 if(iUseInterpolation==2)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
163 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
164 while(spos>=0x10000L)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
165 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
166 l = *pS++;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
167 gauss_window[gauss_ptr] = (short)LOWORD(l);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
168 gauss_window[4+gauss_ptr] = (short)HIWORD(l);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
169 gauss_ptr = (gauss_ptr+1) & 3;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
170 spos -= 0x10000L;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
171 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
172 vl = (spos >> 6) & ~3;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
173 vr=(gauss[vl]*gvall0)&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
174 vr+=(gauss[vl+1]*gvall(1))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
175 vr+=(gauss[vl+2]*gvall(2))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
176 vr+=(gauss[vl+3]*gvall(3))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
177 l= (vr >> 11) & 0xffff;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
178 vr=(gauss[vl]*gvalr0)&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
179 vr+=(gauss[vl+1]*gvalr(1))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
180 vr+=(gauss[vl+2]*gvalr(2))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
181 vr+=(gauss[vl+3]*gvalr(3))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
182 l |= vr << 5;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
183 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
184 else
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
185 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
186 while(spos>=0x10000L)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
187 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
188 l = *pS++;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
189 spos -= 0x10000L;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
190 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
191 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
192
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
193 s=(short)LOWORD(l);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
194 l1=s;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
195 l1=(l1*iPlace)/iSize;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
196 if(l1<-32767) l1=-32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
197 if(l1> 32767) l1=32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
198 s=(short)HIWORD(l);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
199 l2=s;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
200 l2=(l2*iPlace)/iSize;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
201 if(l2<-32767) l2=-32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
202 if(l2> 32767) l2=32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
203 l=(l1&0xffff)|(l2<<16);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
204
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
205 *XAFeed++=l;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
206
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
207 if(XAFeed==XAEnd) XAFeed=XAStart;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
208 if(XAFeed==XAPlay)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
209 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
210 if(XAPlay!=XAStart) XAFeed=XAPlay-1;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
211 break;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
212 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
213
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
214 spos += sinc;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
215 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
216 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
217 else
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
218 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
219 for(i=0;i<iSize;i++)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
220 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
221 if(iUseInterpolation==2)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
222 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
223 while(spos>=0x10000L)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
224 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
225 l = *pS++;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
226 gauss_window[gauss_ptr] = (short)LOWORD(l);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
227 gauss_window[4+gauss_ptr] = (short)HIWORD(l);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
228 gauss_ptr = (gauss_ptr+1) & 3;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
229 spos -= 0x10000L;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
230 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
231 vl = (spos >> 6) & ~3;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
232 vr=(gauss[vl]*gvall0)&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
233 vr+=(gauss[vl+1]*gvall(1))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
234 vr+=(gauss[vl+2]*gvall(2))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
235 vr+=(gauss[vl+3]*gvall(3))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
236 l= (vr >> 11) & 0xffff;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
237 vr=(gauss[vl]*gvalr0)&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
238 vr+=(gauss[vl+1]*gvalr(1))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
239 vr+=(gauss[vl+2]*gvalr(2))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
240 vr+=(gauss[vl+3]*gvalr(3))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
241 l |= vr << 5;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
242 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
243 else
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
244 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
245 while(spos>=0x10000L)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
246 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
247 l = *pS++;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
248 spos -= 0x10000L;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
249 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
250 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
251
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
252 *XAFeed++=l;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
253
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
254 if(XAFeed==XAEnd) XAFeed=XAStart;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
255 if(XAFeed==XAPlay)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
256 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
257 if(XAPlay!=XAStart) XAFeed=XAPlay-1;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
258 break;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
259 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
260
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
261 spos += sinc;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
262 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
263 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
264 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
265 else
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
266 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
267 unsigned short * pS=(unsigned short *)xap->pcm;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
268 unsigned long l;short s=0;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
269
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
270 if(iXAPitch)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
271 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
272 long l1;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
273 for(i=0;i<iSize;i++)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
274 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
275 if(iUseInterpolation==2)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
276 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
277 while(spos>=0x10000L)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
278 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
279 gauss_window[gauss_ptr] = (short)*pS++;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
280 gauss_ptr = (gauss_ptr+1) & 3;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
281 spos -= 0x10000L;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
282 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
283 vl = (spos >> 6) & ~3;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
284 vr=(gauss[vl]*gvall0)&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
285 vr+=(gauss[vl+1]*gvall(1))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
286 vr+=(gauss[vl+2]*gvall(2))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
287 vr+=(gauss[vl+3]*gvall(3))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
288 l1=s= vr >> 11;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
289 l1 &= 0xffff;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
290 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
291 else
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
292 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
293 while(spos>=0x10000L)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
294 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
295 s = *pS++;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
296 spos -= 0x10000L;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
297 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
298 l1=s;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
299 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
300
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
301 l1=(l1*iPlace)/iSize;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
302 if(l1<-32767) l1=-32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
303 if(l1> 32767) l1=32767;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
304 l=(l1&0xffff)|(l1<<16);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
305 *XAFeed++=l;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
306
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
307 if(XAFeed==XAEnd) XAFeed=XAStart;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
308 if(XAFeed==XAPlay)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
309 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
310 if(XAPlay!=XAStart) XAFeed=XAPlay-1;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
311 break;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
312 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
313
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
314 spos += sinc;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
315 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
316 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
317 else
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
318 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
319 for(i=0;i<iSize;i++)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
320 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
321 if(iUseInterpolation==2)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
322 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
323 while(spos>=0x10000L)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
324 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
325 gauss_window[gauss_ptr] = (short)*pS++;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
326 gauss_ptr = (gauss_ptr+1) & 3;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
327 spos -= 0x10000L;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
328 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
329 vl = (spos >> 6) & ~3;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
330 vr=(gauss[vl]*gvall0)&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
331 vr+=(gauss[vl+1]*gvall(1))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
332 vr+=(gauss[vl+2]*gvall(2))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
333 vr+=(gauss[vl+3]*gvall(3))&~2047;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
334 l=s= vr >> 11;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
335 l &= 0xffff;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
336 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
337 else
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
338 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
339 while(spos>=0x10000L)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
340 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
341 s = *pS++;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
342 spos -= 0x10000L;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
343 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
344 l=s;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
345 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
346
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
347 *XAFeed++=(l|(l<<16));
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
348
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
349 if(XAFeed==XAEnd) XAFeed=XAStart;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
350 if(XAFeed==XAPlay)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
351 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
352 if(XAPlay!=XAStart) XAFeed=XAPlay-1;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
353 break;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
354 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
355
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
356 spos += sinc;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
357 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
358 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
359 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
360 }
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
361
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
362 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
363