Page 1 of 1

sound card sampling speed

Posted: Sun Mar 06, 2005 5:35 pm
by chippy73
I need to change ie read and write the sound card sampling rate.

I am sure there is an API for it but for the life of me I can't find it!

Any help welcomed.

Alan

Posted: Mon Mar 07, 2005 8:16 pm
by eriansa
ASIO?

Posted: Tue Mar 08, 2005 7:51 am
by chippy73
What's ASIO?

Did a search on win32,hlp and it didn't find any reference to it.

Alan

Posted: Wed Mar 23, 2005 10:12 am
by chippy73
Here is how I solved the problem of changing the sampling speed of the soundcard.

Code: Select all

OpenLibrary(1,"winmm.dll")
Structure WAVEFORMATEX 
  wFormatTag.w 
  nChannels.w 
  nSamplesPerSec.l 
  nAvgBytesPerSec.l 
  nBlockAlign.w 
  wBitsPerSample.w 
  cbSize.w 
EndStructure 

Global waveheader1.WAVEHDR
Global waveform.WAVEFORMATEX

Procedure changesample(sample$)
waveform\wFormatTag = #WAVE_FORMAT_PCM
waveform\nChannels = 1
waveform\nSamplesPerSec = Val(sample$)
waveform\wBitsPerSample = 8
waveform\nBlockAlign = waveform\nChannels * waveform\wBitsPerSample / 8
waveform\nAvgBytesPerSec = waveform\nSamplesPerSec * waveform\nBlockAlign
waveform\cbSize=0
   
dwRet.l=CallFunction(1,"waveInOpen",@wavehandle, #WAVE_MAPPER, @waveform,0,0,0)
EndProcedure
Hope it is useful.

Alan

Posted: Wed Mar 23, 2005 1:18 pm
by DoubleDutch
Is there something i'm missing here...

What library did you open...

:?:

Anthony

Posted: Wed Mar 23, 2005 4:04 pm
by chippy73
Ooops!!

Doubledutch, I forgot to include the library to open is winmm.dll
I've edited the code above now.

Sorry about that.

Alan