sound card sampling speed

Windows specific forum
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

sound card sampling speed

Post 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
PB v3.94 PVXP v2.13 JaPBe v2.5.4.22
eriansa
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Mar 17, 2004 12:31 am
Contact:

Post by eriansa »

ASIO?
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

Post by chippy73 »

What's ASIO?

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

Alan
PB v3.94 PVXP v2.13 JaPBe v2.5.4.22
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

Post 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
Last edited by chippy73 on Wed Mar 23, 2005 4:32 pm, edited 1 time in total.
PB v3.94 PVXP v2.13 JaPBe v2.5.4.22
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Is there something i'm missing here...

What library did you open...

:?:

Anthony
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

Post 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
PB v3.94 PVXP v2.13 JaPBe v2.5.4.22
Post Reply