Thread View: borland.public.cppbuilder.multimedia
9 messages
9 total messages
Started by Mark Jacobs
Wed, 21 Jul 2004 16:44
Compressing audio - formats supported by XP
Author: Mark Jacobs
Date: Wed, 21 Jul 2004 16:44
Date: Wed, 21 Jul 2004 16:44
33 lines
2389 bytes
2389 bytes
I have been dabbling with direct handling of audio buffers, and I have been
able to open PCM and GSM6.10 formats by specifying the correct WAVEFORMATEX
and GSM610WAVEFORMAT structures. As I delved deeper, I found loads of other
compression algorithms, including MPEGLAYER3 and TRUESPEECH. The problem I am
getting is that none of these other codecs open correctly with
waveInOpen(&phwo,WAVE_MAPPER,&ptsp.wfx,(DWORD)WaveInProc,
(DWORD)this,CALLBACK_FUNCTION);
where I set up TRUESPEECHWAVEFORMAT ptsp structure as follows :-
ptsp.wfx.cbSize=32; ptsp.wfx.wFormatTag=WAVE_FORMAT_DSPGROUP_TRUESPEECH;
ptsp.wfx.nChannels=1; ptsp.wfx.nSamplesPerSec=8000;
ptsp.wfx.wBitsPerSample=0;
ptsp.wfx.nAvgBytesPerSec=1067; ptsp.wfx.nBlockAlign=32;
ptsp.nSamplesPerBlock=240;
This is in accordance with the document at
http://www.csdn.net/dev/format/windows/wavec.htm
Why will this not open for input or output? I have checked that I have all of
these codecs enabled under Windows Multimedia system properties. Am I correct
in thinking that you can only waveInOpen codecs that can handle real-time
encoding?
If I use MPEGLAYER3, I can, under Windows XP SP1, open it with waveOutOpen,
but not waveInOpen. Why only for decoding MP3 audio, and not for encoding? Is
there some kind of copyright issue here? TIA,
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
markj atty critical dotty co dotty uk
Re: Compressing audio - formats supported by XP
Author: Mark Jacobs
Date: Sun, 25 Jul 2004 01:32
Date: Sun, 25 Jul 2004 01:32
60 lines
4335 bytes
4335 bytes
The reason is that the WAVEFORMATEX structure members have to be derived from
actual inspection of the audio codecs using the Microsoft ACM library. Have a
look for acmDriverEnum in the Windows SDK help file. Each codec has a number of
formats. For example, MPEG3 has 41, and OGG Mode 3 has 88 on my PC. Most have
fewer formats than these, for example PCM (uncompressed data) which has 16
formats and GSM 6.10 (mobile phone compression) with 4. Each of these formats
has a unique WAVEFORMATEX encoding and a variable number of extra bytes tacked
on to the end of the WAVEFORMATEX structure, the exact number denoted in the
cbSize member. Supply one of these correct structures to waveInOpen, and it
usually works. The number of extra bytes is usually no greater than 32, however,
OGG codecs use up to 3,096 extra bytes, so you have to declare a generic
WAVEFORMATEX structure to hold the extra info, like this :-
typedef struct mywvfmt { WAVEFORMATEX wfx; WORD xinf[32768];} MJWVFMT;
Remember, a WORD is 2 bytes, so I have plenty of space for future absurdities
with 32,768!
The ACM is really hard to program, unless you are used to the MFC way of
programming, with structs, callback routines and pointers. Success is very
rewarding though. On my website at http://www.jacobsm.com/index.htm#sft is a
program called MJ Calculator ... (mathspenknife.exe) which will produce a report
for any PC it is run on, listing all the audio codecs and possible formats for
the WAVEFORMATEX structures. For my PC this report is 5 MBytes and is produced
in under 5 seconds. Right-click the little globe button on the right-hand side
of the window.
--
Mark Jacobs
(I answer my own questions to let you know)
"Mark Jacobs" <markj atty critical dotty co dotty uk> wrote in message
news:40fe9d52$1@newsgroups.borland.com...
| I have been dabbling with direct handling of audio buffers, and I have been
| able to open PCM and GSM6.10 formats by specifying the correct WAVEFORMATEX
| and GSM610WAVEFORMAT structures. As I delved deeper, I found loads of other
| compression algorithms, including MPEGLAYER3 and TRUESPEECH. The problem I am
| getting is that none of these other codecs open correctly with
|
| waveInOpen(&phwo,WAVE_MAPPER,&ptsp.wfx,(DWORD)WaveInProc,
| (DWORD)this,CALLBACK_FUNCTION);
|
| where I set up TRUESPEECHWAVEFORMAT ptsp structure as follows :-
|
| ptsp.wfx.cbSize=32; ptsp.wfx.wFormatTag=WAVE_FORMAT_DSPGROUP_TRUESPEECH;
| ptsp.wfx.nChannels=1; ptsp.wfx.nSamplesPerSec=8000;
| ptsp.wfx.wBitsPerSample=0;
| ptsp.wfx.nAvgBytesPerSec=1067; ptsp.wfx.nBlockAlign=32;
| ptsp.nSamplesPerBlock=240;
|
| This is in accordance with the document at
| http://www.csdn.net/dev/format/windows/wavec.htm
|
| Why will this not open for input or output? I have checked that I have all of
| these codecs enabled under Windows Multimedia system properties. Am I correct
| in thinking that you can only waveInOpen codecs that can handle real-time
| encoding?
|
| If I use MPEGLAYER3, I can, under Windows XP SP1, open it with waveOutOpen,
| but not waveInOpen. Why only for decoding MP3 audio, and not for encoding? Is
| there some kind of copyright issue here? TIA,
Re: Compressing audio - formats supported by XP
Author: Chris Croughton
Date: Tue, 27 Jul 2004 11:48
Date: Tue, 27 Jul 2004 11:48
18 lines
1638 bytes
1638 bytes
On Sun, 25 Jul 2004 02:32:31 +0100, Mark Jacobs <mark@losethisbitjacobsm.com> wrote: > The ACM is really hard to program, unless you are used to the MFC way of > programming, with structs, callback routines and pointers. Success is very > rewarding though. On my website at http://www.jacobsm.com/index.htm#sft is a > program called MJ Calculator ... (mathspenknife.exe) which will produce a report > for any PC it is run on, listing all the audio codecs and possible formats for > the WAVEFORMATEX structures. For my PC this report is 5 MBytes and is produced > in under 5 seconds. Right-click the little globe button on the right-hand side > of the window. That sounds like exactly what I need. Unfortunately, it seems to require ACE32.DLL, the only thing of that name I can find with Google seems to be something to do with Advantage Client Engine, something about xBase. Chris C
Re: Compressing audio - formats supported by XP
Author: Mark Jacobs
Date: Tue, 27 Jul 2004 14:49
Date: Tue, 27 Jul 2004 14:49
29 lines
2145 bytes
2145 bytes
"Chris Croughton" <chris@keristor.net> wrote in message news:slrncgcg7t.ma.chris@ccserver.keris.net... | On Sun, 25 Jul 2004 02:32:31 +0100, Mark Jacobs | <mark@losethisbitjacobsm.com> wrote: | > The ACM is really hard to program, unless you are used to the MFC way of | > programming, with structs, callback routines and pointers. | | That sounds like exactly what I need. Unfortunately, it seems to | require ACE32.DLL, the only thing of that name I can find with Google | seems to be something to do with Advantage Client Engine, something | about xBase. Actually, the file you need for Windows ACM access, is called C:\WINDOWS\system32\msacm32.dll under Win XP Pro. If you are using BCB 5, you simply include the relevant header file. In my case I needed the following 2 declarations in my header file :- #include <mmreg.h> #include <msacm.h> and it linked the EXE with the correct library for me. BCB is just superb in the way it does so much for you. HTH -- Mark Jacobs DK Computing http://www.dkcomputing.co.uk markj atty critical dotty co dotty uk
Re: Compressing audio - formats supported by XP
Author: Chris Croughton
Date: Tue, 27 Jul 2004 19:28
Date: Tue, 27 Jul 2004 19:28
34 lines
2212 bytes
2212 bytes
On Tue, 27 Jul 2004 15:49:05 +0100, Mark Jacobs <> wrote: > "Chris Croughton" <chris@keristor.net> wrote in message > news:slrncgcg7t.ma.chris@ccserver.keris.net... >| On Sun, 25 Jul 2004 02:32:31 +0100, Mark Jacobs >| <mark@losethisbitjacobsm.com> wrote: >| > The ACM is really hard to program, unless you are used to the MFC way of >| > programming, with structs, callback routines and pointers. >| >| That sounds like exactly what I need. Unfortunately, it seems to >| require ACE32.DLL, the only thing of that name I can find with Google >| seems to be something to do with Advantage Client Engine, something >| about xBase. > > Actually, the file you need for Windows ACM access, is called > C:\WINDOWS\system32\msacm32.dll under Win XP Pro. If you are using BCB 5, you > simply include the relevant header file. In my case I needed the following 2 > declarations in my header file :- I was running on XP Pro (have Win2k Pro at home) and have BCB 6, but I don't have the source to your exe, which when I run it says that it needs ACM32.EXE (I downloaded it from the page you linked). > #include <mmreg.h> > #include <msacm.h> > > and it linked the EXE with the correct library for me. BCB is just superb in > the way it does so much for you. Until you find that it has included a load of things other people don't have, without you knowing... Chris C
Re: Compressing audio - formats supported by XP
Author: Mark Jacobs
Date: Wed, 28 Jul 2004 10:38
Date: Wed, 28 Jul 2004 10:38
23 lines
2373 bytes
2373 bytes
Excuse me, but that mathspenknife program works under *ANY* version of Windows starting with Win98. It does *NOT* need any other files, since it is a self-contained .EXE executable. It does *NOT* need an installation of BCB on the PC it is to run on. So, I do not understand why it does not run on your PC, if your PC is running at least Windows 98. The code is *NOT* for free in this instance, since it was developed for an application suite that is being released shortly. It took me about 2 days to learn to program and query the Windows ACM, but, then again, I'm a pretty intense guy! -- Mark Jacobs DK Computing http://www.dkcomputing.co.uk markj atty critical dotty co dotty uk "Chris Croughton" <chris@keristor.net> wrote in message news:slrncgdb7k.b4f.chris@ccserver.keris.net... | I was running on XP Pro (have Win2k Pro at home) and have BCB 6, but I | don't have the source to your exe, which when I run it says that it | needs ACM32.EXE (I downloaded it from the page you linked). | ... | Until you find that it has included a load of things other people don't | have, without you knowing...
Re: Compressing audio - formats supported by XP
Author: Chris Croughton
Date: Wed, 28 Jul 2004 17:26
Date: Wed, 28 Jul 2004 17:26
67 lines
3613 bytes
3613 bytes
On Wed, 28 Jul 2004 11:38:27 +0100, Mark Jacobs
<> wrote:
> Excuse me, but that mathspenknife program works under *ANY* version of Windows
> starting with Win98. It does *NOT* need any other files, since it is a
> self-contained .EXE executable.
It certainly needs quite a few DLLs, since it's a Windows program
(there's no such thing as a completely self-contained Windows program
that does anything useful, even file I/O uses the kernel DLL).
Specifically, it needs the Advantage Client Engine (some sort of
database system, I gather), which may be obtained (free) from
www.advantagedatabase.com/ (it needs a form filling in).
> It does *NOT* need an installation of BCB on
> the PC it is to run on. So, I do not understand why it does not run on your
> PC, if your PC is running at least Windows 98.
One is running Windows XP Pro, the other is running Windows 2000 Pro.
I downloaded it from your website (twice, once for each machine), they
are the same:
http://www.jacobsm.com/mathspenknife.exe
The same happens on both, it wants ACE32.DLL which I did not have (on
either machine). Doing a TDUMP (from the BC++ toolkit) I find it in the
code, with a list of other DLLs:
Imports from ACE32.DLL
(ord. = 1)
(ord. = 2)
(ord. = 4)
(ord. = 5)
...
and a load more, all by number rather than name
There are also a number of symbols with ACE in them:
class Adsdata::TACEFieldDef
class Adsdata::TACEFieldDefs
__fastcall Adsdata::ACECheck(Adsdata::TAdsDataSet *, unsigned int)
__fastcall Adsdata::TACEFieldDefs::TACEFieldDefs(Classes::TPersistent*)
__fastcall Adsdata::TACEFieldDefs::Add()
__fastcall Adsdata::TACEFieldDefs::GetItem(int)
__fastcall Adsdata::TACEFieldDefs::GetOwner()
__fastcall Adsdata::TACEFieldDefs::IndexOf(const System::AnsiString)
__fastcall Adsdata::TACEFieldDefs::SetItem(int, Adsdata::TACEFieldDef*)
__fastcall Adstable::TAdsStoredProc::BuildACEParamsList()
Does any of that ring a bell?
> The code is *NOT* for free in this instance, since it was developed
> for an application suite that is being released shortly. It took me
> about 2 days to learn to program and query the Windows ACM, but, then
> again, I'm a pretty intense guy!
I presume you mean the source code. Where did you get documentation on
the Windows ACM, only from the header file or did you find some other
documentation?
Your program works fine, having installed ACE, and does indeed look very
useful. Thanks for the pointer to it. Nice dump format for the
WAVEFORMATEX structures, I can copy those straight into my code (a bit
of simple massaging if I want to do it field by field)...
Chris C
Re: Compressing audio - formats supported by XP
Author: Mark Jacobs
Date: Thu, 29 Jul 2004 11:00
Date: Thu, 29 Jul 2004 11:00
60 lines
4136 bytes
4136 bytes
"Chris Croughton" <chris@keristor.net> wrote in message news:slrncgfodl.orr.chris@ccserver.keris.net... | On Wed, 28 Jul 2004 11:38:27 +0100, Mark Jacobs | Specifically, it needs the Advantage Client Engine (some sort of | database system, I gather), which may be obtained (free) from | www.advantagedatabase.com/ (it needs a form filling in). | | I presume you mean the source code. Where did you get documentation on | the Windows ACM, only from the header file or did you find some other | documentation? | | Your program works fine, having installed ACE, and does indeed look very | useful. Thanks for the pointer to it. Nice dump format for the | WAVEFORMATEX structures, I can copy those straight into my code (a bit | of simple massaging if I want to do it field by field)... I do beg your pardon, Chris. I must apologise, and with a double-yoker on my face (egg - a big one!), let me just say that because of the testbed program mathspenknife had become, a load of chaff libraries had got linked in, and never thrown out again after they were no longer needed. One of these was ACE32BOR.LIB (there were a couple of others including Direct Sound!!!) so I have removed them, rebuilt from scratch (proper rebuild) and the .EXE has gone from 1.2 MBytes to 880 KBytes in size. The documentation for ACM is all in the Windows SDK documentation that comes with BCB. On the Help menu in the IDE is the option "Windows SDK". Use it to look up these functions :- acmDriverEnum acmFormatTagDetails acmFormatDetails Here is a big hint. Use the "Index" method to elicit details from the ACM, rather than enumeration - except for the acmDriverEnum part which has to be done using CALLBACKs. Everything from there onwards can use a for loop accessing successive indexes for the codecs and types discovered. 1. Enumerate the 13 or so codecs on the PC using acmDriverEnum and store the id and number of types into 2 stringlists (or whatever you want to use) for each one. 2. For each of the 13 or so codecs, for each of the number of types, use acmFormatTagDetails to get the number of formats for this type and codec, and the all-important wFormatTag. 3. For each format so discovered, use acmFormatDetails to derive each WAVEFORMATEX structure. Remember to populate the largely empty WAVEFORMATEX wFormatTag with the dwFormatTag found in step 2, as well as the index number (0 to however many formats were discovered) in dwFormatIndex, before calling acmFormatDetails. Steps 2 and 3 should be calling the acm with the flags ACM_FORMATTAGDETAILSF_INDEX and ACM_FORMATDETAILSF_INDEX The new version (not dependent on ACE or DSOUND) of mathspenknife.exe has been uploaded. Sorry about the hassle and thanks for pointing this out to me. Good luck. Thanks again. -- Mark Jacobs DK Computing http://www.dkcomputing.co.uk markj atty critical dotty co dotty uk
Re: Compressing audio - formats supported by XP
Author: Chris Croughton
Date: Mon, 02 Aug 2004 09:10
Date: Mon, 02 Aug 2004 09:10
52 lines
3367 bytes
3367 bytes
On Thu, 29 Jul 2004 12:00:07 +0100, Mark Jacobs <> wrote: > I do beg your pardon, Chris. I must apologise, and with a double-yoker on my > face (egg - a big one!), let me just say that because of the testbed program > mathspenknife had become, a load of chaff libraries had got linked in, and > never thrown out again after they were no longer needed. One of these was > ACE32BOR.LIB (there were a couple of others including Direct Sound!!!) so I > have removed them, rebuilt from scratch (proper rebuild) and the .EXE has gone > from 1.2 MBytes to 880 KBytes in size. No problem, I guess we've all done something like that sometime. > The documentation for ACM is all in the Windows SDK documentation that comes > with BCB. On the Help menu in the IDE is the option "Windows SDK". Use it to > look up these functions :- > > acmDriverEnum > acmFormatTagDetails > acmFormatDetails Aha! I always forget that one is there. > Here is a big hint. Use the "Index" method to elicit details from the ACM, > rather than enumeration - except for the acmDriverEnum part which has to be > done using CALLBACKs. Everything from there onwards can use a for loop > accessing successive indexes for the codecs and types discovered. OK... Unfortunately, the drivers for the Audigy2Pro soundcard seem not to advertise their 24 bit formats through the ACM, which is what I particularly wanted -- they provide a WDM module, which is the only way of getting 24 bit at 44100 sps, the DirectSound and ASIO drivers will only do 24 bits at 48 or 96 ksps and I do /not/ want to do resampling (nasty nasty artefacts going from 48 to 44.1, and 96 makes files which are far too big), and some commercial recorders will handle the WDM input (nTrack and CoolEdit at least) at 24/44.1 so it obviously can be done, but I can't work out what the WAVEFORMATEX should look like to do it. I'll post separately about that, see if anyone has any other ideas (I tried in the comp.os.ms-windows.programmer.multimedia newsgroup and have seen nothing at all posted there since, I think it's a dead group). > The new version (not dependent on ACE or DSOUND) of mathspenknife.exe has been > uploaded. Sorry about the hassle and thanks for pointing this out to me. Good > luck. Thanks again. Keine probleme. That's a useful utility (I used it to look at fonts as well)... Chris C
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads