Delphi Graphics: Multimedia

Delphi Informant's Multimedia Resources on the Internet

Chapter 7, Working with multimedia (pp. 7-28 - 7-32), Borland's Delphi 5 Developer's Guide.

Category Description/Comments
Animation Torry's Components
www.torry.ru/animation.htm 

Agents of Instruction -- Using Microsoft Agent with Delphi
www.delphizine.com/features/1999/10/di199910es_f/di199910es_d.asp 

Playing resource animations
www.elementkjournals.com/ddj/9811/ddj98b1.htm 

Animation Components
www.delphipages.com/results.cfm?ChosenCategory=Animation

TAnimation is an encapsulation of the Windows 95 animation common control. It plays so called "silent" AVIs (animation files), as you can see when copying or deleting multiple files or when you are searching for files.  http://members.nbci.com/_XMCM/rvelthuis/animate.htm 

TAnimationFX component displays animation effects. This version supports the following effects: Marquee, Blinds, Sliders, Checkerboard, Strips, Iris, Crush, CrushReveal, Zoom, Fade, Mosaic, Twister, Wave, Mono Sliders, Bands, RGB, Mono Reveal, Spiral, Checker, Blinds, Random Bars, Twin Random Bars, Swarm, Striped Iris, Pixelate, Roll
http://delphi.icm.edu.pl/ftp/d10share/animfx30.zip
http://delphi.icm.edu.pl/ftp/d20share/animfx40.zip

TAnimate, http://delphi.icm.edu.pl/ftp/d10share/animate.zip

TxACursor allows you easily add animated cursor to your project. It stores it in the DFM file so there is no need to distribute it with your application as a separate file. At run-time it adds animated cursor to the array of Screen cursors automatically.
www.mindspring.com/~smish/delphi

Non-Delphi: Michael Abrash's Graphics Programming Black Book, Chapter 43, "Bit-Plane Animation"

HowTo:  Use MCI to Play AVI/WAVE Files from Memory
http://support.microsoft.com/support/kb/articles/Q155/3/60.asp 

[Foley96, pp. Chapter 21, pp. 1057-1081]

API Calls "The Multimedia APIs" in March 1999, Delphi Informant, p. 64
A prelude to the book The Tomes of Delphi:  32-bit Multimedia Programming to be published Summer 2000

Wrapper for the MMsystem midistream API calls
Project JEDI Converted Tool by Manuel Jander
ftp://delphi-jedi.org//tools/midistream.zip

Audio

Audio Links
www.delphipages.com/results.cfm?ChosenCategory=Audio

TAudio.  Set of two components for SoundIn and SoundOut.
ftp://mail.cog.brown.edu/pub/bliss95/TAudioIO.zip

Torry's Audio Components > Effects and Multimedia > Audio
www.torry.net/audio.htm 

TAudio controls waveform and mixer devices allowing applications to manage waveform audio playback  and recording. http://delphi.icm.edu.pl/ftp/d10free/audio.zip

Audio Tools
-  Sweep Generator for frequency response analysis, resonance detection etc., a weather satellite
-  Recording level meter
-  Vector Scope for direction finding or audio phasing checks
www.davidtaylor.freeserve.co.uk/software/audio.html

Audio Compression Manager wrapper components for Delphi. Allows you to convert WAV -> MP3 ->WAV etc. Allows you to record and compress audio small enough for live streaming over a small bandwidth.   http://delphi.icm.edu.pl/ftp/d40free/acmaudio.zip 

Audio Compression Manager Interface for Microsoft Audio Compression Manager. Updated 5 May 2000 to include WaveFmtU.ini, an info file about use of WaveFmtU.zip, which contains wave format constants and a sample app.   www.delphi-jedi.org/Jedi:APILIBRARY 
Books Chapters:
1.  The Anatomy of Multimedia
2.  Building a Multimedia Application
3.  The Wave API
4.  The MIDI API
5.  The Auxiliary API
6.  Multimedia Mixers
7.  Timers and Joysticks
8.  Multimedia and Output Support
9.  The Media Control Interface API

efg:  I am disappointed this book did not cover video.

"The Multimedia APIs" in March 1999, Delphi Informant, p. 64
A prelude to the book The Tomes of Delphi:  32-bit Multimedia Programming to be published Summer 2000

