Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / Sound.xsp
1 #############################################################################
2 ## Name:        XS/Sound.xsp
3 ## Purpose:     XS++ for wxSound class
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     27/06/2006
7 ## RCS-ID:      $Id: Sound.xsp 2560 2009-05-17 08:33:45Z mbarbon $
8 ## Copyright:   (c) 2006, 2009 Mattia Barbon
9 ## Licence:     This program is free software; you can redistribute it and/or
10 ##              modify it under the same terms as Perl itself
11 #############################################################################
12
13 %module{Wx};
14
15 %typemap{wxSound*}{simple};
16
17 %{
18 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
19
20 #include <wx/sound.h>
21 %}
22
23 %name{Wx::Sound} class wxSound
24 {
25     %name{newDefault} wxSound();
26     %name{newFile} wxSound( const wxString& fileName );
27
28 %{
29 static void
30 wxSound::CLONE()
31   CODE:
32     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
33 %}
34     ## // thread OK
35     ~wxSound()
36         %code{% wxPli_thread_sv_unregister( aTHX_ "Wx::Sound", THIS, ST(0) );
37                 delete THIS;
38                 %};
39
40     %name{Create} bool Create( const wxString& fileName );
41
42     bool Play( unsigned flags = wxSOUND_ASYNC );
43     bool IsOk();
44 };
45
46 %{
47 void
48 new( ... )
49   PPCODE:
50     BEGIN_OVERLOAD()
51         MATCH_VOIDM_REDISP( newDefault )
52         MATCH_ANY_REDISP( newFile )
53     END_OVERLOAD( "Wx::Choicebook::new" )
54
55 wxSound*
56 wxSound::newData( data )
57     SV* data
58   CODE:
59     STRLEN len;
60     const wxByte* buffer = (wxByte*) SvPV( data, len );
61     RETVAL = new wxSound( len, buffer );
62   OUTPUT: RETVAL
63
64 #if !defined(__WXMAC__)
65
66 bool
67 wxSound::CreateData( data )
68     SV* data
69   CODE:
70     STRLEN len;
71     const wxByte* buffer = (wxByte*) SvPV( data, len );
72     RETVAL = THIS->Create( len, buffer );
73   OUTPUT: RETVAL
74
75 #endif
76
77 void
78 Stop()
79   CODE:
80     wxSound::Stop();
81
82 #if !defined( __WXMSW__ )
83
84 bool
85 IsPlaying()
86   CODE:
87     RETVAL = wxSound::IsPlaying();
88   OUTPUT: RETVAL
89
90 #endif
91 %}
92
93 %{
94 #endif
95 %}