Quelles sont les fonctions disponibles dans Delphi pour lire un fichier son?Comment lire un fichier wav dans Delphi?
Répondre
Voici le moyen le plus rapide:
uses MMSystem;
procedure TForm1.Button1Click(Sender: TObject);
begin
sndPlaySound('C:\Windows\Media\Tada.wav',
SND_NODEFAULT Or SND_ASYNC Or SND_LOOP);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
sndPlaySound(nil, 0); // Stops the sound
end;
sndPlaySound existe pour la rétrocompatibilité seulement – Ampere
Est-ce que cette procédure fonctionne dans FireMonkey? Si oui, alors cela fonctionnera-t-il sur d'autres plateformes qui ne sont pas Windows? –
Un tutoriel complet est disponible à l'adresse: http://sheepdogguides.com/dt3f.htm
Il est un peu vieux. Mais ça devrait marcher.
Oui, cela fonctionne encore en 2009. –
Avec la fonction sndPlaySound de l'API WIN32-(Unité MMSystem):
sndPlaySound ('C: \ Windows \ Media \ tada.wav', SND_ASYNC);
sndPlaySound existe pour la rétrocompatibilité seulement – Ampere
Cette page explique très bien comment utiliser la fonction sndPlaySound et comment intégrer le fichier wav comme ressource: http://www.latiumsoftware.com/en/delphi/00024.php
Le lien n'est plus actif. –
C'est dommage mais il est toujours possible d'y accéder sur archive.org: http://web.archive.org/web/20080509074922/http://www.latiumsoftware.com/fr/delphi/00024.php – Name
+1 ; Merci pour la mise à jour. –
simple:
Les personnes citent également sndPlaySound mais ceci est uniquement pour la compatibilité ascendante. Alors, ne l'utilisez pas!
Vous pouvez également être intéressé par ceci:
procedure PlayWinSound(SystemSoundName: string);
begin
Winapi.MMSystem.PlaySound(PChar(SystemSoundName), 0, SND_ASYNC);
end;
{ All available constants are defined in the registry under the path HKEY_CURRENT_USER -> AppEvents -> Schemes -> Apps -> .Default.
System sounds:
SystemEXCLAMATION - Note)
SystemHAND - Critical Stop)
SystemQUESTION - Question)
SystemSTART - Windows-Start)
SystemEXIT - Windows-Shutdown)
SystemASTERIX - Star)
RESTOREUP - Enlarge)
RESTOREDOWN - Shrink)
MENUCOMMAND - Menu)
MENUPOPUP - Pop-Up)
MAXIMIZE - Maximize)
MINIMIZE - Minimize)
MAILBEEP - New Mail)
OPEN - Open Application)
CLOSE - Close Application)
APPGPFAULT - Program Error)
Asterisk - played when a popup alert is displayed, like a warning message.
Calendar Reminder - played when a Calendar event is taking place.
Critical Battery Alarm - played when your battery reaches its critical level.
Critical Stop - played when a fatal error occurs.
Default Beep - played for multiple reasons, depending on what you do. For example, it will play if you try to select a parent window before closing the active one.
Desktop Mail Notif - played when you receive a message in your desktop email client.
Device Connect - played when you connect a device to your computer. For example, when you insert a memory stick.
Device Disconnect - played when you disconnect a device from your computer.
Device Connect Failed - played when something happened with the device that you were trying to connect.
Exclamation - played when you try to do something that is not supported by Windows.
Instant Message Notif - played when you receive an instant message.
Low Battery Alarm - played when the battery is running low.
Message Nudge - played when you receive a BUZZ in an instant message.
New Fax Notification - played when you receive a fax via your fax-modem.
New Mail Notification - played when you receive an email message.
New Text Message Notif - played when you receive a text message.
NFP Completion - played when the transfer of data via NFC between your Windows device and another device is completed.
NFP Connection - played when your Windows device is connecting to another device via NFC.
Notification - played when a default notification from a program or app is displayed.
System Notification - played when a system notification is displayed. }
sndPlaySound - Pourquoi ne pas l'utiliser? http://www.xtremevbtalk.com/general/35559-difference-sndplaysound-playsound.html – Ampere
Vous pouvez ajouter un lien MSDN: https://msdn.microsoft.com/en-us/library/dd743680%28v=vs. 85% 29.aspx – EMBarbosa
Alors pourquoi Embarcadero utilise-t-il encore sndPlaySound dans ses nouveaux projets? –
- 1. Extrait le fichier wav du fichier vidéo
- 2. comment lire un fichier
- 3. Comment puis-je lire un fichier son (mp3, wav, etc.) directement sans application associée?
- 4. Comment déboguer un fichier DLL dans Delphi
- 5. Comment lire un fichier et écrire dans un fichier texte?
- 6. Comment lire et écrire Delphi 2010 RibbonApplicationMenuBar Articles récents dans un fichier
- 7. Comment lire un fichier pim.vol
- 8. PCM wav au fichier vox
- 9. Fractionner le fichier wmv/wav dans l'application WinForms
- 10. Comment créer un fichier virtuel dans l'application Delphi
- 11. DFC lire un fichier
- 12. Affichage de la hauteur de fichier WAV
- 13. Encoder le fichier wav à pcm
- 14. Fichiers batch: comment lire un fichier?
- 15. Comment lire un fichier csv avec python
- 16. Comment écrire des repères/marqueurs dans un fichier WAV dans .NET
- 17. Lire dans un fichier avec html droit
- 18. Lire des fichiers dans un fichier JAR
- 19. Lire un fichier bogue dans VB.NET?
- 20. VB.NET obtention des attributs d'un fichier .wav
- 21. Java - fichier audio wav de sous-échantillonnage
- 22. Comment puis-je convertir un fichier HTML dans un fichier pdf dans Delphi
- 23. Comment lire un fichier wave envoyé par le serveur?
- 24. Enregistrement d'un fichier WAV sur le disque
- 25. Comment lire CDATA dans un fichier XML avec PowerShell?
- 26. Comment lire XML envoyé avec XMLHTTP dans un fichier codebehind?
- 27. Comment puis-je lire un fichier MIB SNMP dans C#?
- 28. Comment lire un fichier de propriétés externe dans Maven
- 29. Comment appeler une valeur de tableau et l'utiliser pour lire un fichier son?
- 30. Comment puis-je lire un fichier midi avec .NET compact framework 2.0?
simple. Utilisez MMsystem.PlaySound. Utilisez-le comme ceci: PlaySound (pchar (FileName), 1, SND_ASYNC ou SND_FILENAME); – Ampere