"Multimedia Programming with Delphi," Delphi 5 Developer's Guide by Teixeira and Pacheco 

Teach Yourself Borland Delphi 4 in 21 Days,
Chapter 12 Graphics and Multimedia Programming

Multimedia Routines
Chapter 15, How to Program Delphi 3
Examples:  BlockShadow, ColorMsg, CustomCursor, DisplayDirImages, MessageBlink, PlayVideoFile, PlayWaveFile, ShowHotSpot, ShowScrSaver, ShowTNail, SlowPrint, SoundEnabled, TickerTape, TileBitmap, TransparentButton

Inside the Windows Multimedia System (Chapter 5)
Delphi 2 Multimedia
by Scott Jarol et al, Coriolis Group Books, 1996.

Multimedia and Games
Part VII of Delphi 2 Unleashed, Charles Calvert, Sams Publishing, 1996.
Chapter 32. Games SDK
Chapter 33. Creating SDK Worlds
Chapter 34. Delphi Multimedia Programs
Chapter 35. Advanced Multimedia Capability

CD-ROM See CD-ROM on efg's Delphi Disks/Drives page

CD Player
http://www.xploiter.com/programming/delphi/files/delphicd.zip

Codecs (Codec = Compressor/decompressor)

Peter Haas' UseNet Post about finding a list of the installed codecs in the registry:

Components

  Multimedia Component Library
www.swiftsoft.de/mmtools.html

Multimedia Components.  Mixer Demo, Mixer Explorer, MIDI Controls & Sequencer, MIDI Control Demo, MIDI Jukebox, Multimedia Level Data and Meter
www.wilsonc.demon.co.uk/delphi.htm

Delphi Pages
www.delphipages.com/results.cfm?ChosenCategory=Multimedia

Torry's Components
- Audio www.torry.ru/audio.htm 
- Animation www.torry.ru/animation.htm 
- Voice www.torry.ru/voice.htm 

Multimedia Buttons:  Creating Special Buttons for Special Interfaces, Delphi Informant, March 1998

Led Studio.  Varian Led Studio is a collection of 37 multi media components for Borland Delphi 3 & 4 and C++ Builder. Need some visual controls to build your cd player or graphics
game?  Then this package is what you are looking
http://delphi.icm.edu.pl/ftp/d30share/vssdigi4.zip

Compression Interface for Microsoft Audio Compression Manager. Updated 5 May 2000 to include WaveFmtU.ini, an info file about use of WaveFmtU.zip, which contains wave format constants and a sample app.   Project JEDI Conversion Library.
ftp://delphi-jedi.org/api/acm.zip 
Direct Sound TurboSound
www.silicmdr.com/TurboSound.htm
Expert (Wizard)

A Multimedia Assembly Line --  a Delphi Wizard (expert) to produce multimedia components with WAV-file-playing capabilities.  By Alan C. Moore, Ph.D., Delphi Informant
Part I:  Enhancing a Delphi Expert, Dec 1999
Part II:  Generating a Component, Jan 2000

Human Input Device ProjectJediButton.gif (3350 bytes)  Interface for the Microsoft Human Input Device (HID) API by Robert Marquardt.
www.delphi-jedi.org/Jedi:APILIBRARY 
ftp://delphi-jedi.org/api/hid.zip 
Links Multimedia:  How can I ...?
www.swissdelphicenter.ch/en/multimedia.php 

Sound
www.programmersheaven.com/zone2/cat425/index.htm 

MediaPlayer Create a new file with the .wav extension (TI 1427D)
Endless looping with the TMediaPlayer (FAQ 2071D)
How can I change the drive that MediaPlayer uses to play Audio  (FAQ 824D)
Which is the current CD track?, www.preview.org/q/q1034.shtml
Mixers Torry's Components > Sound Effects > Mixer
www.torry.net/mixer.htm 
MP3 Project JEDI Converted Tools by B. Emslie, Giuseppe Lo Presti
MP3 Player Wrappers. TMPEG3Player component drives WinAmp to play .mpX files; position property support included as TMediaPlayer; uses an interface unit by B. Emslie (included in this zip package).
ftp://delphi-jedi.org//tools/mp3play.zip 

