Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Classes  ·  Annotées  ·  Hiérarchie  ·  Fonctions  ·  Structure  · 

QSound Class Reference


Access to the platform audio facilities. More...

#include <qsound.h>

Inherits QObject.

List of all member functions.

Public Members

  • QSound ( const QString & filename, QObject * parent=0, const char * name=0 ) 
  • ~QSound () 

Public Slots

  • void play () 

Static Public Members

  • bool available () 
  • void play ( const QString & filename ) 

Detailed Description

Access to the platform audio facilities.

Qt provides the most commonly required audio operation in GUI applications: playing a sound file asynchronously to the user. This is most simply accomplished with a single call:

    QSound::play("mysounds/bells.wav");

A second API is provided, where a QSound object is created from a sound file and is later be played:

    QSound bells("mysounds/bells.wav");

    bells.play();

Sounds played by the second model may use more memory but play more immediately than sounds played using the first model, depending on the underlying platform audio facilities.

On Microsoft Windows, the underlying multimedia system is used and hence WAVE format sound files are supported.

On X11, the Network Audio System is used if available, otherwise all operations work silently. NAS supports WAVE and AU files.

On Qt/Embedded, a built-in mixing sound server is used, which accesses /dev/dsp directly. Only a single WAVE format is supported, though that support can be configured when building Qt. The default is 11.025 kHz 8-bit mono PCM.

The availability of sound can be tested with QSound::available().


Member Function Documentation

QSound::QSound ( const QString & filename, QObject * parent=0, const char * name=0 )

Constructs a sound which can quickly play the sound in file named filename.

This can use more memory than the static play function.

The parent and name arguments (default 0) are passed on to the QObject constructor.

QSound::~QSound ()

Destructs the sound.

bool QSound::available () [static]

Returns TRUE if sound facilities exist on the platform. An application may choose to notify the user if sound is crucial the the application, or operate silently without bothering the user.

If no sound is available, QSound operation all work silently and quickly.

void QSound::play () [slot]

Starts the sound playing. The function returns immediately. Depending on the platform audio facilities, other sounds may stop or may be mixed with the new sound.

The sound can be played again at any time, possibly mixing or replacing previous plays of the sound.

void QSound::play ( const QString & filename ) [static]

Play the sound in file named filename.


Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):


This file is part of the Qt toolkit, copyright © 1995-2005 Trolltech, all rights reserved.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Extension de Qt WebKit

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 2.3
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web