Ignore:
Timestamp:
Apr 30, 2001, 11:08:00 PM (24 years ago)
Author:
sandervl
Message:

DirectAudio interface updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sbliveos2/trunk/drv16/wavestrm.cpp

    r168 r178  
    2525#include <os2me.h>
    2626#include <audio.h>                // for #define MIDI
     27#include <include.h>
    2728
    2829#include "wavestrm.hpp"
     
    154155// if this is a write stream call _vFillAudioBuf
    155156//
    156 void WAVESTREAM::AddBuffers(void)
     157#pragma off (unreferenced)
     158void WAVESTREAM::AddBuffers(BOOL fFirst)
     159#pragma on (unreferenced)
    157160{
    158161 ULONG space, byteswritten;
     
    303306                ReturnBuffer();
    304307        }
    305         AddBuffers();
     308        AddBuffers(FALSE);
    306309        break;
    307310   }
     
    316319}
    317320
    318 ULONG WAVESTREAM::Write(PSTREAMBUF pbuf, ULONG uLength)
     321#pragma off (unreferenced)
     322ULONG WAVESTREAM::Write(PSTREAMBUF pbuf, ULONG uLength, BOOL fLooping)
     323#pragma on (unreferenced)
    319324{
    320325 PSTREAMBUFFER pStreamBuf = new STREAMBUFFER(uLength, pbuf);
     
    330335        fUnderrun = FALSE;
    331336        OSS16_StreamReset(this);
    332         AddBuffers();
     337        AddBuffers(TRUE);
    333338        if(ulStreamType == STREAM_WAVE_PLAY)
    334339                OSS16_SetWaveOutVol(this, volume);
     
    399404}
    400405
     406ULONG WAVESTREAM::GetCurrentWritePos(void)
     407{
     408   ULONG writepos = 0;
     409
     410   cli();
     411   PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhDone.Tail();
     412
     413   if(!pTemp) {
     414       pTemp = (PSTREAMBUFFER)qhInProcess.Head();
     415   }
     416   if(pTemp) {
     417       writepos = pTemp->ulBuffpos;
     418   }
     419   sti();
     420   return writepos;
     421}
     422
    401423//
    402424// SetCurrentTime
     
    415437{
    416438 PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhInProcess.Head();
    417  ULONG fragsize;
    418439
    419440   // configure the wave device
     
    445466   //Adding the first buffer also starts playback
    446467   if(ulStreamType == STREAM_WAVE_PLAY) {
    447         AddBuffers();
     468        AddBuffers(TRUE);
    448469   }
    449470   else {
     
    464485
    465486}
     487
    466488ULONG  WAVESTREAM::StopStream(PCONTROL_PARM pControl)
    467489{
     
    521543   ulStreamState = STREAM_STREAMING;
    522544   //Adding the first buffer also starts playback
    523    AddBuffers();
     545   AddBuffers(TRUE);
    524546
    525547   return NO_ERROR;
     
    527549}
    528550
    529 void WAVESTREAM::SetInputSrc(int src)
    530 {
    531    inputsrc = src;
    532 }
    533 
    534 void WAVESTREAM::SetInputGain(ULONG gain)
    535 {
    536    inputgain = gain;
    537 }
    538 
    539 void WAVESTREAM::SetVolume(ULONG volume)
    540 {
    541    this->volume = volume;
    542    if(ulStreamState == STREAM_STREAMING && ulStreamType == STREAM_WAVE_PLAY) {
    543         OSS16_SetWaveOutVol(this, volume);
     551
     552BOOL WAVESTREAM::SetProperty(int type, ULONG value, ULONG reserved)
     553{
     554   switch(type) {
     555   case PROPERTY_VOLUME:
     556       volume = value;
     557       if(ulStreamState == STREAM_STREAMING && ulStreamType == STREAM_WAVE_PLAY) {
     558           OSS16_SetWaveOutVol(this, volume);
     559       }
     560       break;
     561
     562   case PROPERTY_INPUTSRC:
     563       inputsrc = value;
     564       break;
     565
     566   case PROPERTY_INPUTGAIN:
     567       inputgain = value;
     568       break;
     569
     570   default:
     571       return STREAM::SetProperty(type, value, reserved);
     572
     573   }
     574   return TRUE;
     575}
     576
     577ULONG WAVESTREAM::GetProperty(int type)
     578{
     579   switch(type) {
     580   case PROPERTY_FREQUENCY:
     581       return _configinfo.ulSampleRate;
     582
     583   case PROPERTY_INPUTSRC:
     584       return inputsrc;
     585
     586   case PROPERTY_INPUTGAIN:
     587       return inputgain;
     588
     589   default:
     590       return STREAM::GetProperty(type);
    544591   }
    545592}
Note: See TracChangeset for help on using the changeset viewer.