TAudioInfo class for fast extracting mp3 (MPEG 1, 2 Layers I, II, III) headers and for working with ID3v1.1 tags (read/write).
http://delphi.icm.edu.pl/ftp/d20free/audioinf.zip  

Write your own MP3 player in a few lines of code. With the XAUDIO SDK, now available for the Windows95/98/NT ...  you can very easily write your own GUI or other front-end to the Xaudio decoding engine. The SDK includes the libraries and sample code for ... Delphi ...
www.xaudio.com

Drives WinAmp to play .mpX  files. Position property support included as TMediaPlayer.
http://delphi.icm.edu.pl/ftp/d20free/mp3play.zip

MP3 Blade Encoder Component 1.0
www.swiftsoft.de/free/blade.zip

Multimedia Programming "The Multimedia APIs" in March 1999, Delphi Informant, p. 64
A prelude to the book The Tomes of Delphi:  32-bit Multimedia Programming to be published Summer 2000
Music

Using the Musical Instrument Digital Interface (MIDI)
Chapter 16, Delphi 2 Multimedia

Real Audio Real Audio 3 Distribution Files (companion to API translation).  Project JEDI Converted Tool. 
ftp://delphi-jedi.org//tools/RealAudio3Dist.zip 
Resource Files efg's Resource Demo application shows how to use the following file types in resource files:  BMP, ICO, JPG, GIF (requires Anders Melander's TGIFImage), EMF, TXT, AVI, WAV, cursors, and a matrix of binary data (Integers and Doubles).  Requires D4 (or above) for the dynamic array of binary data.

Resource-Grabber.  Scan the directories and drives on your computer and extract all Bitmaps, Glyphs (button images), Icons, Cursors, JPG/JPEG images, WAVE and RMI sound files as well as AVI video clips it finds inside the programs and DLL files in any directory of your choice.
  http://inner-smile.com/dl_res.htm

Sounds in EXE
www.xploiter.com/programming/delphi/files/sounds.zip

Ralph Friedman's UseNet Post about  how to play a WAV in a resource file
Ralph Friedman's UseNet Post about how to create a .RES with wave files

Sound / Sounds Sound Card
How do I tell if a sound card is installed? (FAQ 2413C)

TToneGen component allows the simple creation of sound effects   within an application without the need for external audio files or resources. TToneGen achieves this by generating and processing WAV waveforms in memory.  http://delphi.icm.edu.pl/ftp/d20free/TToneGen.zip

ToneBurst.   Program to generate a single sine-wave toneburst when a button is pressed. Full source code is provided.  www.david-taylor.pwp.blueyonder.co.uk/software/audio.html#ToneBurst 

Playing Sounds
pp. 495- 501, Delphi Programming Problem Solver, Neil Rubenking

NetSound:   Streaming Audio over a TCP/IP Network, Delphi Informant, July 1999.

All About Playing Sounds
www.209software.com/books/p4dp/PlaySounds.html

Play Sound Files
http://delphi.icm.edu.pl/ftp/d20free/PDJ_Sound.zip

Colin Wilson's UseNet Post about playing a wave file backwards
Genial's UseNet Post about playing two sounds at once
Ronald Hoek's UseNet Post about playing audio from a TMemoryStream

Sound SWAG (Software Archive Group):  110 examples
www.gdsoft.com/swag/sound.zip     (Requires Reader)

Speaker SysUtils.Beep calls Windows.MessageBeep(0).     // MB_OK = 0

Windows Unit:

Beep Function Beep(dwFreq {Hertz (37 .. 32767)}, dwDuration {milliseconds}:  DWORD):  BOOL;

Under Windows 95 the Beep parameters are ignored and the Windows plays the default sound event.  Unders Windows NT, Beep is synchronous, except for when dwDuration is -1.  In this case Beep is asynchronous and continues until the next call to Beep.

MessageBeep Function MessageBeep(uType:  UINT):  BOOL;  // Windows Unit
uType Sound
0xFFFFFFFF Standard beep using the computer speaker
MB_ICONASTERISK SystemAsterisk (64)
MB_ICONEXCLAMATION SystemExclamation (48)
MB_ICONHAND SystemHand (16)
MB_ICONQUESTION SystemQuestion (32)
MB_OK SystemDefault (0)

MessageBeep plays sounds asynchronously.

