audio level detection

Closed Thread

Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: audio level detection

 
0
  #31
Feb 22nd, 2006
http://www.daniweb.com/tutorials/forum68.html, there should be a button on the bottom for contribute tutorial (the link is for VB Specifically).
Quick reply to this message  
Join Date: Dec 2005
Posts: 7
Reputation: soorya is an unknown quantity at this point 
Solved Threads: 0
soorya soorya is offline Offline
Newbie Poster

Re: audio level detection

 
0
  #32
Feb 22nd, 2006
Thanks again AlanC,
I have got a sample to do this from ...

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 'Public Function SelectMicrophone(DeviceID As Long, Optional sError As String) As Boolean
  2. ' Dim pmxl As MIXERLINE, pmxlc As MIXERLINECONTROLS, pmxc As MIXERCONTROL, pmxcd As MIXERCONTROLDETAILS, mcdlt() As MIXERCONTROLDETAILS_LISTTEXT, mcdb() As Long
  3. ' Dim rc As Long, Index As Long
  4. ' On Error GoTo Exception
  5. ' 'Get WaveIn Destination Line ID
  6. ' Let pmxl.cbStruct = Len(pmxl)
  7. ' Let pmxl.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_WAVEIN
  8. ' Let rc = mixerGetLineInfo(DeviceID, pmxl, MIXER_GETLINEINFOF_COMPONENTTYPE)
  9. ' If rc <> 0 Then GoTo Exception 'Error Trap
  10. '
  11. ' 'Get Control ID with MIXER
  12. ' Let pmxlc.cbStruct = Len(pmxlc)
  13. ' Let pmxlc.dwLineID = pmxl.dwLineID
  14. ' Let pmxlc.dwControl = MIXERCONTROL_CONTROLTYPE_MIXER
  15. ' Let pmxlc.cControls = pmxl.cControls
  16. ' Let pmxlc.cbmxctrl = Len(pmxc)
  17. ' Let pmxlc.pamxctrl = VarPtr(pmxc)
  18. ' Let rc = mixerGetLineControls(DeviceID, pmxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE)
  19. '
  20. ' If rc <> 0 Then
  21. ' 'Get Control ID
  22. ' Let pmxlc.dwControl = MIXERCONTROL_CONTROLTYPE_MUX
  23. ' Let rc = mixerGetLineControls(DeviceID, pmxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE)
  24. ' If rc <> 0 Then GoTo Exception 'Error Trap
  25. ' End If
  26. '
  27. ' 'Get Control Details
  28. ' ReDim mcdlt(pmxc.cMultipleItems - 1)
  29. ' Let pmxcd.cbStruct = Len(pmxcd)
  30. ' Let pmxcd.cChannels = 1
  31. ' Let pmxcd.dwControlID = pmxc.dwControlID
  32. ' Let pmxcd.item = pmxc.cMultipleItems
  33. ' Let pmxcd.cbDetails = Len(mcdlt(0))
  34. ' Let pmxcd.paDetails = VarPtr(mcdlt(0))
  35. ' Let rc = mixerGetControlDetails(DeviceID, pmxcd, MIXER_GETCONTROLDETAILSF_LISTTEXT)
  36. ' If rc <> 0 Then GoTo Exception 'Error Trap
  37. '
  38. ' For Index = LBound(mcdlt) To UBound(mcdlt)
  39. ' pmxl.dwLineID = mcdlt(Index).dwParam1
  40. ' Let rc = mixerGetLineInfo(DeviceID, pmxl, MIXER_GETLINEINFOF_LINEID)
  41. ' If rc <> 0 Then GoTo Exception 'Error Trap
  42. ' If pmxl.dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE Then
  43. ' Exit For
  44. ' End If
  45. ' Next
  46. '
  47. ' If Index > UBound(mcdlt) Then GoTo Exception
  48. ' 'Get Control Values
  49. ' ReDim mcdb(pmxc.cMultipleItems - 1)
  50. ' Let pmxcd.cbDetails = Len(mcdb(0))
  51. ' Let pmxcd.paDetails = VarPtr(mcdb(0))
  52. ' Let mcdb(Index) = 1
  53. ' Let rc = mixerSetControlDetails(DeviceID, pmxcd, MIXER_SETCONTROLDETAILSF_VALUE)
  54. ' If rc <> 0 Then GoTo Exception 'Error Trap
  55. ' Let SelectMicrophone = True
  56. ' Exit Function
  57. 'Exception:
  58. 'End Function

but when ever i execute this function, i get fatal error, while closing the main application.

I thing some memory free issue...
can u pls. help me?

soorya

Originally Posted by AlanC
Hi Soorya

This thread just lives on and on!

This is maybe possible but its difficult to do. I've been able to programmatically adjust the master volume but not much else. The fundamental issue is that there is a lot of variation between sound cards. To give you an idea of this, you can have a one-of-n selection switch for record source (e.g Soundblaster) or multiple selections (e.g. ESS chipsets); and the 'Stereo Mix' line you refer to can be called different things or may not exist at all.

Practically, the Win32 API allows you to enumerate the lines and controls in the recording mixer and you have then to make a decision about what you want to do. This will, I believe, be different from one card to another.

I've got a lot on at the moment but I'll have a look at some point.

I did make a start on my audio tutorial but this is a huge task too. I need to ask the moderators what I need to do to to post it up on DaniWeb- I'm sure it'd get loads of hits.

Best regards,
AlanC
Last edited by Comatose; Feb 22nd, 2006 at 2:34 pm. Reason: Code Tags
Quick reply to this message  
Join Date: Jun 2006
Posts: 1
Reputation: sirWest is an unknown quantity at this point 
Solved Threads: 0
sirWest sirWest is offline Offline
Newbie Poster

Re: audio level detection

 
0
  #33
Jun 18th, 2006
Does this thread live on? i could really need the double buffer version also... please could you send it to my e-mail westman@hot.ee would really apreciate it!!! thanx!!
Quick reply to this message  
Closed Thread

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC