]> git.saurik.com Git - wxWidgets.git/blame - utils/wxMMedia/sndfrag.h
1. wxLoad/SaveFileSelector return "wxString" instead of "char *"
[wxWidgets.git] / utils / wxMMedia / sndfrag.h
CommitLineData
4d6306eb
GL
1// /////////////////////////////////////////////////////////////////////////////
2// Name: sndfrag.h
3// Purpose: wxMMedia
4// Author: Guilhem Lavaux
5// Created: 1997
6// Updated: 1998
7// Copyright: (C) 1997, 1998, Guilhem Lavaux
8// License: wxWindows license
9// /////////////////////////////////////////////////////////////////////////////
10#ifndef __SND_frag_H__
11#define __SND_frag_H__
12#ifdef __GNUG__
13#pragma interface
14#endif
15
16#ifdef WX_PRECOMP
17#include "wx_prec.h"
18#else
19#include "wx/wx.h"
20#endif
21#include "sndsnd.h"
22
23///
24class wxFragmentBuffer {
25protected:
26 wxSound *m_iodrv;
27
28 ///
29 wxUint8 m_maxoq, m_maxiq;
30
31 ///
32 typedef enum {
33 wxBUFFER_FREE,
34 wxBUFFER_FFILLED,
35 wxBUFFER_TOFREE
36 } BufState;
37public:
38 ///
39 typedef struct {
40 char *data;
41 ///
42 char *user_data;
43 ///
44 wxUint32 size, ptr;
45 ///
46 wxList *buffers;
47 ///
48 BufState state;
49 } wxFragBufPtr;
50protected:
51 ///
52 wxFragBufPtr *m_optrs, *m_iptrs;
53 ///
54 wxFragBufPtr *m_lstoptrs, *m_lstiptrs;
55 ///
56 bool m_buf2free, m_dontq, m_freeing;
926c550d
GL
57 ///
58 wxSoundDataFormat m_drvformat;
4d6306eb
GL
59public:
60 ///
61 wxFragmentBuffer(wxSound& io_drv);
62 ///
63 virtual ~wxFragmentBuffer();
64
65 ///
66 virtual void AllocIOBuffer() = 0;
67 ///
68 virtual void FreeIOBuffer() = 0;
69
70 ///
71 void AbortBuffer(wxSndBuffer *buf);
72
73 ///
74 wxFragBufPtr *FindFreeBuffer(wxFragBufPtr *list, wxUint8 max_queue);
75 ///
76 bool NotifyOutputBuffer(wxSndBuffer *buf);
77 ///
78 bool NotifyInputBuffer(wxSndBuffer *buf);
79
80 ///
81 void OnBufferFinished(wxFragBufPtr *ptr);
82
83 ///
84 virtual bool OnBufferFilled(wxFragBufPtr *ptr, wxSndMode mode) = 0;
85
86 ///
87 inline wxSndBuffer *LastBuffer() {
88 wxNode *node = m_iodrv->m_buffers.Last();
89
90 if (!node) return NULL;
91 return (wxSndBuffer *)node->Data();
92 }
93 ///
94 inline wxSndBuffer *FirstBuffer() {
95 wxNode *node = m_iodrv->m_buffers.First();
96
97 if (!node) return NULL;
98 return (wxSndBuffer *)node->Data();
99 }
100protected:
101 void FreeBufToFree(bool force = FALSE);
102 void ClearBuffer(wxFragBufPtr *ptr);
103};
104
105#endif