If the specified souond cannot be played, MessageBeep attempts to play the system default sound.

Control of PC Speaker in Windows. Make your programs bleep like FractInt. Play tunes in the style of GWBasic's PLAY command. http://delphi.icm.edu.pl/ftp/d10free/bleepint.zip.   (efg's comment:  works well)

Calling windows Beep function (FAQ 2522D)
Timed beeps from the PC speaker (FAQ 1838D)

Speech Speech enabling components for Delphi. Speech Recognition and Text-to-Speech.  www.o2a.com/dtalk.htm

Speech Primer
www.o2a.com/framesPrimer.htm 

ProjectJediButton.gif (3350 bytes)  Interface for the Microsoft Speech API.  
Project JEDI Conversion Library by Alec Bergamini, Alex Hekstra. 
www.delphi-jedi.org/Jedi:APILIBRARY 
ftp://delphi-jedi.org/api/sapi.zip 

Components for rapidly integrating speech technology and deploying speech-aware applications, www.chant.net

Microsoft's Speech Technology including Speech API SDK
www.research.microsoft.com/research/srg

Useful Speech Links
www.o2a.com/Sp_Links.htm 

Telephony ProjectJediButton.gif (3350 bytes)  Telephony API. Used to create Telephony-enabled applications and to create Telephony service providers.  Project JEDI Conversion Library by Marcel van Brakel, Rudolph Velthuis.
www.delphi-jedi.org/Jedi:APILIBRARY 
ftp://delphi-jedi.org/api/TAPI.zip 
Timer Thread based timer component for driving midi apps
from UseNet Post by Carl Caulkett

Threaded Timer
www.silicmdr.com/downloads/ThreadTimer.zip

Video Also see Video for Windows below.

VideoOCX allows easy integration of live video display, capture and saving capabilities into your applications. The control supports most VFW capable video devices like USB cameras or framegrabber AND AVI sequences as image sources. It allows you to save captured video frames in different AVI formats including audio.  Use VideoOCX in most development environments that support ActiveX. Give it a try and download your free evaluation copy today.  www.videoocx.de 

Professional 32bit video capture component
http://www.programmersheaven.com/zone2/cat71/14323.htm 

ProjectJediButton.gif (3350 bytes)  ATI Direct Video Access (DVA) API.  Project JEDI Conversion Library.
www.delphi-jedi.org/Jedi:APILIBRARY 
ftp://delphi-jedi.org/api/d_ati_tuner.zip 

Torry's Video Components
www.torry.ru/video.htm 

Die Ansteuerung von Videokarten mit AVI-Capture unter Delphi
http://delphi.pjh2.de/articles/multimedia/avicap.php

Video Capture in Delphi by G. L. Alston.
[This is a Delphi 1 example.  I had to make changes to the code to get it to compile and I never did get it to run, but perhaps I still had some sort of configuration problem.  --efg, 30 Aug 2000]
www.alstonlabs.com/avicap.htm 

TVideo Components
www.serveisgirona.com/delphi 

Component for video capturing, includes a demo program in Delphi 4.
http://delphi.icm.edu.pl/ftp/d20free/videocap.zip

www.delphipages.com/results.cfm?ChosenCategory=Video

Video, DirectX Non-Delphi:

Download the DirectX 8.0a SDK from http://msdn.microsoft.com/directx  and run the "AmCap" program (which is very similar to the VFW VidCap/VidCap32 programs):   \mssdk\samples\Multimedia\DirectShow\Capture\AMCap

Video,
EPIX PIXCI SV4 Card
Contact Dave Kazmer, djkazmer@uwyo.edu, to find out about his work using EPIX cards with Delphi.
efg's examples below are for the EPIX PIXCI SV4 imaging card using EPIX XCOBJ Software Library.  The PIXCI® SV4 imaging board, for the PCI bus, is designed to take advantage of the power of the host computer.

To create a Delphi interface to the EPIX DLLs, download CtoBAS.EXE from ftp://ftp.epixinc.com/epix/software

Run CtoBAS using the EPIX DLLs:
1. ctobas -32 -f xc000w95.dll -predef xcobj.h > xcobj.bas
2. ctobas -32 -f pxxc00w5.dll pxipl.h > pxipl.bas
3. ctobas -32 -f xc000w95.dll pxdipl.h > pxdipl.bas

