2004-10-08 00:47:47 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: sound.h
|
|
|
|
// Purpose: wxSound class (loads and plays short Windows .wav files).
|
|
|
|
// Optional on non-Windows platforms.
|
|
|
|
// Author: Ryan Norton
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2004-10-02
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Ryan Norton
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2004-10-07 08:53:48 +00:00
|
|
|
|
2004-10-08 00:47:47 +00:00
|
|
|
#ifndef _WX_COCOA_SOUND_H_
|
|
|
|
#define _WX_COCOA_SOUND_H_
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
|
|
|
#pragma interface "sound.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if wxUSE_SOUND
|
|
|
|
|
|
|
|
#include "wx/object.h"
|
2004-10-18 22:12:57 +00:00
|
|
|
#include "wx/cocoa/ObjcRef.h"
|
2004-10-08 00:47:47 +00:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxSound : public wxSoundBase
|
|
|
|
{
|
|
|
|
public:
|
2004-10-18 21:41:34 +00:00
|
|
|
wxSound();
|
|
|
|
wxSound(const wxString& fileName, bool isResource = false);
|
|
|
|
wxSound(int size, const wxByte* data);
|
|
|
|
~wxSound();
|
2004-10-08 00:47:47 +00:00
|
|
|
|
|
|
|
public:
|
2004-10-18 21:41:34 +00:00
|
|
|
bool Create(const wxString& fileName, bool isResource = false);
|
2004-10-18 22:12:57 +00:00
|
|
|
bool IsOk() const
|
|
|
|
{ return m_cocoaNSSound; }
|
2004-10-18 21:41:34 +00:00
|
|
|
static void Stop();
|
|
|
|
static bool IsPlaying();
|
2004-10-08 00:47:47 +00:00
|
|
|
|
2004-10-18 21:41:34 +00:00
|
|
|
inline WX_NSSound GetNSSound()
|
2004-10-18 22:12:57 +00:00
|
|
|
{ return m_cocoaNSSound; }
|
2004-10-08 00:47:47 +00:00
|
|
|
protected:
|
2004-10-18 21:41:34 +00:00
|
|
|
bool DoPlay(unsigned flags) const;
|
2004-10-08 00:47:47 +00:00
|
|
|
|
|
|
|
private:
|
2004-10-18 22:12:57 +00:00
|
|
|
WX_NSSound m_cocoaNSSound; //NSSound handle
|
2004-10-08 00:47:47 +00:00
|
|
|
wxString m_sndname; //file path
|
|
|
|
int m_waveLength; //size of file in memory mode
|
2004-10-18 22:12:57 +00:00
|
|
|
static const wxObjcAutoRefFromAlloc<struct objc_object *> sm_cocoaDelegate;
|
2004-10-08 00:47:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
// _WX_COCOA_SOUND_H_
|