Re: VB6 RC5-CoreAudio-Demo
Much appreciated, Olaf. Checking it out now...
Re: VB6 RC5-CoreAudio-Demo
Is there a way to control the other app volumes, rather than just the current app ? I've had a look but can fathom it out or see any documentation.thank you.
1 Attachment(s)
Re: VB6 RC5-CoreAudio-Demo
When I tested the RC5-CoreAudio-Demo on Win10, everything was OK. But when I tested it on XP, there was an error message: Couldn't create DeviceEnumerator
Re: VB6 RC5-CoreAudio-Demo
CoreAudio is only available on Vista and upwards...
Re: VB6 RC5-CoreAudio-Demo
Quote:
Originally Posted by
ColinE66
CoreAudio is only available on Vista and upwards...
Oh, thank you for your reminder. I was so blind that I didn't see Olaf's instructions.
Re: VB6 RC5-CoreAudio-Demo
Hi Olaf,
I tried to open a large mp3 file (8M) in the example of "VB6 RC5-CoreAudio-Demo", the program popped up an error message: Run-time error '6': Overflow
Code:
Public Property Get FrameIdxCurrent() As Double
If ARC Is Nothing Then Exit Property
FrameIdxCurrent = (FrameIdxToCopyFrom - ARC.CalcFrameCountAheadOfClientSrc + 1000 * 1# * FramesTotal) Mod FramesTotal
End Property
Note: FramesTotal = 21703680 at this point.
Re: VB6 RC5-CoreAudio-Demo
I don't quite understand the meaning of that red sentence (code line with error), I made some changes to avoid Overflow error. The program now opens a large Mp3 file without error. Maybe someone else has a better solution.
Code:
Public Property Get FrameIdxCurrent() As Double
If ARC Is Nothing Then Exit Property
'---------------------------------------------------------------------------------------------------------------------------------------------
'--- To avoid overflow --- DreamManor Update on 24-11-2017 ---
'FrameIdxCurrent = (FrameIdxToCopyFrom - ARC.CalcFrameCountAheadOfClientSrc + 1000 * 1# * FramesTotal) Mod FramesTotal
Dim nIndex As Double
nIndex = 1# * 1000 * FramesTotal
nIndex = FrameIdxToCopyFrom - ARC.CalcFrameCountAheadOfClientSrc + nIndex
If nIndex <= 2 ^ 31 - 1 Then
FrameIdxCurrent = (FrameIdxToCopyFrom - ARC.CalcFrameCountAheadOfClientSrc + 1000 * FramesTotal) Mod FramesTotal
Else
nIndex = nIndex / FramesTotal
nIndex = nIndex - Int(nIndex)
If nIndex > 0 Then
nIndex = nIndex * FramesTotal
End If
FrameIdxCurrent = nIndex
End If
'--------------------------------------------------------------------------------------------------------------------------------------------
End Property
1 Attachment(s)
Re: VB6 RC5-CoreAudio-Demo
Now there is another problem that needs Olaf's help.
When I open an mp3 file(1.5M), the following error message appears:
Code:
Public Sub InitFromMP3(FileNameOrByteArray, RenderEndPoint As cMMDevice, ByVal PlayFreq As Long, Optional ByVal SkipLeadingSilence As Boolean)
Dim Src() As Byte, Dst() As Long, DstBytesUsed As Long, msEstimated As Long
Src = FileNameOrByteArray
If VarType(FileNameOrByteArray) = vbString Then Src = New_c.FSO.ReadByteContent(CStr(FileNameOrByteArray))
With New_c.MP3Resource
.GetMP3Info Src, OrigFreq, Channels, ID3Offs, msEstimated
ReDim Dst(0 To msEstimated / 1000 * OrigFreq * 1.5)
.OpenConverter OrigFreq, Channels, 16
.ConvertBuffer VarPtr(Src(ID3Offs)), UBound(Src) + 1 - ID3Offs, VarPtr(Dst(0)), 4 * (UBound(Dst) + 1), DstBytesUsed, True
End With
ReDim Preserve Dst(DstBytesUsed \ 4 - 1)
InitWithFrames Dst, RenderEndPoint, PlayFreq, SkipLeadingSilence
End Sub
Re: VB6 RC5-CoreAudio-Demo
Then you need to figure out what's needed in the following code line:
Code:
ReDim Dst(0 To msEstimated / 1000 * OrigFreq * 1.5)
Is the file compressed using VBR or a fixed bitrate?
Re: VB6 RC5-CoreAudio-Demo
Quote:
Originally Posted by
Arnoutdv
Then you need to figure out what's needed in the following code line:
Code:
ReDim Dst(0 To msEstimated / 1000 * OrigFreq * 1.5)
Is the file compressed using VBR or a fixed bitrate?
Hi Arnoutdv, thanks for your reminder.
I tracked the variable msEstimated, whose value is 38353 ms, but in TheTrick's software this value (duration-ms) is 39079 ms. This value is also greater than 39,000 in Audacity software. In other words, in the RC5.MP3Resource class, the audio files' playback time (estimated time) is less than other software. This causes the allocation capacity of the dst array is too small. I modified the following source code, now the program can play that mp3 file:
Code:
'ReDim Dst(0 To msEstimated / 1000 * OrigFreq * 1.5)
ReDim Dst(0 To msEstimated / 1000 * OrigFreq * 3)
I don't know what is the basis of multiplying 1.5 or multiplying 3 in the source code?
In addition, vbForums doesn't allow uploading files over 500K, so I have no way to upload the test file.
1 Attachment(s)
Re: VB6 RC5-CoreAudio-Demo
As soon as I start the project "CoreAudioDemo", I get this error:
Ungültiger Prozeduraufruf oder ungültiges Argument.
(Invalid procedure call or invalid argument)
Windows 10:
Attachment 183478
Re: VB6 RC5-CoreAudio-Demo
Quote:
Originally Posted by
tmighty2
As soon as I start the project "CoreAudioDemo", I get this error:
Ungültiger Prozeduraufruf oder ungültiges Argument.
(Invalid procedure call or invalid argument)
Are you trying to use that (RC5-based) demo with RC6 by any chance?
If yes, then "just switching the Project-Reference" is not enough for most older Demos.
In many larger RC5-Demos, there's an additional need, to do a global search/replace on the Code:
- searching for fully qualified Class-Types, which start with the term: [vbRichClient5.] <-- please notice the trailing dot ...
- replacing it with either an empty String, or with a leading [RC6.] as the lib-name of the fully qualified Class-Type
Olaf
Re: VB6 RC5-CoreAudio-Demo
Excellent work Olaf. It's also a great example of Cairo widgets.
I feel like Sherlock Holmes researching RichClient, and a very pleasant discovery was the Unicode path function to supersede VB's anemic ANSI Dir function, or the various DirW routines floating around.
Code:
Dim DL As cDirList
Set DL = New_c.FSO.GetDirList(App.Path & "\Res", , "*.jpg;*.png")
I see there is a cMP3Resource class in RC5 and RC6 with :
Code:
Function OpenConverter(DstFreq As Long, [DstChan As Long = 2], [DstBits As Long = 16], [DstFmtT As Long = 1]) As Boolean
I assume this for conversion to .Wav ...? Are there any examples of how to use this?
It would be overkill for converting an mp3 to DstBits As Long = 24, or 32 ---- but if it works, that would be nice for some audio editing software to do granular noise reduction.
Cheers
Re: VB6 RC5-CoreAudio-Demo
Quote:
Originally Posted by
taishan
I see there is a cMP3Resource class in RC5 and RC6 with :
Code:
Function OpenConverter(DstFreq As Long, [DstChan As Long = 2], [DstBits As Long = 16], [DstFmtT As Long = 1]) As Boolean
I assume this for conversion to .Wav ...? Are there any examples of how to use this?
If I use google to find RC-Demos for a certain class...
- I usually include the classname in DoubleQuotes
- and prefix this search-term with site:vbForums.com
E.g. in your case, it would look like: [ site:vbforums.com "cMP3Resource" ]
Which spits out (among a handful of other related Links):
https://www.vbforums.com/showthread....=1#post4936139
Olaf
Re: VB6 RC5-CoreAudio-Demo
Quote:
Originally Posted by
Schmidt
If I use google to find RC-Demos for a certain class...
- I usually include the classname in DoubleQuotes
- and prefix this search-term with
site:vbForums.com
E.g. in your case, it would look like: [ site:vbforums.com "cMP3Resource" ]
Which spits out (among a handful of other related Links):
https://www.vbforums.com/showthread....=1#post4936139
Olaf
Thank you for the google search hints! you are the man!
btw, please don't let this documentation expire. Seems like a few examples worth keeping... plus, it is a cool website. Cheers