Conversion of these .BAS files to Delphi is much easier than directly converting the C code.
The two ZIP files below contain a XCOBJ.PAS interface file, which is a conversion of many (not all) of the routines from the C header files.

 

ScreenDirectXDemo.jpg (42659 bytes)

PIXCI DirectX Video (30 frames/second). Example screen shown above.
Assumes PIXCI card,  XC150W95.DLL and EPIXXC32.VXD are properly configured.

Uses pxd_DirectVideoInit, pxd_DirectVideo and pxd_DirectVideoDone calls from XCOBJ library to display Direct X video in the panel (shown at left).   This panel can be made larger during design mode.  Tested with D4/D5 with S-Video input. Here's a summary of the XCOBJ library calls for this DirectVideo example:

XCOBJ.pxd_xcopen('NTSC/YC', NIL) // S-video
...
XCOBJ.pxd_DirectVideoInit(Panel.Handle);
...
XCOBJ.pxd_DirectVideo(
     ORD('v'), // mode
     0,0,0,0, // reserved
     Panel.Handle, // handle
     0,0, // origin
     32767,32767, // width, height
     VideoOverlayColor, // ClrKey1
     VideoOverlayColor); // ClrKey2
...
XCOBJ.pxd_DirectVideoDone;
XCOBJ.pxd_close;

The VideoOverlyColor was defined as RGB(0,0,255), i.e., clBlue, in the above pxd_DirectVideo call.  DirectX changed any blue pixel in the screen shot shown above to "live video."   Since a blue ellipse was drawn with a black background, only the blue ellipse shown above will contain the live video.  The timer text, caption text and grid line colors can be changed by clicking on the red square above.  Changing this color to blue will result in video display even through the "blue" grid lines.

The WM_MOVE message simulates a Stop/Start sequence to reposition the DirectX video window (inside the panel).

Source code with example:  EPIXDirectXVideo.ZIP


PIXCI "Live" Video (~7 frames/second)
Brightness and Contrast scrollBars affect image quality in real-time (adapted from EPIX C example).  Flip/Reverse check boxes can be used to change image display using various parameters with pxd_StretchDIBits.  Image sizes of 160-by-120, 320-by-240, 480-by-360, or 600-by-450 can be selected via a radiogroup control.

A 20 ms Timer is used to capture and display images as quickly as possible using pxd_snap.   (Slightly better results -- perhaps a few more frames per second -- can be obtained using a threaded timer.)  This approach allows some user-controlled modification of each frame before it is displayed, but the frame rates are far lower than the pxd_DirectVideo in the example aboe.

Tested with D4/D5 with S-Video input.

EPIXLiveVideo.ZIP

Video for Windows (VFW)

J. Hübler's TVideo.  Two components for video capturing using Video for Windows.
http://homepages.borland.com/torry/vcl/mmedia/video/jhvideocap.zip  
[efg:  TVideo works very well.  Demo1 is somewhat similar to the Microsoft VideoCap C++ program from  http://msdn.microsoft.com/library/devprods/vs6/visualc/vcsample/vcsmpvidcap.htm.]

David Taylor's WebCam.  Program to allow Video For Windows device, such as Connectix Color QuickCam, to be used as a Web Camera.  www.davidtaylor.freeserve.co.uk/software/imaging.html

Joe Hecht's UseNet Post about capturing an image from a video source.
How can I capture an image from a video source?   (FAQ 1037D) [by Joe Hecht]

Peter Haas' VFW and a PC camera demo that describes three different ways to get a single frame in a TBitmap.    
http://delphi.pjh2.de/demos/download/capdemoc.zip
Extend this example to select a CODEC:

procedure TMainForm.BtnDlgVideoCompressionClick(Sender: TObject);
begin
  if FCapWnd <> 0 then
    capDlgVideoCompression(FCapWnd);
end;

Peter Haas' UseNet Post about setting the capture frame rate

Toni Martir's notes and complete VFW example (see ShevinE's improvement below).   (Note:  to get Toni's complete example to compile in D3-D5, make sure you can compile with USES OLE2:

Tools | Environment Options | Library | Library Path
D3: C:\Program Files\Borland\Delphi 3\Lib\Delphi2
D4-5: $(DELPHI)\Lib\Delphi2)

