public void OpenMixer()
{
- HMIXER mixerHandle;
WAVEFORMATEX waveFormat = { 0 };
waveFormat.nSamplesPerSec = 44100; //(cur_stream && cur_stream->audio_st && cur_stream->audio_st->codec) ? cur_stream->audio_st->codec->sample_rate : 44100;
waveFormat.wBitsPerSample = 16;
waveFormat.nAvgBytesPerSec = waveFormat.nBlockAlign * waveFormat.nSamplesPerSec;
waveOutOpen(&hWaveOut, WAVE_MAPPER, &waveFormat, 0, 0, CALLBACK_NULL);
- mixerOpen((HMIXER *)&hmx, (uint)hWaveOut, 0, 0, MIXER_OBJECTF_HWAVEOUT);
+ mixerOpen((HMIXER *)&hmx, (uint)(uintptr)hWaveOut, 0, 0, MIXER_OBJECTF_HWAVEOUT);
}
public void CloseMixer()
result.size = dwNotifySize * NUM_PLAY_NOTIFICATIONS;
g_pSoundManager.InitStreaming(&streamingSound, NUM_PLAY_NOTIFICATIONS, dwNotifySize, dSoundThread.g_hNotificationEvent,
- wanted.callback, wanted.userdata, wanted.channels, wanted.freq, wanted.bits);
+ (void *)wanted.callback, wanted.userdata, wanted.channels, wanted.freq, wanted.bits);
if(streamingSound)
{
streamingSound.volume = wanted.volume;
static bool PlayBuffer( bool bLooped )
{
- void * pDSB;
+ //void * pDSB;
if(!streamingSound)
return false;
if(streamingSound.Reset())
return false;
- pDSB = streamingSound.GetBuffer( 0 );
+ //pDSB = streamingSound.GetBuffer( 0 );
SetEvent(dSoundThread.g_hNotificationEvent);
return true;
int RestoreBuffer( IDirectSoundBuffer * pDSB, bool* pbWasRestored )
{
int hr;
- uint dwStatus;
+ DWORD dwStatus;
if( pDSB == null )
return CO_E_NOTINITIALIZED;
{
if( apDSBuffer[i] )
{
- uint dwStatus = 0;
+ DWORD dwStatus = 0;
IDirectSoundBuffer_GetStatus(apDSBuffer[i], &dwStatus );
if ( ( dwStatus & DSBSTATUS_PLAYING ) == 0 )
break;
return result;
}
+ /*
int Stop()
{
int hr = 0;
return hr;
}
+ */
bool HandleWaveStreamNotification( )
{
- uint dwCurrentPlayPos;
- uint dwPlayDelta;
- uint dwBytesWrittenToBuffer;
+ DWORD dwCurrentPlayPos;
void * pDSLockedBuffer = null;
void * pDSLockedBuffer2 = null;
- uint dwDSLockedBufferSize;
- uint dwDSLockedBufferSize2;
+ DWORD dwDSLockedBufferSize;
+ DWORD dwDSLockedBufferSize2;
uint playCursor, writeCursor;
- bool bRestored;
uint start, size;
-
- static uint cursor;
bool written = true;
int c;
+
while(written)
{
written = false;
int Reset()
{
- int hr;
bool bRestored;
int result;
int FillBufferWithSound( IDirectSoundBuffer * pDSB, bool bRepeatWavIfBufferLarger )
{
- int hr;
- void* pDSLockedBuffer = null; // Pointer to locked buffer memory
- uint dwDSLockedBufferSize = 0; // Size of the locked DirectSound buffer
- uint dwWavDataRead = 0; // Amount of data read from the wav file
+ void * pDSLockedBuffer = null; // Pointer to locked buffer memory
+ DWORD dwDSLockedBufferSize = 0; // Size of the locked DirectSound buffer
if( pDSB == null )
return CO_E_NOTINITIALIZED;
callback(data, pDSLockedBuffer, dwDSLockedBufferSize);
- dwWavDataRead = dwDSLockedBufferSize;
-
- printf("Filling 16 spots\n");
+ // printf("Filling 16 spots\n");
IDirectSoundBuffer_Unlock(pDSB, pDSLockedBuffer, dwDSLockedBufferSize, null, 0 );
//dwNextWriteOffset = dwNotifySize*2;
bool InitStreaming(StreamingSound * ppStreamingSound, uint dwNotifyCount, uint dwNotifySize, void * hNotifyEvent,
void (*callback)(void * data, void * buffer, int len), void * data, int nChannels, int freq,int bits)
{
- int hr;
IDirectSoundBuffer * pDSBuffer = null;
uint dwDSBufferSize = 0;
DSBPOSITIONNOTIFY * aPosNotify = null;