This commit is contained in:
dborth 2009-05-11 23:28:41 +00:00
parent 8ec019280a
commit 566f849b1d
2 changed files with 11 additions and 9 deletions

View File

@ -18,7 +18,7 @@
/* $Id: mixer.cpp,v 1.53 2009/04/28 21:48:24 harekiet Exp $ */ /* $Id: mixer.cpp,v 1.53 2009/04/28 21:48:24 harekiet Exp $ */
/* /*
Remove the sdl code from here and have it handeld in the sdlmain. Remove the sdl code from here and have it handeld in the sdlmain.
That should call the mixer start from there or something. That should call the mixer start from there or something.
*/ */
@ -265,7 +265,7 @@ thestart:
void MixerChannel::AddStretched(Bitu len,Bit16s * data) { void MixerChannel::AddStretched(Bitu len,Bit16s * data) {
if (done>=needed) { if (done>=needed) {
LOG_MSG("Can't add, buffer full"); LOG_MSG("Can't add, buffer full");
return; return;
} }
Bitu outlen=needed-done;Bits diff; Bitu outlen=needed-done;Bits diff;
@ -353,7 +353,7 @@ void MixerChannel::FillUp(void) {
extern bool ticksLocked; extern bool ticksLocked;
static inline bool Mixer_irq_important(void) { static inline bool Mixer_irq_important(void) {
/* In some states correct timing of the irqs is more important then /* In some states correct timing of the irqs is more important then
* non stuttering audo */ * non stuttering audo */
return (ticksLocked || (CaptureState & (CAPTURE_WAVE|CAPTURE_VIDEO))); return (ticksLocked || (CaptureState & (CAPTURE_WAVE|CAPTURE_VIDEO)));
} }
@ -368,7 +368,7 @@ static void MIXER_MixData(Bitu needed) {
if (CaptureState & (CAPTURE_WAVE|CAPTURE_VIDEO)) { if (CaptureState & (CAPTURE_WAVE|CAPTURE_VIDEO)) {
Bit16s convert[1024][2]; Bit16s convert[1024][2];
Bitu added=needed-mixer.done; Bitu added=needed-mixer.done;
if (added>1024) if (added>1024)
added=1024; added=1024;
Bitu readpos=(mixer.pos+mixer.done)&MIXER_BUFMASK; Bitu readpos=(mixer.pos+mixer.done)&MIXER_BUFMASK;
for (Bitu i=0;i<added;i++) { for (Bitu i=0;i<added;i++) {
@ -469,7 +469,7 @@ static void MIXER_CallBack(void * userdata, Uint8 *stream, int len) {
// LOG_MSG("overflow run need %d, have %d, min %d", need, mixer.done, mixer.min_needed); // LOG_MSG("overflow run need %d, have %d, min %d", need, mixer.done, mixer.min_needed);
if (mixer.done > MIXER_BUFSIZE) if (mixer.done > MIXER_BUFSIZE)
index_add = MIXER_BUFSIZE - 2*mixer.min_needed; index_add = MIXER_BUFSIZE - 2*mixer.min_needed;
else else
index_add = mixer.done - 2*mixer.min_needed; index_add = mixer.done - 2*mixer.min_needed;
index_add = (index_add << MIXER_SHIFT) / need; index_add = (index_add << MIXER_SHIFT) / need;
reduce = mixer.done - 2* mixer.min_needed; reduce = mixer.done - 2* mixer.min_needed;
@ -480,7 +480,7 @@ static void MIXER_CallBack(void * userdata, Uint8 *stream, int len) {
if (chan->done>reduce) chan->done-=reduce; if (chan->done>reduce) chan->done-=reduce;
else chan->done=0; else chan->done=0;
} }
// Reset mixer.tick_add when irqs are important // Reset mixer.tick_add when irqs are important
if( Mixer_irq_important() ) if( Mixer_irq_important() )
mixer.tick_add=(mixer.freq<< MIXER_SHIFT)/1000; mixer.tick_add=(mixer.freq<< MIXER_SHIFT)/1000;
@ -570,7 +570,7 @@ public:
chan=mixer.channels; chan=mixer.channels;
WriteOut("Channel Main Main(dB)\n"); WriteOut("Channel Main Main(dB)\n");
ShowVolume("MASTER",mixer.mastervol[0],mixer.mastervol[1]); ShowVolume("MASTER",mixer.mastervol[0],mixer.mastervol[1]);
for (chan=mixer.channels;chan;chan=chan->next) for (chan=mixer.channels;chan;chan=chan->next)
ShowVolume(chan->name,chan->volmain[0],chan->volmain[1]); ShowVolume(chan->name,chan->volmain[0],chan->volmain[1]);
} }
private: private:
@ -583,7 +583,7 @@ private:
void ListMidi(){ void ListMidi(){
#if defined (WIN32) #if defined (WIN32)
unsigned int total = midiOutGetNumDevs(); unsigned int total = midiOutGetNumDevs();
for(unsigned int i=0;i<total;i++) { for(unsigned int i=0;i<total;i++) {
MIDIOUTCAPS mididev; MIDIOUTCAPS mididev;
midiOutGetDevCaps(i, &mididev, sizeof(MIDIOUTCAPS)); midiOutGetDevCaps(i, &mididev, sizeof(MIDIOUTCAPS));
@ -641,6 +641,8 @@ void MIXER_Init(Section* sec) {
spec.freq=mixer.freq; spec.freq=mixer.freq;
#ifdef HW_RVL #ifdef HW_RVL
spec.format=AUDIO_S16MSB; spec.format=AUDIO_S16MSB;
#else
spec.format=AUDIO_S16SYS;
#endif #endif
spec.channels=2; spec.channels=2;
spec.callback=MIXER_CallBack; spec.callback=MIXER_CallBack;

View File

@ -1,6 +1,6 @@
#ifndef WIIHARDWARE_H #ifndef WIIHARDWARE_H
#define WIIHARDWARE_H #define WIIHARDWARE_H
#include <wiiuse/WPAD.h> #include <wiiuse/wpad.h>
void WiiInit(); void WiiInit();
void WiiFinished(); void WiiFinished();