Use Lizard.AVI or another AVI file with Toni's example.

ShevinE's improvements to Toni Martir's example (D3-D5 source).   Saves AVI to BMP files as FrameXX.BMP.  Includes VFW.PAS file used in Toni's example.  (Requires USES OLE2 -- see above notes for details.)  [Use Lizard.AVI or another AVI file.]

Delphi import unit for the VFW SDK.  www.swiftsoft.de/free/vfw.zip  is a older version of a VfW header translation.  Ivo Steinmann has edited this unit. A link to the new version is
ftp://delphi-jedi.org/api/vfw.zip (direct) or
http://www.delphi-jedi.org/Jedi:APILIBRARY (indirect).

Component allows to capture images and videos from several   sources (videocams, vcr's, webcams). Has been created using the AVICAP32.dll (from the Win32 API).
http://delphi.icm.edu.pl/ftp/d20free/jlcvideo.zip

Information to VFW AVICapture (Microsoft):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/hh/multimed/
avicap_8xyd.asp?frame=true

Microsoft Video for Windows (VFW) Developer's Kit
ftp://ftp.microsoft.com/developr/drg/Multimedia/Jumpstart/VfW11e/DK/VFWDK

VidCap / VidCap32  [Also see DirectX AMCap]

Video for Windows
http://msdn.microsoft.com/library/psdk/multimed/avifile_8dgz.htm 

See Rob Anderson's AVIBUILD.
Current version does not handle pf24bit BMPs correctly.
Includes vfw.pas (Video for Windows) interface unit for avifil32.dll.

Visual Basic Multimedia Information Microsoft Visual Basic Multimedia Sample Projects:
- Play an AVI File Stored in a Resource DLL File
- Playing a Streaming Audio File
- Play and Display Wave Data
- Detect and Use Multiple Sound Cards
- Read Joystick Inputs
- Play Audio Compact Discs
- Control a MIDI Device
http://support.microsoft.com/support/vbasic/vbmm.asp 

VB Info:  VideoCapture Help
www.shrinkwrapvb.com/videocap.htm 

Video for Windows Articles
www.videoforwindows.com/articles
 

Voice Torry's Voice Components
www.torry.ru/voice.htm 

WinIVR is a powerful and user-friendly tool capable of designing custom IVR (Interactive Voice Response) applications. An IVR system is a system that allows your PC to answer an inbound call from the telephone line, and subsequently interacts logically and intelligently with the caller. It "listens" by detecting the digits pressed by the caller on his or her touch-tone keypad.
www.winivr.co.nz 

Volume Control http://members.tripod.com/dartclub/download.htm

How to programmatically control the volume slider?  
See Robert Roßmair's TrrMixer and example posted to UseNet

Charles Hacker's UseNet Post with GetWaveVolume/SetWaveVolume routines
Alexey Glotov's UseNet Post

Waves

"A Simple Oscilloscope" 
http://delphiforfun.org/Programs/oscilloscope.htm 

All about Playing sounds
www.209software.com/books/p4dp/PlaySounds.html

efg's Resource Demo application shows how to use the following file types in resource files:  BMP, ICO, JPG, GIF (requires Anders Melander's TGIFImage), EMF, TXT, AVI, WAV and cursors

Rawplayer is a program which allows you playing wavefiles, even without header, with 44.1kHZ (CD) and make  a list of them   which is understood by Gear 4.0  (CD-Recording software).   Softscrolling and multithreaded. www.geocities.com/SiliconValley/Campus/5839/rawplaye.zip

WaveClip. Unit for copying WAV files to and from the Clipboard
ftp://mail.cog.brown.edu/pub/bliss95/WaveClip.zip

WaveMix.  A translation of WaveMix DLL to Delphi. Allows multiple wave files to be played simultaneously (max of 8). No need for external DLL or INI files.
www.carlosb.com/downloads/dwavemix.zip

ProjectJediButton.gif (3350 bytes)  Wave format constants for use with Audio Compression Manager (ACM) translation. File contains sample app using ACM.  Project JEDI Converted Tool by Alan Lloyd.
www.delphi-jedi.org/Jedi:APILIBRARY 
ftp://delphi-jedi.org//tools/WaveFmtU.zip 


Updated 14 Jun 2009
Since 1 Nov 1998