Hello PB-World,
How to get the momentary frequency from actualy bit of a playing MCI-Audio?
frequency of actualy playing MCI-Audio
- Hroudtwolf
- Addict
- Posts: 803
- Joined: Sat Feb 12, 2005 3:35 am
- Location: Germany(Hessen)
- Contact:
Re: frequency of actualy playing MCI-Audio
To determine the actual frequency components of a signal, you'd have to
FFT the raw buffer data. AFAIK you have no kind of direct buffer access via
MCI so to put it shortly: You can't!
FFT the raw buffer data. AFAIK you have no kind of direct buffer access via
MCI so to put it shortly: You can't!
Good programmers don't comment their code. It was hard to write, should be hard to read.
- Hroudtwolf
- Addict
- Posts: 803
- Joined: Sat Feb 12, 2005 3:35 am
- Location: Germany(Hessen)
- Contact:
I don't know of any tutorials, however programming DirectX in PB is the
same as doing it in C. Just study the SDK and you're ready to go!
Here's a small example (DirectShow) that should give you the idea:
same as doing it in C. Just study the SDK and you're ready to go!
Here's a small example (DirectShow) that should give you the idea:
Code: Select all
;
;
;
; Minimal DirectShow Example for Hroudtwolf by (:t)raumatic! :)
;
;
;
#CLSCTX_INPROC_SERVER = $1
#FILENAME = "YourAudioFile.EXT"
;
Procedure.l L(string.s)
*out = AllocateMemory(Len(string)*2 * #SIZEOF_WORD)
MultiByteToWideChar_(#CP_ACP, 0, string, -1, *out, Len(string))
ProcedureReturn *out
EndProcedure
;
;
;
CoInitialize_(#NULL)
If CoCreateInstance_(?CLSID_FilterGraph, #NULL, #CLSCTX_INPROC_SERVER, ?IID_IGraphBuilder, @pGB.IGraphBuilder) = #S_OK
If pGB\QueryInterface(?IID_IMediaControl, @pMC.IMediaControl) <> #S_OK
Debug "QueryInterface() for IMediaControl failed"
EndIf
;
; build the graph
;
If pGB\RenderFile(L(#FILENAME), #NULL) = #S_OK
; run the graph to play the media file
pMC\Run()
MessageRequester("Minimal DirectShow Example", "playing...")
Else
; file not found or unsupported
MessageRequester("Minimal DirectShow Example", "oops... something went wrong")
EndIf
EndIf
;
; cleanup
;
If pGB : pGB\Release() : pGB = #NULL : EndIf
If pMC : pMC\Release() : pMC = #NULL : EndIf
CoUninitialize_()
End
DataSection:
CLSID_FilterGraph:
Data.l $E436EBB3
Data.w $524F, $11CE
Data.b $9F, $53, $00, $20, $AF, $0B, $A7, $70
IID_IGraphBuilder:
Data.l $56A868A9
Data.w $0AD4, $11CE
Data.b $B0, $3A, $00, $20, $AF, $0B, $A7, $70
IID_IMediaControl:
Data.l $56A868B1
Data.w $0AD4, $11CE
Data.b $B0, $3A, $00, $20, $AF, $0B, $A7, $70
EndDataSection
Good programmers don't comment their code. It was hard to write, should be hard to read.
- Hroudtwolf
- Addict
- Posts: 803
- Joined: Sat Feb 12, 2005 3:35 am
- Location: Germany(Hessen)
- Contact: