replicate the remove-all-trailing whitespace commit(s) in master
This commit is contained in:
@@ -430,7 +430,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
||||
}
|
||||
|
||||
/* Separate windows */
|
||||
|
||||
|
||||
WM::Manager::instance().register_window (&key_editor);
|
||||
WM::Manager::instance().register_window (&session_option_editor);
|
||||
WM::Manager::instance().register_window (&speaker_config_window);
|
||||
@@ -592,13 +592,13 @@ ARDOUR_UI::post_engine ()
|
||||
|
||||
if (ARDOUR_COMMAND_LINE::show_key_actions) {
|
||||
|
||||
|
||||
|
||||
vector<string> paths;
|
||||
vector<string> labels;
|
||||
vector<string> tooltips;
|
||||
vector<string> keys;
|
||||
vector<Glib::RefPtr<Gtk::Action> > actions;
|
||||
|
||||
|
||||
Gtkmm2ext::ActionMap::get_all_actions (paths, labels, tooltips, keys, actions);
|
||||
|
||||
vector<string>::iterator k;
|
||||
@@ -617,7 +617,7 @@ ARDOUR_UI::post_engine ()
|
||||
AudioEngine::instance()->stop ();
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
/* this being a GUI and all, we want peakfiles */
|
||||
|
||||
AudioFileSource::set_build_peakfiles (true);
|
||||
@@ -5130,7 +5130,7 @@ ARDOUR_UI::setup_toplevel_window (Gtk::Window& window, const string& name, void*
|
||||
if (!window_icons.empty()) {
|
||||
window.set_default_icon_list (window_icons);
|
||||
}
|
||||
|
||||
|
||||
Gtkmm2ext::WindowTitle title (Glib::get_application_name());
|
||||
|
||||
if (!name.empty()) {
|
||||
@@ -5164,15 +5164,15 @@ ARDOUR_UI::key_event_handler (GdkEventKey* ev, Gtk::Window* event_window)
|
||||
/* until we get ardour bindings working, we are not handling key
|
||||
* releases yet.
|
||||
*/
|
||||
|
||||
|
||||
if (ev->type != GDK_KEY_PRESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (event_window == &_main_window) {
|
||||
|
||||
window = event_window;
|
||||
|
||||
|
||||
/* find current tab contents */
|
||||
|
||||
Gtk::Widget* w = _tabs.get_nth_page (_tabs.get_current_page());
|
||||
@@ -5184,25 +5184,25 @@ ARDOUR_UI::key_event_handler (GdkEventKey* ev, Gtk::Window* event_window)
|
||||
}
|
||||
|
||||
DEBUG_TRACE (DEBUG::Accelerators, string_compose ("main window key event, bindings = %1, global = %2\n", bindings, &global_bindings));
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
window = event_window;
|
||||
|
||||
|
||||
/* see if window uses ardour binding system */
|
||||
|
||||
bindings = reinterpret_cast<Gtkmm2ext::Bindings*>(window->get_data ("ardour-bindings"));
|
||||
}
|
||||
}
|
||||
|
||||
/* An empty binding set is treated as if it doesn't exist */
|
||||
|
||||
|
||||
if (bindings && bindings->empty()) {
|
||||
bindings = 0;
|
||||
}
|
||||
|
||||
|
||||
return key_press_focus_accelerator_handler (*window, ev, bindings);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev, Gtkmm2ext::Bindings* bindings)
|
||||
{
|
||||
@@ -5217,14 +5217,14 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
|
||||
Gtkmm2ext::possibly_translate_mod_to_make_legal_accelerator(modifier);
|
||||
|
||||
if (focus) {
|
||||
|
||||
|
||||
/* some widget has keyboard focus */
|
||||
|
||||
if (GTK_IS_ENTRY(focus) || Keyboard::some_magic_widget_has_focus()) {
|
||||
|
||||
/* A particular kind of focusable widget currently has keyboard
|
||||
* focus. All unmodified key events should go to that widget
|
||||
* first and not be used as an accelerator by default
|
||||
* first and not be used as an accelerator by default
|
||||
*/
|
||||
|
||||
special_handling_of_unmodified_accelerators = true;
|
||||
@@ -5271,9 +5271,9 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
|
||||
all "normal text" accelerators.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if (!special_handling_of_unmodified_accelerators || (ev->state & mask)) {
|
||||
|
||||
|
||||
/* no special handling or there are modifiers in effect: accelerate first */
|
||||
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\tactivate, then propagate\n");
|
||||
@@ -5286,7 +5286,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
|
||||
if (bindings) {
|
||||
|
||||
DEBUG_TRACE (DEBUG::Accelerators, string_compose ("\tusing Ardour bindings %1 for this event\n", bindings));
|
||||
|
||||
|
||||
if (bindings->activate (k, Bindings::Press)) {
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\t\thandled\n");
|
||||
return true;
|
||||
@@ -5294,47 +5294,47 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
|
||||
}
|
||||
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\tnot yet handled, try global bindings\n");
|
||||
|
||||
|
||||
if (global_bindings && global_bindings->activate (k, Bindings::Press)) {
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\t\thandled\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\tnot accelerated, now propagate\n");
|
||||
|
||||
|
||||
if (gtk_window_propagate_key_event (win, ev)) {
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\tpropagate handled\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
/* no modifiers, propagate first */
|
||||
|
||||
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\tpropagate, then activate\n");
|
||||
|
||||
|
||||
if (gtk_window_propagate_key_event (win, ev)) {
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\thandled by propagate\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\tpropagation didn't handle, so activate\n");
|
||||
KeyboardKey k (ev->state, ev->keyval);
|
||||
KeyboardKey k (ev->state, ev->keyval);
|
||||
|
||||
if (bindings) {
|
||||
|
||||
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\tusing Ardour bindings for this window\n");
|
||||
|
||||
|
||||
|
||||
if (bindings->activate (k, Bindings::Press)) {
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\t\thandled\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\tnot yet handled, try global bindings\n");
|
||||
|
||||
|
||||
if (global_bindings && global_bindings->activate (k, Bindings::Press)) {
|
||||
DEBUG_TRACE (DEBUG::Accelerators, "\t\thandled\n");
|
||||
return true;
|
||||
|
||||
@@ -225,7 +225,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||
XMLNode* mixer_settings () const;
|
||||
XMLNode* keyboard_settings () const;
|
||||
XMLNode* tearoff_settings (const char*) const;
|
||||
|
||||
|
||||
void save_ardour_state ();
|
||||
gboolean configure_handler (GdkEventConfigure* conf);
|
||||
|
||||
@@ -325,7 +325,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||
Gtk::Window& main_window () { return _main_window; }
|
||||
|
||||
void setup_toplevel_window (Gtk::Window&, const std::string& name, void* owner);
|
||||
|
||||
|
||||
/* called from a static C function */
|
||||
|
||||
GtkNotebook* tab_window_root_drop (GtkNotebook* src,
|
||||
@@ -373,14 +373,14 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||
bool first_time_engine_run;
|
||||
|
||||
bool tabs_button_event (GdkEventButton* ev);
|
||||
|
||||
|
||||
void show_tabbable (Gtkmm2ext::Tabbable*);
|
||||
void hide_tabbable (Gtkmm2ext::Tabbable*);
|
||||
void detach_tabbable (Gtkmm2ext::Tabbable*);
|
||||
void attach_tabbable (Gtkmm2ext::Tabbable*);
|
||||
|
||||
void tabbable_state_change (Gtkmm2ext::Tabbable&);
|
||||
|
||||
|
||||
void toggle_meterbridge ();
|
||||
|
||||
int setup_windows ();
|
||||
@@ -402,7 +402,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||
|
||||
void session_dirty_changed ();
|
||||
void update_title ();
|
||||
|
||||
|
||||
void map_transport_state ();
|
||||
int32_t do_engine_start ();
|
||||
|
||||
@@ -652,7 +652,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||
|
||||
RCOptionEditor* rc_option_editor;
|
||||
Gtk::HBox rc_option_editor_placeholder;
|
||||
|
||||
|
||||
WM::Proxy<SpeakerDialog> speaker_config_window;
|
||||
WM::Proxy<AddRouteDialog> add_route_dialog;
|
||||
WM::Proxy<About> about;
|
||||
@@ -679,7 +679,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||
BigClockWindow* create_big_clock_window();
|
||||
GlobalPortMatrixWindow* create_global_port_matrix (ARDOUR::DataType);
|
||||
KeyEditor* create_key_editor ();
|
||||
|
||||
|
||||
ARDOUR::SystemExec *video_server_process;
|
||||
|
||||
void handle_locations_change (ARDOUR::Location*);
|
||||
@@ -831,7 +831,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||
void tabs_page_removed (Gtk::Widget*, guint page_number);
|
||||
bool key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev, Gtkmm2ext::Bindings*);
|
||||
bool try_gtk_accel_binding (GtkWindow* win, GdkEventKey* ev, bool translate, GdkModifierType modifier);
|
||||
|
||||
|
||||
bool main_window_delete_event (GdkEventAny*);
|
||||
bool idle_ask_about_quit ();
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@ ARDOUR_UI::tabs_button_event (GdkEventButton* ev)
|
||||
* translate before computing if event is inside the
|
||||
* close button.
|
||||
*/
|
||||
|
||||
|
||||
close_button->get_toplevel()->translate_coordinates (_tabs, alloc.get_x(), alloc.get_y(), dx, dy);
|
||||
|
||||
|
||||
if (ev->x >= dx &&
|
||||
ev->y >= dy &&
|
||||
ev->x < dx + alloc.get_width() &&
|
||||
@@ -100,7 +100,7 @@ ARDOUR_UI::tabs_button_event (GdkEventButton* ev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,13 +62,13 @@ ARDOUR_UI::we_have_dependents ()
|
||||
{
|
||||
install_actions ();
|
||||
load_bindings ();
|
||||
|
||||
|
||||
ProcessorBox::register_actions ();
|
||||
|
||||
/* Global, editor, mixer, processor box actions are defined now. Link
|
||||
them with any bindings, so that GTK does not get a chance to define
|
||||
the GTK accel map entries first when we ask the GtkUIManager to
|
||||
create menus/widgets.
|
||||
create menus/widgets.
|
||||
|
||||
If GTK adds the actions to its accel map before we do, we lose our
|
||||
freedom to use any keys. More precisely, we can use any keys, but
|
||||
@@ -81,9 +81,9 @@ ARDOUR_UI::we_have_dependents ()
|
||||
importantly they don't have menus showing the bindings, so it is
|
||||
less of an issue.
|
||||
*/
|
||||
|
||||
|
||||
Gtkmm2ext::Bindings::associate_all ();
|
||||
|
||||
|
||||
editor->setup_tooltips ();
|
||||
editor->UpdateAllTransportClocks.connect (sigc::mem_fun (*this, &ARDOUR_UI::update_transport_clocks));
|
||||
|
||||
@@ -92,7 +92,7 @@ ARDOUR_UI::we_have_dependents ()
|
||||
tabbable_state_change (*editor);
|
||||
tabbable_state_change (*mixer);
|
||||
tabbable_state_change (*rc_option_editor);
|
||||
|
||||
|
||||
/* all actions are defined */
|
||||
|
||||
ActionManager::load_menus (ARDOUR_COMMAND_LINE::menus_file);
|
||||
@@ -101,7 +101,7 @@ ARDOUR_UI::we_have_dependents ()
|
||||
mixer->track_editor_selection ();
|
||||
|
||||
/* catch up on parameters */
|
||||
|
||||
|
||||
boost::function<void (std::string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
|
||||
Config->map_parameters (pc);
|
||||
|
||||
@@ -171,7 +171,7 @@ ARDOUR_UI::tab_window_root_drop (GtkNotebook* src,
|
||||
win->present ();
|
||||
return nb->gobj();
|
||||
}
|
||||
|
||||
|
||||
return 0; /* what was that? */
|
||||
}
|
||||
|
||||
@@ -207,9 +207,9 @@ ARDOUR_UI::main_window_delete_event (GdkEventAny* ev)
|
||||
* the window manager/desktop can think we're taking too longer to
|
||||
* handle the "delete" event
|
||||
*/
|
||||
|
||||
Glib::signal_idle().connect (sigc::mem_fun (*this, &ARDOUR_UI::idle_ask_about_quit));
|
||||
|
||||
|
||||
Glib::signal_idle().connect (sigc::mem_fun (*this, &ARDOUR_UI::idle_ask_about_quit));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ ARDOUR_UI::setup_windows ()
|
||||
}
|
||||
|
||||
/* order of addition affects order seen in initial window display */
|
||||
|
||||
|
||||
rc_option_editor->add_to_notebook (_tabs, _("Preferences"));
|
||||
mixer->add_to_notebook (_tabs, _("Mixer"));
|
||||
editor->add_to_notebook (_tabs, _("Editor"));
|
||||
@@ -292,7 +292,7 @@ ARDOUR_UI::setup_windows ()
|
||||
main_vpacker.pack_start (top_packer, false, false);
|
||||
|
||||
/* now add the transport frame to the top of main window */
|
||||
|
||||
|
||||
main_vpacker.pack_start (transport_frame, false, false);
|
||||
main_vpacker.pack_start (_tabs, true, true);
|
||||
|
||||
@@ -305,7 +305,7 @@ ARDOUR_UI::setup_windows ()
|
||||
setup_tooltips ();
|
||||
|
||||
_main_window.signal_delete_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::main_window_delete_event));
|
||||
|
||||
|
||||
/* pack the main vpacker into the main window and show everything
|
||||
*/
|
||||
|
||||
@@ -327,12 +327,12 @@ ARDOUR_UI::setup_windows ()
|
||||
|
||||
if ((prop = mnode->property (X_("y"))) != 0) {
|
||||
y = atoi (prop->value());
|
||||
}
|
||||
}
|
||||
|
||||
if ((prop = mnode->property (X_("w"))) != 0) {
|
||||
w = atoi (prop->value());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((prop = mnode->property (X_("h"))) != 0) {
|
||||
h = atoi (prop->value());
|
||||
}
|
||||
@@ -340,17 +340,17 @@ ARDOUR_UI::setup_windows ()
|
||||
if (x >= 0 && y >= 0 && w >= 0 && h >= 0) {
|
||||
_main_window.set_position (Gtk::WIN_POS_NONE);
|
||||
}
|
||||
|
||||
|
||||
if (x >= 0 && y >= 0) {
|
||||
_main_window.move (x, y);
|
||||
}
|
||||
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
_main_window.set_default_size (w, h);
|
||||
}
|
||||
|
||||
std::string current_tab;
|
||||
|
||||
|
||||
if ((prop = mnode->property (X_("current-tab"))) != 0) {
|
||||
current_tab = prop->value();
|
||||
} else {
|
||||
@@ -364,10 +364,10 @@ ARDOUR_UI::setup_windows ()
|
||||
_tabs.set_current_page (_tabs.page_num (editor->contents()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_main_window.show_all ();
|
||||
setup_toplevel_window (_main_window, "", this);
|
||||
|
||||
|
||||
_tabs.signal_switch_page().connect (sigc::mem_fun (*this, &ARDOUR_UI::tabs_switch));
|
||||
_tabs.signal_page_removed().connect (sigc::mem_fun (*this, &ARDOUR_UI::tabs_page_removed));
|
||||
_tabs.signal_page_added().connect (sigc::mem_fun (*this, &ARDOUR_UI::tabs_page_added));
|
||||
|
||||
@@ -322,7 +322,7 @@ ARDOUR_UI::unload_session (bool hide_stuff)
|
||||
|
||||
update_buffer_load ();
|
||||
update_title ();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ ARDOUR_UI::show_tabbable (Tabbable* t)
|
||||
if (!t) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
t->make_visible ();
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ ARDOUR_UI::tabbable_state_change (Tabbable& t)
|
||||
{
|
||||
std::vector<std::string> insensitive_action_names;
|
||||
std::vector<std::string> sensitive_action_names;
|
||||
Glib::RefPtr<Action> action;
|
||||
Glib::RefPtr<Action> action;
|
||||
std::string downcased_name = downcase (t.name());
|
||||
|
||||
if (t.tabbed()) {
|
||||
@@ -385,7 +385,7 @@ ARDOUR_UI::tabbable_state_change (Tabbable& t)
|
||||
insensitive_action_names.push_back (string_compose ("hide-%1", downcased_name));
|
||||
sensitive_action_names.push_back (string_compose ("show-%1", downcased_name));
|
||||
sensitive_action_names.push_back (string_compose ("detach-%1", downcased_name));
|
||||
|
||||
|
||||
} else if (t.window_visible()) {
|
||||
|
||||
insensitive_action_names.push_back (string_compose ("detach-%1", downcased_name));
|
||||
@@ -398,7 +398,7 @@ ARDOUR_UI::tabbable_state_change (Tabbable& t)
|
||||
/* not currently visible. allow user to retab it or just make
|
||||
* it visible.
|
||||
*/
|
||||
|
||||
|
||||
insensitive_action_names.push_back (string_compose ("detach-%1", downcased_name));
|
||||
insensitive_action_names.push_back (string_compose ("hide-%1", downcased_name));
|
||||
sensitive_action_names.push_back (string_compose ("show-%1", downcased_name));
|
||||
|
||||
@@ -229,11 +229,11 @@ ARDOUR_UI::install_actions ()
|
||||
global_actions.register_action (common_actions, X_("hide-editor"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), editor));
|
||||
global_actions.register_action (common_actions, X_("hide-mixer"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), mixer));
|
||||
global_actions.register_action (common_actions, X_("hide-preferences"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), rc_option_editor));
|
||||
|
||||
|
||||
global_actions.register_action (common_actions, X_("attach-editor"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), editor));
|
||||
global_actions.register_action (common_actions, X_("attach-mixer"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), mixer));
|
||||
global_actions.register_action (common_actions, X_("attach-preferences"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), rc_option_editor));
|
||||
|
||||
|
||||
global_actions.register_action (common_actions, X_("detach-editor"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), editor));
|
||||
global_actions.register_action (common_actions, X_("detach-mixer"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), mixer));
|
||||
global_actions.register_action (common_actions, X_("detach-preferences"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), rc_option_editor));
|
||||
@@ -660,7 +660,7 @@ ARDOUR_UI::save_ardour_state ()
|
||||
}
|
||||
|
||||
main_window_node.add_property (X_("current-tab"), current_tab);
|
||||
|
||||
|
||||
/* Windows */
|
||||
|
||||
WM::Manager::instance().add_state (*window_node);
|
||||
|
||||
@@ -745,7 +745,7 @@ Editor::Editor ()
|
||||
/* need to show the "contents" widget so that notebook will show if tab is switched to
|
||||
*/
|
||||
|
||||
global_hpacker.show ();
|
||||
global_hpacker.show ();
|
||||
|
||||
/* register actions now so that set_state() can find them and set toggles/checks etc */
|
||||
|
||||
@@ -1258,7 +1258,7 @@ Editor::update_title ()
|
||||
if (!own_window()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (_session) {
|
||||
bool dirty = _session->dirty();
|
||||
|
||||
@@ -2183,7 +2183,7 @@ Editor::set_state (const XMLNode& node, int version)
|
||||
set_id (node);
|
||||
|
||||
Tabbable::set_state (node, version);
|
||||
|
||||
|
||||
if (_session && (prop = node.property ("playhead"))) {
|
||||
framepos_t pos;
|
||||
sscanf (prop->value().c_str(), "%" PRIi64, &pos);
|
||||
@@ -2414,13 +2414,13 @@ Editor::get_state ()
|
||||
node->add_property ("id", buf);
|
||||
|
||||
node->add_child_nocopy (Tabbable::get_state());
|
||||
|
||||
|
||||
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&edit_pane)->gobj()));
|
||||
node->add_property("edit-horizontal-pane-pos", string(buf));
|
||||
node->add_property("notebook-shrunk", _notebook_shrunk ? "1" : "0");
|
||||
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&editor_summary_pane)->gobj()));
|
||||
node->add_property("edit-vertical-pane-pos", string(buf));
|
||||
|
||||
|
||||
maybe_add_mixer_strip_width (*node);
|
||||
|
||||
node->add_property ("zoom-focus", enum_2_string (zoom_focus));
|
||||
@@ -2885,9 +2885,9 @@ Editor::setup_toolbar ()
|
||||
if (!ARDOUR::Profile->get_trx()) {
|
||||
mode_box->pack_start (edit_mode_selector, false, false);
|
||||
}
|
||||
|
||||
|
||||
mode_box->pack_start (*mouse_mode_box, false, false);
|
||||
|
||||
|
||||
/* Zoom */
|
||||
|
||||
_zoom_box.set_spacing (2);
|
||||
@@ -5607,12 +5607,12 @@ Editor::session_going_away ()
|
||||
stop_step_editing ();
|
||||
|
||||
if (own_window()) {
|
||||
|
||||
|
||||
/* get rid of any existing editor mixer strip */
|
||||
|
||||
|
||||
WindowTitle title(Glib::get_application_name());
|
||||
title += _("Editor");
|
||||
|
||||
|
||||
own_window()->set_title (title.get_string());
|
||||
}
|
||||
|
||||
@@ -5851,7 +5851,7 @@ Gtk::Window*
|
||||
Editor::use_own_window (bool and_fill_it)
|
||||
{
|
||||
bool new_window = !own_window();
|
||||
|
||||
|
||||
Gtk::Window* win = Tabbable::use_own_window (and_fill_it);
|
||||
|
||||
if (win && new_window) {
|
||||
@@ -5862,39 +5862,39 @@ Editor::use_own_window (bool and_fill_it)
|
||||
// win->signal_realize().connect (*this, &Editor::on_realize);
|
||||
win->signal_event().connect (sigc::mem_fun (*this, &Editor::generic_event_handler));
|
||||
win->set_data ("ardour-bindings", bindings);
|
||||
|
||||
|
||||
update_title ();
|
||||
}
|
||||
|
||||
DisplaySuspender ds;
|
||||
contents().show_all ();
|
||||
|
||||
|
||||
/* XXX: this is a bit unfortunate; it would probably
|
||||
be nicer if we could just call show () above rather
|
||||
than needing the show_all ()
|
||||
*/
|
||||
|
||||
|
||||
/* re-hide stuff if necessary */
|
||||
editor_list_button_toggled ();
|
||||
parameter_changed ("show-summary");
|
||||
parameter_changed ("show-group-tabs");
|
||||
parameter_changed ("show-zoom-tools");
|
||||
|
||||
|
||||
/* now reset all audio_time_axis heights, because widgets might need
|
||||
to be re-hidden
|
||||
*/
|
||||
|
||||
|
||||
TimeAxisView *tv;
|
||||
|
||||
|
||||
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
|
||||
tv = (static_cast<TimeAxisView*>(*i));
|
||||
tv->reset_height ();
|
||||
}
|
||||
|
||||
|
||||
if (current_mixer_strip) {
|
||||
current_mixer_strip->hide_things ();
|
||||
current_mixer_strip->parameter_changed ("mixer-element-visibility");
|
||||
}
|
||||
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||
ARDOUR::Session* session() const { return _session; }
|
||||
|
||||
Gtk::Window* use_own_window (bool and_fill_it);
|
||||
|
||||
|
||||
void first_idle ();
|
||||
virtual bool have_idled () const { return _have_idled; }
|
||||
|
||||
|
||||
@@ -477,7 +477,7 @@ Editor::register_actions ()
|
||||
Glib::RefPtr<ActionGroup> mouse_mode_actions = myactions.create_action_group (X_("MouseMode"));
|
||||
RadioAction::Group mouse_mode_group;
|
||||
|
||||
act = myactions.register_toggle_action (mouse_mode_actions, "set-mouse-mode-object-range", _("Smart Object Mode"), sigc::mem_fun (*this, &Editor::mouse_mode_object_range_toggled));
|
||||
act = myactions.register_toggle_action (mouse_mode_actions, "set-mouse-mode-object-range", _("Smart Object Mode"), sigc::mem_fun (*this, &Editor::mouse_mode_object_range_toggled));
|
||||
smart_mode_action = Glib::RefPtr<ToggleAction>::cast_static (act);
|
||||
smart_mode_button.set_related_action (smart_mode_action);
|
||||
smart_mode_button.set_text (_("Smart"));
|
||||
@@ -488,27 +488,27 @@ Editor::register_actions ()
|
||||
mouse_move_button.set_icon (Gtkmm2ext::ArdourIcon::ToolGrab);
|
||||
mouse_move_button.set_name ("mouse mode button");
|
||||
|
||||
act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-range", _("Range Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseRange));
|
||||
act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-range", _("Range Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseRange));
|
||||
mouse_select_button.set_related_action (act);
|
||||
mouse_select_button.set_icon (Gtkmm2ext::ArdourIcon::ToolRange);
|
||||
mouse_select_button.set_name ("mouse mode button");
|
||||
|
||||
act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-draw", _("Note Drawing Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseDraw));
|
||||
act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-draw", _("Note Drawing Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseDraw));
|
||||
mouse_draw_button.set_related_action (act);
|
||||
mouse_draw_button.set_icon (Gtkmm2ext::ArdourIcon::ToolDraw);
|
||||
mouse_draw_button.set_name ("mouse mode button");
|
||||
|
||||
act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-audition", _("Audition Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseAudition));
|
||||
act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-audition", _("Audition Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseAudition));
|
||||
mouse_audition_button.set_related_action (act);
|
||||
mouse_audition_button.set_icon (Gtkmm2ext::ArdourIcon::ToolAudition);
|
||||
mouse_audition_button.set_name ("mouse mode button");
|
||||
|
||||
act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-timefx", _("Time FX Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseTimeFX));
|
||||
act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-timefx", _("Time FX Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseTimeFX));
|
||||
mouse_timefx_button.set_related_action (act);
|
||||
mouse_timefx_button.set_icon (Gtkmm2ext::ArdourIcon::ToolStretch);
|
||||
mouse_timefx_button.set_name ("mouse mode button");
|
||||
|
||||
act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-content", _("Content Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseContent));
|
||||
act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-content", _("Content Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseContent));
|
||||
mouse_content_button.set_related_action (act);
|
||||
mouse_content_button.set_icon (Gtkmm2ext::ArdourIcon::ToolContent);
|
||||
mouse_content_button.set_name ("mouse mode button");
|
||||
@@ -742,7 +742,7 @@ Editor::register_actions ()
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
tact->set_active (true);
|
||||
|
||||
myactions.register_action (editor_actions, X_("toggle-midi-input-active"), _("Toggle MIDI Input Active for Editor-Selected Tracks/Busses"),
|
||||
myactions.register_action (editor_actions, X_("toggle-midi-input-active"), _("Toggle MIDI Input Active for Editor-Selected Tracks/Busses"),
|
||||
sigc::bind (sigc::mem_fun (*this, &Editor::toggle_midi_input_active), false));
|
||||
}
|
||||
|
||||
|
||||
@@ -505,7 +505,7 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool from_headers)
|
||||
if (!toplevel) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!UIConfiguration::instance().get_autoscroll_editor () || autoscroll_active ()) {
|
||||
return;
|
||||
}
|
||||
@@ -744,7 +744,7 @@ Editor::autoscroll_canvas ()
|
||||
x = min (max ((ArdourCanvas::Coord) x, autoscroll_boundary.x0), autoscroll_boundary.x1);
|
||||
}
|
||||
y = min (max ((ArdourCanvas::Coord) y, autoscroll_boundary.y0), autoscroll_boundary.y1);
|
||||
|
||||
|
||||
toplevel->translate_coordinates (*_track_canvas_viewport, x, y, cx, cy);
|
||||
|
||||
ArdourCanvas::Duple d = _track_canvas->window_to_canvas (ArdourCanvas::Duple (cx, cy));
|
||||
|
||||
@@ -60,9 +60,9 @@ KeyEditor::KeyEditor ()
|
||||
last_keyval = 0;
|
||||
|
||||
notebook.signal_switch_page ().connect (sigc::mem_fun (*this, &KeyEditor::page_change));
|
||||
|
||||
|
||||
vpacker.pack_start (notebook, true, true);
|
||||
|
||||
|
||||
if (!ARDOUR::Profile->get_sae()) {
|
||||
|
||||
Label* hint = manage (new Label (_("Select an action, then press the key(s) to (re)set its shortcut")));
|
||||
@@ -126,7 +126,7 @@ KeyEditor::on_key_press_event (GdkEventKey* ev)
|
||||
* keys will be used by GTK to change the selection/treeview cursor
|
||||
* position
|
||||
*/
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ KeyEditor::Tab::unbind ()
|
||||
if (!(*i)[columns.bindable]) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bindings->remove (action, Gtkmm2ext::Bindings::Press, true);
|
||||
(*i)[columns.binding] = string ();
|
||||
}
|
||||
@@ -244,7 +244,7 @@ KeyEditor::Tab::bind (GdkEventKey* release_event, guint pressed_key)
|
||||
|
||||
void
|
||||
KeyEditor::Tab::populate ()
|
||||
{
|
||||
{
|
||||
vector<string> paths;
|
||||
vector<string> labels;
|
||||
vector<string> tooltips;
|
||||
@@ -261,7 +261,7 @@ KeyEditor::Tab::populate ()
|
||||
vector<string>::iterator t;
|
||||
vector<string>::iterator l;
|
||||
vector<Glib::RefPtr<Action> >::iterator a;
|
||||
|
||||
|
||||
model->clear ();
|
||||
|
||||
for (a = actions.begin(), l = labels.begin(), k = keys.begin(), p = paths.begin(), t = tooltips.begin(); l != labels.end(); ++k, ++p, ++t, ++l, ++a) {
|
||||
@@ -273,7 +273,7 @@ KeyEditor::Tab::populate ()
|
||||
|
||||
string category = parts[1];
|
||||
string action_name = parts[2];
|
||||
|
||||
|
||||
if (action_name.empty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -301,13 +301,13 @@ KeyEditor::Tab::populate ()
|
||||
/* now set up the child row that we're about to fill
|
||||
* out with information
|
||||
*/
|
||||
|
||||
|
||||
row = *(model->append (parent.children()));
|
||||
|
||||
} else {
|
||||
|
||||
/* category/group is present, so just add the child row */
|
||||
|
||||
|
||||
row = *(model->append ((*r->second)->children()));
|
||||
|
||||
}
|
||||
@@ -315,7 +315,7 @@ KeyEditor::Tab::populate ()
|
||||
/* add this action */
|
||||
|
||||
/* use the "visible label" as the action name */
|
||||
|
||||
|
||||
if (l->empty ()) {
|
||||
/* no label, try using the tooltip instead */
|
||||
row[columns.name] = *t;
|
||||
|
||||
@@ -40,7 +40,7 @@ class KeyEditor : public ArdourWindow
|
||||
KeyEditor ();
|
||||
|
||||
void add_tab (std::string const &name, Gtkmm2ext::Bindings&);
|
||||
|
||||
|
||||
protected:
|
||||
bool on_key_press_event (GdkEventKey*);
|
||||
bool on_key_release_event (GdkEventKey*);
|
||||
@@ -50,12 +50,12 @@ class KeyEditor : public ArdourWindow
|
||||
{
|
||||
public:
|
||||
Tab (KeyEditor&, std::string const &name, Gtkmm2ext::Bindings*);
|
||||
|
||||
|
||||
void populate ();
|
||||
void unbind ();
|
||||
void bind (GdkEventKey* release_event, guint pressed_key);
|
||||
void action_selected ();
|
||||
|
||||
|
||||
struct KeyEditorColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
KeyEditorColumns () {
|
||||
add (name);
|
||||
@@ -70,12 +70,12 @@ class KeyEditor : public ArdourWindow
|
||||
Gtk::TreeModelColumn<bool> bindable;
|
||||
Gtk::TreeModelColumn<Glib::RefPtr<Gtk::Action> > action;
|
||||
};
|
||||
|
||||
|
||||
Gtk::VBox vpacker;
|
||||
/* give KeyEditor full access to these. This is just a helper
|
||||
class with no special semantics
|
||||
*/
|
||||
|
||||
|
||||
KeyEditor& owner;
|
||||
std::string name;
|
||||
Gtkmm2ext::Bindings* bindings;
|
||||
@@ -86,7 +86,7 @@ class KeyEditor : public ArdourWindow
|
||||
};
|
||||
|
||||
friend class Tab;
|
||||
|
||||
|
||||
Gtk::VBox vpacker;
|
||||
Gtk::Notebook notebook;
|
||||
Gtk::Button unbind_button;
|
||||
|
||||
@@ -79,7 +79,7 @@ MixerActor::register_actions ()
|
||||
myactions.register_action (group, "scroll-left", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &MixerActor::scroll_left));
|
||||
myactions.register_action (group, "scroll-right", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &MixerActor::scroll_right));
|
||||
|
||||
myactions.register_action (group, "toggle-midi-input-active", _("Toggle MIDI Input Active for Mixer-Selected Tracks/Busses"),
|
||||
myactions.register_action (group, "toggle-midi-input-active", _("Toggle MIDI Input Active for Mixer-Selected Tracks/Busses"),
|
||||
sigc::bind (sigc::mem_fun (*this, &MixerActor::toggle_midi_input_active), false));
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class MixerActor : virtual public sigc::trackable
|
||||
Gtkmm2ext::ActionMap myactions;
|
||||
RouteProcessorSelection _selection;
|
||||
RouteUISelection _route_targets;
|
||||
|
||||
|
||||
virtual void set_route_targets_for_operation () = 0;
|
||||
|
||||
void solo_action ();
|
||||
|
||||
@@ -108,7 +108,7 @@ Mixer_UI::Mixer_UI ()
|
||||
/* bindings was already set in MixerActor constructor */
|
||||
|
||||
_content.set_data ("ardour-bindings", bindings);
|
||||
|
||||
|
||||
scroller.set_can_default (true);
|
||||
// set_default (scroller);
|
||||
|
||||
@@ -2085,20 +2085,16 @@ Mixer_UI::update_title ()
|
||||
n = "*" + n;
|
||||
}
|
||||
|
||||
if (own_window()) {
|
||||
WindowTitle title (n);
|
||||
title += S_("Window|Mixer");
|
||||
title += Glib::get_application_name ();
|
||||
own_window()->set_title (title.get_string());
|
||||
}
|
||||
WindowTitle title (n);
|
||||
title += S_("Window|Mixer");
|
||||
title += Glib::get_application_name ();
|
||||
own_window()->set_title (title.get_string());
|
||||
|
||||
} else {
|
||||
|
||||
if (own_window()) {
|
||||
WindowTitle title (S_("Window|Mixer"));
|
||||
title += Glib::get_application_name ();
|
||||
own_window()->set_title (title.get_string());
|
||||
}
|
||||
WindowTitle title (S_("Window|Mixer"));
|
||||
title += Glib::get_application_name ();
|
||||
own_window()->set_title (title.get_string());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2172,11 +2168,8 @@ Mixer_UI::maximise_mixer_space ()
|
||||
return;
|
||||
}
|
||||
|
||||
Gtk::Window* win = (Gtk::Window*) get_toplevel();
|
||||
|
||||
if (win) {
|
||||
win->fullscreen ();
|
||||
_maximised = true;
|
||||
if (_maximised) {
|
||||
return;
|
||||
}
|
||||
|
||||
_window->fullscreen ();
|
||||
@@ -2190,11 +2183,8 @@ Mixer_UI::restore_mixer_space ()
|
||||
return;
|
||||
}
|
||||
|
||||
Gtk::Window* win = (Gtk::Window*) get_toplevel();
|
||||
|
||||
if (win) {
|
||||
win->unfullscreen();
|
||||
_maximised = false;
|
||||
if (!_maximised) {
|
||||
return;
|
||||
}
|
||||
|
||||
own_window()->unfullscreen();
|
||||
|
||||
@@ -361,7 +361,10 @@ class Mixer_UI : public Gtkmm2ext::Tabbable, public PBD::ScopedConnectionList, p
|
||||
=======
|
||||
void create_own_window ();
|
||||
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> the basics of tabbed
|
||||
=======
|
||||
>>>>>>> replicate the remove-all-trailing whitespace commit(s) in master
|
||||
/// true if we are in fullscreen mode
|
||||
bool _maximised;
|
||||
|
||||
|
||||
@@ -852,7 +852,7 @@ MonitorSection::register_actions ()
|
||||
string action_name;
|
||||
string action_descr;
|
||||
Glib::RefPtr<Action> act;
|
||||
|
||||
|
||||
monitor_actions = myactions.create_action_group (X_("Monitor"));
|
||||
|
||||
myactions.register_toggle_action (monitor_actions, "monitor-mono", _("Switch monitor to mono"),
|
||||
|
||||
@@ -362,11 +362,11 @@ PluginUIWindow::on_key_press_event (GdkEventKey* event)
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/* for us to be getting key press events, there really
|
||||
MUST be a _pluginui, but just to be safe, check ...
|
||||
*/
|
||||
|
||||
|
||||
if (_pluginui) {
|
||||
_pluginui->grab_focus();
|
||||
if (_pluginui->non_gtk_gui()) {
|
||||
@@ -379,7 +379,7 @@ PluginUIWindow::on_key_press_event (GdkEventKey* event)
|
||||
} else {
|
||||
return relay_key_press (event, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2835,11 +2835,11 @@ ProcessorBox::register_actions ()
|
||||
sigc::ptr_fun (ProcessorBox::rb_copy));
|
||||
delete_action = processor_box_actions.register_action (popup_act_grp, X_("delete"), _("Delete"),
|
||||
sigc::ptr_fun (ProcessorBox::rb_delete));
|
||||
|
||||
|
||||
ActionManager::plugin_selection_sensitive_actions.push_back (cut_action);
|
||||
ActionManager::plugin_selection_sensitive_actions.push_back (copy_action);
|
||||
ActionManager::plugin_selection_sensitive_actions.push_back (delete_action);
|
||||
|
||||
|
||||
paste_action = processor_box_actions.register_action (popup_act_grp, X_("paste"), _("Paste"),
|
||||
sigc::ptr_fun (ProcessorBox::rb_paste));
|
||||
rename_action = processor_box_actions.register_action (popup_act_grp, X_("rename"), _("Rename"),
|
||||
|
||||
@@ -82,27 +82,27 @@ class ProcessorWindowProxy : public WM::ProxyBase
|
||||
public:
|
||||
ProcessorWindowProxy (std::string const &, ProcessorBox *, boost::weak_ptr<ARDOUR::Processor>);
|
||||
~ProcessorWindowProxy();
|
||||
|
||||
|
||||
Gtk::Window* get (bool create = false);
|
||||
|
||||
|
||||
boost::weak_ptr<ARDOUR::Processor> processor () const {
|
||||
return _processor;
|
||||
}
|
||||
|
||||
|
||||
ARDOUR::SessionHandlePtr* session_handle();
|
||||
void show_the_right_window ();
|
||||
void set_custom_ui_mode(bool use_custom) { want_custom = use_custom; }
|
||||
|
||||
|
||||
int set_state (const XMLNode&, int);
|
||||
XMLNode& get_state ();
|
||||
|
||||
|
||||
private:
|
||||
ProcessorBox* _processor_box;
|
||||
boost::weak_ptr<ARDOUR::Processor> _processor;
|
||||
bool is_custom;
|
||||
bool want_custom;
|
||||
bool _valid;
|
||||
|
||||
|
||||
void processor_going_away ();
|
||||
PBD::ScopedConnection going_away_connection;
|
||||
};
|
||||
|
||||
@@ -423,7 +423,7 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
|
||||
PBD::Signal0<void> MouseModeChanged;
|
||||
|
||||
Gtkmm2ext::Bindings* bindings;
|
||||
|
||||
|
||||
protected:
|
||||
friend class DisplaySuspender;
|
||||
virtual void suspend_route_redisplay () = 0;
|
||||
|
||||
@@ -3254,7 +3254,7 @@ Gtk::Window*
|
||||
RCOptionEditor::use_own_window (bool and_fill_it)
|
||||
{
|
||||
bool new_window = !own_window();
|
||||
|
||||
|
||||
Gtk::Window* win = Tabbable::use_own_window (and_fill_it);
|
||||
|
||||
if (win && new_window) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
void populate_sync_options ();
|
||||
|
||||
Gtk::Window* use_own_window (bool and_fill_it);
|
||||
|
||||
|
||||
private:
|
||||
void parameter_changed (std::string const &);
|
||||
void ltc_generator_volume_changed ();
|
||||
|
||||
@@ -684,7 +684,7 @@ StepEntry::register_actions ()
|
||||
|
||||
|
||||
RadioAction::Group dot_group;
|
||||
|
||||
|
||||
myactions.register_radio_action (group, dot_group, "no-dotted", _("No Dotted Notes"), sigc::mem_fun (*this, &StepEntry::dot_change), 0);
|
||||
myactions.register_radio_action (group, dot_group, "toggle-dotted", _("Toggled Dotted Notes"), sigc::mem_fun (*this, &StepEntry::dot_change), 1);
|
||||
myactions.register_radio_action (group, dot_group, "toggle-double-dotted", _("Toggled Double-Dotted Notes"), sigc::mem_fun (*this, &StepEntry::dot_change), 2);
|
||||
|
||||
@@ -308,12 +308,12 @@ ARDOUR_UI_UTILS::emulate_key_event (unsigned int keyval)
|
||||
GdkKeymap *keymap = gdk_keymap_get_for_display (display);
|
||||
GdkKeymapKey *keymapkey = NULL;
|
||||
gint n_keys;
|
||||
|
||||
|
||||
if (!gdk_keymap_get_entries_for_keyval(keymap, keyval, &keymapkey, &n_keys)) return false;
|
||||
if (n_keys !=1) { g_free(keymapkey); return false;}
|
||||
|
||||
Gtk::Window& main_window (ARDOUR_UI::instance()->main_window());
|
||||
|
||||
|
||||
GdkEventKey ev;
|
||||
ev.type = GDK_KEY_PRESS;
|
||||
ev.window = main_window.get_window()->gobj();
|
||||
|
||||
@@ -196,7 +196,7 @@ ProxyBase::setup ()
|
||||
{
|
||||
WindowProxy::setup ();
|
||||
set_session(_session);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------*/
|
||||
|
||||
|
||||
@@ -71,37 +71,37 @@ class Manager : public ARDOUR::SessionHandlePtr
|
||||
Windows _windows;
|
||||
Glib::RefPtr<Gtk::ActionGroup> window_actions;
|
||||
Gtk::Window* current_transient_parent;
|
||||
|
||||
|
||||
Manager();
|
||||
~Manager();
|
||||
|
||||
static Manager* _instance;
|
||||
};
|
||||
|
||||
|
||||
class ProxyBase : public ARDOUR::SessionHandlePtr, public Gtkmm2ext::WindowProxy
|
||||
{
|
||||
public:
|
||||
ProxyBase (const std::string& name, const std::string& menu_name);
|
||||
ProxyBase (const std::string& name, const std::string& menu_name, const XMLNode&);
|
||||
|
||||
|
||||
virtual ARDOUR::SessionHandlePtr* session_handle () = 0;
|
||||
|
||||
protected:
|
||||
void setup ();
|
||||
};
|
||||
|
||||
|
||||
class ProxyTemporary: public ProxyBase
|
||||
{
|
||||
public:
|
||||
ProxyTemporary (const std::string& name, Gtk::Window* win);
|
||||
~ProxyTemporary();
|
||||
|
||||
Gtk::Window* get (bool create = false) {
|
||||
|
||||
Gtk::Window* get (bool create = false) {
|
||||
(void) create;
|
||||
return _window;
|
||||
}
|
||||
|
||||
Gtk::Window* operator->() {
|
||||
|
||||
Gtk::Window* operator->() {
|
||||
return _window;
|
||||
}
|
||||
|
||||
@@ -114,11 +114,11 @@ class ProxyWithConstructor: public ProxyBase
|
||||
public:
|
||||
ProxyWithConstructor (const std::string& name, const std::string& menu_name, const boost::function<T*()>& c)
|
||||
: ProxyBase (name, menu_name) , creator (c) {}
|
||||
|
||||
|
||||
ProxyWithConstructor (const std::string& name, const std::string& menu_name, const boost::function<T*()>& c, const XMLNode* node)
|
||||
: ProxyBase (name, menu_name, *node) , creator (c) {}
|
||||
|
||||
Gtk::Window* get (bool create = false) {
|
||||
|
||||
Gtk::Window* get (bool create = false) {
|
||||
if (!_window) {
|
||||
if (!create) {
|
||||
return 0;
|
||||
@@ -128,13 +128,13 @@ class ProxyWithConstructor: public ProxyBase
|
||||
|
||||
if (_window) {
|
||||
setup ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _window;
|
||||
}
|
||||
|
||||
T* operator->() {
|
||||
T* operator->() {
|
||||
return dynamic_cast<T*> (get (true));
|
||||
}
|
||||
|
||||
@@ -165,8 +165,8 @@ class Proxy : public ProxyBase
|
||||
|
||||
Proxy (const std::string& name, const std::string& menu_name, const XMLNode* node)
|
||||
: ProxyBase (name, menu_name, *node) {}
|
||||
|
||||
Gtk::Window* get (bool create = false) {
|
||||
|
||||
Gtk::Window* get (bool create = false) {
|
||||
if (!_window) {
|
||||
if (!create) {
|
||||
return 0;
|
||||
@@ -176,13 +176,13 @@ class Proxy : public ProxyBase
|
||||
|
||||
if (_window) {
|
||||
setup ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _window;
|
||||
}
|
||||
|
||||
T* operator->() {
|
||||
T* operator->() {
|
||||
return dynamic_cast<T*> (get(true));
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ class Proxy : public ProxyBase
|
||||
/* may return null */
|
||||
return dynamic_cast<T*> (_window);
|
||||
}
|
||||
|
||||
|
||||
void set_session(ARDOUR::Session *s) {
|
||||
SessionHandlePtr::set_session (s);
|
||||
ARDOUR::SessionHandlePtr* sp = session_handle ();
|
||||
@@ -199,7 +199,7 @@ class Proxy : public ProxyBase
|
||||
dynamic_cast<T*>(_window)->set_session(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
boost::function<T*()> creator;
|
||||
};
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ACBaseCodec.cpp
|
||||
Abstract: ACBaseCodec.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
//=============================================================================
|
||||
// Includes
|
||||
@@ -93,27 +93,27 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out
|
||||
outPropertyDataSize = SizeOf32(CFStringRef);
|
||||
outWritable = false;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyManufacturerCFString:
|
||||
outPropertyDataSize = SizeOf32(CFStringRef);
|
||||
outWritable = false;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyFormatCFString:
|
||||
outPropertyDataSize = SizeOf32(CFStringRef);
|
||||
outWritable = false;
|
||||
break;
|
||||
break;
|
||||
#endif
|
||||
case kAudioCodecPropertyRequiresPacketDescription:
|
||||
outPropertyDataSize = SizeOf32(UInt32);
|
||||
outWritable = false;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyMinimumNumberInputPackets :
|
||||
outPropertyDataSize = SizeOf32(UInt32);
|
||||
outWritable = false;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyMinimumNumberOutputPackets :
|
||||
outPropertyDataSize = SizeOf32(UInt32);
|
||||
outWritable = false;
|
||||
@@ -123,39 +123,39 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out
|
||||
outPropertyDataSize = SizeOf32(AudioStreamBasicDescription);
|
||||
outWritable = true;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertySupportedInputFormats:
|
||||
case kAudioCodecPropertyInputFormatsForOutputFormat:
|
||||
outPropertyDataSize = GetNumberSupportedInputFormats() * SizeOf32(AudioStreamBasicDescription);
|
||||
outWritable = false;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyCurrentOutputFormat:
|
||||
outPropertyDataSize = SizeOf32(AudioStreamBasicDescription);
|
||||
outWritable = true;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertySupportedOutputFormats:
|
||||
case kAudioCodecPropertyOutputFormatsForInputFormat:
|
||||
outPropertyDataSize = GetNumberSupportedOutputFormats() * SizeOf32(AudioStreamBasicDescription);
|
||||
outWritable = false;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyMagicCookie:
|
||||
outPropertyDataSize = GetMagicCookieByteSize();
|
||||
outWritable = true;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyInputBufferSize:
|
||||
outPropertyDataSize = SizeOf32(UInt32);
|
||||
outWritable = false;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyUsedInputBufferSize:
|
||||
outPropertyDataSize = SizeOf32(UInt32);
|
||||
outWritable = false;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyIsInitialized:
|
||||
outPropertyDataSize = SizeOf32(UInt32);
|
||||
outWritable = false;
|
||||
@@ -165,7 +165,7 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out
|
||||
outPropertyDataSize = SizeOf32(UInt32) * 2; // Mono, stereo
|
||||
outWritable = false;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyPrimeMethod:
|
||||
outPropertyDataSize = SizeOf32(UInt32);
|
||||
outWritable = false;
|
||||
@@ -184,35 +184,35 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out
|
||||
default:
|
||||
CODEC_THROW(kAudioCodecUnknownPropertyError);
|
||||
break;
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
|
||||
{
|
||||
UInt32 thePacketsToGet;
|
||||
|
||||
|
||||
switch(inPropertyID)
|
||||
{
|
||||
#if !BUILD_ADEC_LIB
|
||||
case kAudioCodecPropertyNameCFString:
|
||||
{
|
||||
if (ioPropertyDataSize != SizeOf32(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
|
||||
|
||||
CABundleLocker lock;
|
||||
CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("unknown codec"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
|
||||
*(CFStringRef*)outPropertyData = name;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case kAudioCodecPropertyManufacturerCFString:
|
||||
{
|
||||
if (ioPropertyDataSize != SizeOf32(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
|
||||
|
||||
CABundleLocker lock;
|
||||
CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Apple, Inc."), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
|
||||
*(CFStringRef*)outPropertyData = name;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
// If called on the device these should return nothing but 0
|
||||
@@ -226,24 +226,24 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
|
||||
case kAudioCodecPropertyRequiresPacketDescription:
|
||||
if(ioPropertyDataSize == SizeOf32(UInt32))
|
||||
{
|
||||
*reinterpret_cast<UInt32*>(outPropertyData) = 0;
|
||||
*reinterpret_cast<UInt32*>(outPropertyData) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyMinimumNumberInputPackets :
|
||||
if(ioPropertyDataSize != SizeOf32(UInt32)) CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
*(UInt32*)outPropertyData = 1;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyMinimumNumberOutputPackets :
|
||||
if(ioPropertyDataSize != SizeOf32(UInt32)) CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
*(UInt32*)outPropertyData = 1;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyCurrentInputFormat:
|
||||
if(ioPropertyDataSize == SizeOf32(AudioStreamBasicDescription))
|
||||
{
|
||||
@@ -254,14 +254,14 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
|
||||
CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertySupportedInputFormats:
|
||||
case kAudioCodecPropertyInputFormatsForOutputFormat:
|
||||
thePacketsToGet = ioPropertyDataSize / SizeOf32(AudioStreamBasicDescription);
|
||||
GetSupportedInputFormats(reinterpret_cast<AudioStreamBasicDescription*>(outPropertyData), thePacketsToGet);
|
||||
ioPropertyDataSize = thePacketsToGet * SizeOf32(AudioStreamBasicDescription);
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyCurrentOutputFormat:
|
||||
if(ioPropertyDataSize == SizeOf32(AudioStreamBasicDescription))
|
||||
{
|
||||
@@ -272,14 +272,14 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
|
||||
CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertySupportedOutputFormats:
|
||||
case kAudioCodecPropertyOutputFormatsForInputFormat:
|
||||
thePacketsToGet = ioPropertyDataSize / SizeOf32(AudioStreamBasicDescription);
|
||||
GetSupportedOutputFormats(reinterpret_cast<AudioStreamBasicDescription*>(outPropertyData), thePacketsToGet);
|
||||
ioPropertyDataSize = thePacketsToGet * SizeOf32(AudioStreamBasicDescription);
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyMagicCookie:
|
||||
if(ioPropertyDataSize >= GetMagicCookieByteSize())
|
||||
{
|
||||
@@ -290,7 +290,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
|
||||
CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyInputBufferSize:
|
||||
if(ioPropertyDataSize == SizeOf32(UInt32))
|
||||
{
|
||||
@@ -301,7 +301,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
|
||||
CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyUsedInputBufferSize:
|
||||
if(ioPropertyDataSize == SizeOf32(UInt32))
|
||||
{
|
||||
@@ -312,7 +312,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
|
||||
CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyIsInitialized:
|
||||
if(ioPropertyDataSize == SizeOf32(UInt32))
|
||||
{
|
||||
@@ -323,7 +323,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
|
||||
CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyAvailableNumberChannels:
|
||||
if(ioPropertyDataSize == SizeOf32(UInt32) * 2)
|
||||
{
|
||||
@@ -373,7 +373,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope
|
||||
default:
|
||||
CODEC_THROW(kAudioCodecUnknownPropertyError);
|
||||
break;
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper
|
||||
{
|
||||
CODEC_THROW(kAudioCodecIllegalOperationError);
|
||||
}
|
||||
|
||||
|
||||
switch(inPropertyID)
|
||||
{
|
||||
case kAudioCodecPropertyCurrentInputFormat:
|
||||
@@ -397,7 +397,7 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper
|
||||
CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyCurrentOutputFormat:
|
||||
if(inPropertyDataSize == SizeOf32(AudioStreamBasicDescription))
|
||||
{
|
||||
@@ -408,11 +408,11 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper
|
||||
CODEC_THROW(kAudioCodecBadPropertySizeError);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyMagicCookie:
|
||||
SetMagicCookie(inPropertyData, inPropertyDataSize);
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecPropertyMinimumNumberOutputPackets :
|
||||
case kAudioCodecPropertyMinimumNumberInputPackets :
|
||||
case kAudioCodecPropertyInputBufferSize:
|
||||
@@ -432,7 +432,7 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper
|
||||
case kAudioCodecPropertyRequiresPacketDescription:
|
||||
CODEC_THROW(kAudioCodecIllegalOperationError);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
CODEC_THROW(kAudioCodecUnknownPropertyError);
|
||||
break;
|
||||
@@ -462,13 +462,13 @@ void ACBaseCodec::GetSupportedInputFormats(AudioStreamBasicDescription* outInput
|
||||
{
|
||||
UInt32 theNumberFormats = (UInt32)mInputFormatList.size();
|
||||
ioNumberInputFormats = (theNumberFormats < ioNumberInputFormats) ? theNumberFormats : ioNumberInputFormats;
|
||||
|
||||
|
||||
FormatList::const_iterator theIterator = mInputFormatList.begin();
|
||||
theNumberFormats = ioNumberInputFormats;
|
||||
while((theNumberFormats > 0) && (theIterator != mInputFormatList.end()))
|
||||
{
|
||||
*outInputFormats = *theIterator;
|
||||
|
||||
|
||||
++outInputFormats;
|
||||
--theNumberFormats;
|
||||
std::advance(theIterator, 1);
|
||||
@@ -501,13 +501,13 @@ void ACBaseCodec::GetSupportedOutputFormats(AudioStreamBasicDescription* outOutp
|
||||
{
|
||||
UInt32 theNumberFormats = (UInt32)mOutputFormatList.size();
|
||||
ioNumberOutputFormats = (theNumberFormats < ioNumberOutputFormats) ? theNumberFormats : ioNumberOutputFormats;
|
||||
|
||||
|
||||
FormatList::const_iterator theIterator = mOutputFormatList.begin();
|
||||
theNumberFormats = ioNumberOutputFormats;
|
||||
while((theNumberFormats > 0) && (theIterator != mOutputFormatList.end()))
|
||||
{
|
||||
*outOutputFormats = *theIterator;
|
||||
|
||||
|
||||
++outOutputFormats;
|
||||
--theNumberFormats;
|
||||
std::advance(theIterator, 1);
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ACBaseCodec.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#if !defined(__ACBaseCodec_h__)
|
||||
#define __ACBaseCodec_h__
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void ReallocateInputBuffer(UInt32 inInputBufferByteSize) = 0;
|
||||
|
||||
|
||||
bool mIsInitialized;
|
||||
|
||||
// Format Management
|
||||
@@ -102,13 +102,13 @@ public:
|
||||
|
||||
void GetCurrentInputFormat(AudioStreamBasicDescription& outInputFormat);
|
||||
virtual void SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat);
|
||||
|
||||
|
||||
UInt32 GetNumberSupportedOutputFormats() const;
|
||||
void GetSupportedOutputFormats(AudioStreamBasicDescription* outOutputFormats, UInt32& ioNumberOutputFormats) const;
|
||||
|
||||
|
||||
void GetCurrentOutputFormat(AudioStreamBasicDescription& outOutputFormat);
|
||||
virtual void SetCurrentOutputFormat(const AudioStreamBasicDescription& inOutputFormat);
|
||||
|
||||
|
||||
virtual UInt32 GetMagicCookieByteSize() const;
|
||||
virtual void GetMagicCookie(void* outMagicCookieData, UInt32& ioMagicCookieDataByteSize) const;
|
||||
virtual void SetMagicCookie(const void* outMagicCookieData, UInt32 inMagicCookieDataByteSize);
|
||||
@@ -119,11 +119,11 @@ public:
|
||||
protected:
|
||||
void AddInputFormat(const AudioStreamBasicDescription& inInputFormat);
|
||||
void AddOutputFormat(const AudioStreamBasicDescription& inOutputFormat);
|
||||
|
||||
|
||||
OSType GetSubType();
|
||||
|
||||
|
||||
typedef std::vector<CAStreamBasicDescription> FormatList;
|
||||
|
||||
|
||||
FormatList mInputFormatList;
|
||||
#if TARGET_OS_WIN32
|
||||
// VC 2005 screws up if this is not aligned to 8-byte boundaries
|
||||
@@ -131,7 +131,7 @@ protected:
|
||||
#else
|
||||
CAStreamBasicDescription mInputFormat;
|
||||
#endif
|
||||
|
||||
|
||||
FormatList mOutputFormatList;
|
||||
#if TARGET_OS_WIN32
|
||||
// VC 2005 screws up if this is not aligned to 8-byte boundaries
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ACCodec.cpp
|
||||
Abstract: ACCodec.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
//=============================================================================
|
||||
// Includes
|
||||
@@ -83,18 +83,18 @@ ACCodec::~ACCodec()
|
||||
OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCodec *inThis)
|
||||
{
|
||||
OSStatus theError = kAudioCodecNoError;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
switch (inParameters->what)
|
||||
{
|
||||
// these selectors don't use the object pointer
|
||||
|
||||
|
||||
case kComponentOpenSelect:
|
||||
case kComponentCloseSelect:
|
||||
theError = ComponentBase::ComponentEntryDispatch(inParameters, inThis);
|
||||
break;
|
||||
|
||||
|
||||
case kComponentCanDoSelect:
|
||||
{
|
||||
switch (GetSelectorForCanDo(inParameters))
|
||||
@@ -115,7 +115,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
// these selectors use the object pointer
|
||||
if(inThis != NULL)
|
||||
@@ -125,16 +125,16 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
case kComponentVersionSelect:
|
||||
theError = inThis->Version();
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecGetPropertyInfoSelect:
|
||||
{
|
||||
PARAM(AudioCodecPropertyID, inPropertyID, 0, 3);
|
||||
PARAM(UInt32 *, outSize, 1, 3);
|
||||
PARAM(Boolean *, outWritable, 2, 3);
|
||||
|
||||
|
||||
UInt32 theSize = 0;
|
||||
Boolean isWritable = false;
|
||||
|
||||
|
||||
inThis->GetPropertyInfo(inPropertyID, theSize, isWritable);
|
||||
if(outSize != NULL)
|
||||
{
|
||||
@@ -146,13 +146,13 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecGetPropertySelect:
|
||||
{
|
||||
PARAM(AudioCodecPropertyID, inPropertyID, 0, 3);
|
||||
PARAM(UInt32 *, ioPropertyDataSize, 1, 3);
|
||||
PARAM(void *, outPropertyData, 2, 3);
|
||||
|
||||
|
||||
if((ioPropertyDataSize != NULL) && (outPropertyData != NULL))
|
||||
{
|
||||
inThis->GetProperty(inPropertyID, *ioPropertyDataSize, outPropertyData);
|
||||
@@ -163,13 +163,13 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecSetPropertySelect:
|
||||
{
|
||||
PARAM(AudioCodecPropertyID, inPropertyID, 0, 3);
|
||||
PARAM(UInt32, inPropertyDataSize, 1, 3);
|
||||
PARAM(const void *, inPropertyData, 2, 3);
|
||||
|
||||
|
||||
if(inPropertyData != NULL)
|
||||
{
|
||||
inThis->SetProperty(inPropertyID, inPropertyDataSize, inPropertyData);
|
||||
@@ -180,31 +180,31 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecInitializeSelect:
|
||||
{
|
||||
PARAM(const AudioStreamBasicDescription *, inInputFormat, 0, 4);
|
||||
PARAM(const AudioStreamBasicDescription *, inOutputFormat, 1, 4);
|
||||
PARAM(const void *, inMagicCookie, 2, 4);
|
||||
PARAM(UInt32, inMagicCookieByteSize, 3, 4);
|
||||
|
||||
|
||||
inThis->Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecUninitializeSelect:
|
||||
{
|
||||
inThis->Uninitialize();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecAppendInputDataSelect:
|
||||
{
|
||||
PARAM(const void *, inInputData, 0, 4);
|
||||
PARAM(UInt32 *, ioInputDataByteSize, 1, 4);
|
||||
PARAM(UInt32 *, ioNumberPackets, 2, 4);
|
||||
PARAM(const AudioStreamPacketDescription *, inPacketDescription, 3, 4);
|
||||
|
||||
|
||||
if((inInputData != NULL) && (ioInputDataByteSize != NULL))
|
||||
{
|
||||
if(ioNumberPackets != NULL)
|
||||
@@ -223,7 +223,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecProduceOutputDataSelect:
|
||||
{
|
||||
PARAM(void *, outOutputData, 0, 5);
|
||||
@@ -231,7 +231,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
PARAM(UInt32 *, ioNumberPackets, 2, 5);
|
||||
PARAM(AudioStreamPacketDescription *, outPacketDescription, 3, 5);
|
||||
PARAM(UInt32 *, outStatus, 4, 5);
|
||||
|
||||
|
||||
if((outOutputData != NULL) && (ioOutputDataByteSize != NULL) && (ioNumberPackets != NULL) && (outStatus != NULL))
|
||||
{
|
||||
*outStatus = inThis->ProduceOutputPackets(outOutputData, *ioOutputDataByteSize, *ioNumberPackets, outPacketDescription);
|
||||
@@ -246,7 +246,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
#if AC_NON_INTERLEAVED_SUPPORT
|
||||
case kAudioCodecAppendInputBufferListSelect:
|
||||
{
|
||||
@@ -254,7 +254,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
PARAM(UInt32 *, ioNumberPackets, 1, 4);
|
||||
PARAM(const AudioStreamPacketDescription *, inPacketDescription, 2, 4);
|
||||
PARAM(UInt32 *, outBytesConsumed, 3, 4);
|
||||
|
||||
|
||||
if((inBufferList != NULL) && (outBytesConsumed != NULL))
|
||||
{
|
||||
if(ioNumberPackets != NULL)
|
||||
@@ -273,14 +273,14 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioCodecProduceOutputBufferListSelect:
|
||||
{
|
||||
PARAM(AudioBufferList *, ioBufferList, 0, 4);
|
||||
PARAM(UInt32 *, ioNumberPackets, 1, 4);
|
||||
PARAM(AudioStreamPacketDescription *, outPacketDescription, 2, 4);
|
||||
PARAM(UInt32 *, outStatus, 3, 4);
|
||||
|
||||
|
||||
if((ioBufferList != NULL) && (ioNumberPackets != NULL) && (outStatus != NULL))
|
||||
{
|
||||
*outStatus = inThis->ProduceOutputBufferList(ioBufferList, *ioNumberPackets, outPacketDescription);
|
||||
@@ -296,13 +296,13 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
}
|
||||
break;
|
||||
#endif // AC_NON_INTERLEAVED_SUPPORT
|
||||
|
||||
|
||||
case kAudioCodecResetSelect:
|
||||
{
|
||||
inThis->Reset();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
theError = badComponentSelector;
|
||||
break;
|
||||
@@ -323,7 +323,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo
|
||||
{
|
||||
theError = kAudioCodecUnspecifiedError;
|
||||
}
|
||||
|
||||
|
||||
return theError;
|
||||
}
|
||||
#endif // !CA_USE_AUDIO_PLUGIN_ONLY && !TARGET_OS_IPHONE
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ACCodec.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#if !defined(__ACCodec_h__)
|
||||
#define __ACCodec_h__
|
||||
@@ -75,7 +75,7 @@ class ACCodec : public ComponentBase
|
||||
public:
|
||||
ACCodec(AudioComponentInstance inInstance);
|
||||
virtual ~ACCodec();
|
||||
|
||||
|
||||
#if !CA_USE_AUDIO_PLUGIN_ONLY && !TARGET_OS_IPHONE
|
||||
static OSStatus ComponentEntryDispatch(ComponentParameters *p, ACCodec *This);
|
||||
#endif
|
||||
@@ -91,10 +91,10 @@ public:
|
||||
virtual void Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize) = 0;
|
||||
virtual void Uninitialize() = 0;
|
||||
virtual void Reset() = 0;
|
||||
|
||||
|
||||
virtual void AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets, const AudioStreamPacketDescription* inPacketDescription) = 0;
|
||||
virtual void AppendInputBufferList(const AudioBufferList *ioBufferList, UInt32& ioNumberPackets, const AudioStreamPacketDescription *inPacketDescription, UInt32 *outBytesConsumed) = 0;
|
||||
|
||||
|
||||
virtual UInt32 ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets, AudioStreamPacketDescription* outPacketDescription) = 0;
|
||||
virtual UInt32 ProduceOutputBufferList(AudioBufferList *ioBufferList, UInt32& ioNumberPackets, AudioStreamPacketDescription *outPacketDescription) = 0;
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ACCodecDispatchTypes.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#if !defined(__ACCodecDispatchTypes_h__)
|
||||
#define __ACCodecDispatchTypes_h__
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ACConditionalMacros.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#if !defined(__ACConditionalMacros_h__)
|
||||
#define __ACConditionalMacros_h__
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ACPlugInDispatch.cpp
|
||||
Abstract: ACPlugInDispatch.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#if AUDIOCODECS_SUPPORT_PLUGINS
|
||||
#include "ACPlugInDispatch.h"
|
||||
@@ -242,10 +242,10 @@ AudioComponentMethod AudioCodecNonInterleavedEncoderLookup::Lookup (SInt16 selec
|
||||
AudioComponentMethod method = AudioCodecLookup::Lookup(selector);
|
||||
if (method)
|
||||
return method;
|
||||
|
||||
|
||||
if (selector == kAudioCodecAppendInputBufferListSelect)
|
||||
return (AudioComponentMethod)AppendInputBufferList;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -254,10 +254,10 @@ AudioComponentMethod AudioCodecNonInterleavedDecoderLookup::Lookup (SInt16 selec
|
||||
AudioComponentMethod method = AudioCodecLookup::Lookup(selector);
|
||||
if (method)
|
||||
return method;
|
||||
|
||||
|
||||
if (selector == kAudioCodecProduceOutputBufferListSelect)
|
||||
return (AudioComponentMethod)ProduceOutputBufferList;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
@@ -269,14 +269,14 @@ AudioComponentMethod AudioCodecHWCodecLookup::Lookup (SInt16 selector)
|
||||
{
|
||||
AudioComponentMethod method = AudioCodecLookup::Lookup(selector);
|
||||
if (method) return method;
|
||||
|
||||
|
||||
switch (selector) {
|
||||
case kAudioCodecAcquireHardwareSelect: return (AudioComponentMethod)AcquireHardware;
|
||||
case kAudioCodecReleaseHardwareSelect: return (AudioComponentMethod)ReleaseHardware;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
#endif // TARGET_OS_IPHONE && AUDIOCONV_HAVE_AMC
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ACPlugInDispatch.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __ACPlugInDispatch_h__
|
||||
#define __ACPlugInDispatch_h__
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ACSimpleCodec.cpp
|
||||
Abstract: ACSimpleCodec.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
//=============================================================================
|
||||
// Includes
|
||||
@@ -81,8 +81,8 @@ void ACSimpleCodec::Initialize(const AudioStreamBasicDescription* inInputFormat,
|
||||
if (mInputFormat.mBytesPerPacket == 0)
|
||||
{
|
||||
CODEC_THROW(kAudioCodecUnsupportedFormatError);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ACBaseCodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize);
|
||||
}
|
||||
|
||||
@@ -91,11 +91,11 @@ void ACSimpleCodec::Uninitialize()
|
||||
// get rid of the buffer
|
||||
delete[] mInputBuffer;
|
||||
mInputBuffer = NULL;
|
||||
|
||||
|
||||
// reset the ring buffer state
|
||||
mInputBufferStart = 0;
|
||||
mInputBufferEnd = 0;
|
||||
|
||||
|
||||
ACBaseCodec::Uninitialize();
|
||||
}
|
||||
|
||||
@@ -105,11 +105,11 @@ void ACSimpleCodec::Reset()
|
||||
if (mInputBuffer) { // could be called before allocated.
|
||||
memset(mInputBuffer, 0, mInputBufferByteSize);
|
||||
}
|
||||
|
||||
|
||||
// reset the ring buffer state
|
||||
mInputBufferStart = 0;
|
||||
mInputBufferEnd = 0;
|
||||
|
||||
|
||||
ACBaseCodec::Reset();
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ UInt32 ACSimpleCodec::GetInputBufferByteSize() const
|
||||
UInt32 ACSimpleCodec::GetUsedInputBufferByteSize() const
|
||||
{
|
||||
UInt32 theAnswer = 0;
|
||||
|
||||
|
||||
// this object uses a ring buffer
|
||||
if(mInputBufferStart <= mInputBufferEnd)
|
||||
{
|
||||
@@ -130,10 +130,10 @@ UInt32 ACSimpleCodec::GetUsedInputBufferByteSize() const
|
||||
}
|
||||
else
|
||||
{
|
||||
// the active region wraps around
|
||||
// the active region wraps around
|
||||
theAnswer = (mInputBufferByteSize - mInputBufferStart) + mInputBufferEnd;
|
||||
}
|
||||
|
||||
|
||||
return theAnswer;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ void ACSimpleCodec::AppendInputData(const void* inInputData, UInt32& ioInputData
|
||||
{
|
||||
// this buffer handling code doesn't care about such things as the packet descriptions
|
||||
if(!mIsInitialized) CODEC_THROW(kAudioCodecStateError);
|
||||
|
||||
|
||||
// this is a ring buffer we're dealing with, so we need to set up a few things
|
||||
UInt32 theUsedByteSize = GetUsedInputBufferByteSize();
|
||||
UInt32 theAvailableByteSize = GetInputBufferByteSize() - theUsedByteSize;
|
||||
@@ -150,51 +150,51 @@ void ACSimpleCodec::AppendInputData(const void* inInputData, UInt32& ioInputData
|
||||
UInt32 theMaxAvailableInputBytes = ioInputDataByteSize; // we can't consume more than we get
|
||||
|
||||
const Byte* theInputData = static_cast<const Byte*>(inInputData);
|
||||
|
||||
|
||||
// >>jamesmcc: added this because ioNumberPackets was not being updated if less was taken than given.
|
||||
// THIS ASSUMES CBR!
|
||||
UInt32 bytesPerPacketOfInput = mInputFormat.mBytesPerPacket;
|
||||
UInt32 theAvailablePacketSize = theAvailableByteSize / bytesPerPacketOfInput;
|
||||
|
||||
|
||||
UInt32 minPacketSize = ioNumberPackets < theAvailablePacketSize ? ioNumberPackets : theAvailablePacketSize;
|
||||
UInt32 minByteSize = minPacketSize * bytesPerPacketOfInput;
|
||||
|
||||
|
||||
// we can copy only as much data as there is or up to how much space is availiable
|
||||
ioNumberPackets = minPacketSize;
|
||||
ioInputDataByteSize = minByteSize;
|
||||
|
||||
|
||||
// ioInputDataByteSize had better be <= to theMaxAvailableInputBytes or we're screwed
|
||||
if (ioInputDataByteSize > theMaxAvailableInputBytes)
|
||||
{
|
||||
CODEC_THROW(kAudioCodecStateError);
|
||||
}
|
||||
// <<jamesmcc
|
||||
|
||||
// <<jamesmcc
|
||||
|
||||
// now we have to copy the data taking into account the wrap around and where the start is
|
||||
if(mInputBufferEnd + ioInputDataByteSize < mInputBufferByteSize)
|
||||
{
|
||||
// no wrap around here
|
||||
memcpy(mInputBuffer + mInputBufferEnd, theInputData, ioInputDataByteSize);
|
||||
|
||||
|
||||
// adjust the end point
|
||||
mInputBufferEnd += ioInputDataByteSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
// the copy will wrap
|
||||
|
||||
|
||||
// copy the first part
|
||||
UInt32 theBeforeWrapByteSize = mInputBufferByteSize - mInputBufferEnd;
|
||||
memcpy(mInputBuffer + mInputBufferEnd, theInputData, theBeforeWrapByteSize);
|
||||
|
||||
|
||||
// and the rest
|
||||
UInt32 theAfterWrapByteSize = ioInputDataByteSize - theBeforeWrapByteSize;
|
||||
memcpy(mInputBuffer, theInputData + theBeforeWrapByteSize, theAfterWrapByteSize);
|
||||
|
||||
|
||||
// adjust the end point
|
||||
mInputBufferEnd = theAfterWrapByteSize;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -202,46 +202,46 @@ void ACSimpleCodec::ZeroPadInputData(UInt32& ioNumberPackets, const AudioStreamP
|
||||
{
|
||||
// this buffer handling code doesn't care about such things as the packet descriptions
|
||||
if(!mIsInitialized) CODEC_THROW(kAudioCodecStateError);
|
||||
|
||||
|
||||
|
||||
|
||||
// this is a ring buffer we're dealing with, so we need to set up a few things
|
||||
UInt32 theUsedByteSize = GetUsedInputBufferByteSize();
|
||||
UInt32 theAvailableByteSize = GetInputBufferByteSize() - theUsedByteSize;
|
||||
|
||||
|
||||
// >>jamesmcc: added this because ioNumberPackets was not being updated if less was taken than given.
|
||||
// THIS ASSUMES CBR!
|
||||
UInt32 bytesPerPacketOfInput = mInputFormat.mBytesPerPacket;
|
||||
UInt32 theAvailablePacketSize = theAvailableByteSize / bytesPerPacketOfInput;
|
||||
|
||||
|
||||
UInt32 minPacketSize = ioNumberPackets < theAvailablePacketSize ? ioNumberPackets : theAvailablePacketSize;
|
||||
UInt32 minByteSize = minPacketSize * bytesPerPacketOfInput;
|
||||
|
||||
|
||||
// we can copy only as much data as there is or up to how much space is availiable
|
||||
ioNumberPackets = minPacketSize;
|
||||
|
||||
// <<jamesmcc
|
||||
|
||||
|
||||
// <<jamesmcc
|
||||
|
||||
// now we have to copy the data taking into account the wrap around and where the start is
|
||||
if(mInputBufferEnd + minByteSize < mInputBufferByteSize)
|
||||
{
|
||||
// no wrap around here
|
||||
memset(mInputBuffer + mInputBufferEnd, 0, minByteSize);
|
||||
|
||||
|
||||
// adjust the end point
|
||||
mInputBufferEnd += minByteSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
// the copy will wrap
|
||||
|
||||
|
||||
// copy the first part
|
||||
UInt32 theBeforeWrapByteSize = mInputBufferByteSize - mInputBufferEnd;
|
||||
memset(mInputBuffer + mInputBufferEnd, 0, theBeforeWrapByteSize);
|
||||
|
||||
|
||||
// and the rest
|
||||
UInt32 theAfterWrapByteSize = minByteSize - theBeforeWrapByteSize;
|
||||
memset(mInputBuffer, 0, theAfterWrapByteSize);
|
||||
|
||||
|
||||
// adjust the end point
|
||||
mInputBufferEnd = theAfterWrapByteSize;
|
||||
}
|
||||
@@ -252,32 +252,32 @@ void ACSimpleCodec::ConsumeInputData(UInt32 inConsumedByteSize)
|
||||
{
|
||||
// this is a convenience routine to make maintaining the ring buffer state easy
|
||||
UInt32 theContiguousRange = GetInputBufferContiguousByteSize();
|
||||
|
||||
|
||||
if(inConsumedByteSize > GetUsedInputBufferByteSize()) CODEC_THROW(kAudioCodecUnspecifiedError);
|
||||
|
||||
|
||||
if(inConsumedByteSize <= theContiguousRange)
|
||||
{
|
||||
// the region to consume doesn't wrap
|
||||
|
||||
|
||||
// figure out how much to consume
|
||||
inConsumedByteSize = (theContiguousRange < inConsumedByteSize) ? theContiguousRange : inConsumedByteSize;
|
||||
|
||||
|
||||
// clear the consumed bits
|
||||
memset(mInputBuffer + mInputBufferStart, 0, inConsumedByteSize);
|
||||
|
||||
|
||||
// adjust the start
|
||||
mInputBufferStart += inConsumedByteSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
// the region to consume will wrap
|
||||
|
||||
|
||||
// clear the bits to the end of the buffer
|
||||
memset(mInputBuffer + mInputBufferStart, 0, theContiguousRange);
|
||||
|
||||
|
||||
// now clear the bits left from the start
|
||||
memset(mInputBuffer, 0, inConsumedByteSize - theContiguousRange);
|
||||
|
||||
|
||||
// adjust the start
|
||||
mInputBufferStart = inConsumedByteSize - theContiguousRange;
|
||||
}
|
||||
@@ -287,24 +287,24 @@ void ACSimpleCodec::ConsumeInputData(UInt32 inConsumedByteSize)
|
||||
Byte* ACSimpleCodec::GetBytes(UInt32& ioNumberBytes) const
|
||||
{
|
||||
// if a client's algorithm has to have contiguous data and mInputBuffer wraps, then someone has to make a copy.
|
||||
// I can do it more efficiently than the client.
|
||||
|
||||
// I can do it more efficiently than the client.
|
||||
|
||||
if(!mIsInitialized) CODEC_THROW(kAudioCodecStateError);
|
||||
|
||||
UInt32 theUsedByteSize = GetUsedInputBufferByteSize();
|
||||
//UInt32 theAvailableByteSize = GetInputBufferByteSize() - theUsedByteSize;
|
||||
|
||||
|
||||
if (ioNumberBytes > theUsedByteSize) ioNumberBytes = theUsedByteSize;
|
||||
|
||||
|
||||
SInt32 leftOver = mInputBufferStart + ioNumberBytes - mInputBufferByteSize;
|
||||
|
||||
|
||||
if(leftOver > 0)
|
||||
{
|
||||
// need to copy beginning of buffer to the end.
|
||||
// need to copy beginning of buffer to the end.
|
||||
// We cleverly over allocated our buffer space to make this possible.
|
||||
memmove(mInputBuffer + mInputBufferByteSize, mInputBuffer, leftOver);
|
||||
}
|
||||
|
||||
|
||||
return GetInputBufferStart();
|
||||
}
|
||||
|
||||
@@ -312,17 +312,17 @@ Byte* ACSimpleCodec::GetBytes(UInt32& ioNumberBytes) const
|
||||
void ACSimpleCodec::ReallocateInputBuffer(UInt32 inInputBufferByteSize)
|
||||
{
|
||||
mInputBufferByteSize = inInputBufferByteSize + kBufferPad;
|
||||
|
||||
|
||||
// toss the old buffer
|
||||
delete[] mInputBuffer;
|
||||
mInputBuffer = NULL;
|
||||
|
||||
|
||||
// allocate the new one
|
||||
// allocate extra in order to allow making contiguous data.
|
||||
UInt32 allocSize = 2*inInputBufferByteSize + kBufferPad;
|
||||
mInputBuffer = new Byte[allocSize];
|
||||
memset(mInputBuffer, 0, allocSize);
|
||||
|
||||
|
||||
// reset the ring buffer state
|
||||
mInputBufferStart = 0;
|
||||
mInputBufferEnd = 0;
|
||||
@@ -359,6 +359,6 @@ void ACSimpleCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProp
|
||||
break;
|
||||
default:
|
||||
ACBaseCodec::SetProperty(inPropertyID, inPropertyDataSize, inPropertyData);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ACSimpleCodec.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#if !defined(__ACSimpleCodec_h__)
|
||||
#define __ACSimpleCodec_h__
|
||||
@@ -84,17 +84,17 @@ public:
|
||||
virtual void SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData);
|
||||
|
||||
protected:
|
||||
void ConsumeInputData(UInt32 inConsumedByteSize);
|
||||
void ConsumeInputData(UInt32 inConsumedByteSize);
|
||||
Byte* GetInputBufferStart() const { return mInputBuffer + mInputBufferStart; }
|
||||
UInt32 GetInputBufferContiguousByteSize() const { return (mInputBufferStart <= mInputBufferEnd) ? (mInputBufferEnd - mInputBufferStart) : (mInputBufferByteSize - mInputBufferStart); }
|
||||
virtual void ReallocateInputBuffer(UInt32 inInputBufferByteSize);
|
||||
|
||||
// returns a pointer to contiguous bytes.
|
||||
|
||||
// returns a pointer to contiguous bytes.
|
||||
// will do some copying if the request wraps around the internal buffer.
|
||||
// request must be less than available bytes
|
||||
Byte* GetBytes(UInt32& ioNumberBytes) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
Byte* mInputBuffer;
|
||||
UInt32 mInputBufferByteSize;
|
||||
UInt32 mInputBufferStart;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: GetCodecBundle.cpp
|
||||
Abstract: GetCodecBundle.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "GetCodecBundle.h"
|
||||
|
||||
@@ -59,7 +59,7 @@ const CFStringRef kCodecBundleID = CFSTR("com.apple.audio.codecs.Components");
|
||||
CFBundleRef GetCodecBundle()
|
||||
{
|
||||
static CFBundleRef sAudioCodecBundle = 0;
|
||||
if (!sAudioCodecBundle)
|
||||
if (!sAudioCodecBundle)
|
||||
{
|
||||
#if TARGET_OS_WIN32
|
||||
sAudioCodecBundle = CFBundleGetBundleWithIdentifier(CFSTR(kCodecBundleID));
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: GetCodecBundle.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef _GetCodecBundle_
|
||||
#define _GetCodecBundle_
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AudioFileComponentBase.cpp
|
||||
Abstract: AudioFileComponentBase.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
|
||||
#include <AudioToolbox/AudioFileComponent.h>
|
||||
@@ -84,8 +84,8 @@ static OSStatus CreateURL(
|
||||
|
||||
static OSStatus OpenURL(
|
||||
void * self,
|
||||
CFURLRef inFileRef,
|
||||
SInt8 inPermissions,
|
||||
CFURLRef inFileRef,
|
||||
SInt8 inPermissions,
|
||||
int inFileDescriptor)
|
||||
{
|
||||
return AFC->AFAPI_OpenURL(inFileRef, inPermissions, inFileDescriptor);
|
||||
@@ -93,9 +93,9 @@ static OSStatus OpenURL(
|
||||
|
||||
static OSStatus OpenWithCallbacks(
|
||||
void * self,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc)
|
||||
{
|
||||
@@ -104,9 +104,9 @@ static OSStatus OpenWithCallbacks(
|
||||
|
||||
static OSStatus InitializeWithCallbacks(
|
||||
void * self,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc,
|
||||
UInt32 inFileType,
|
||||
@@ -131,8 +131,8 @@ static OSStatus Optimize(
|
||||
static OSStatus ReadBytes(
|
||||
void * self,
|
||||
Boolean inUseCache,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
void *outBuffer)
|
||||
{
|
||||
return AFC->AFAPI_ReadBytes(inUseCache, inStartingByte, ioNumBytes, outBuffer);
|
||||
@@ -142,8 +142,8 @@ static OSStatus ReadBytes(
|
||||
static OSStatus WriteBytes(
|
||||
void * self,
|
||||
Boolean inUseCache,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
const void *inBuffer)
|
||||
{
|
||||
return AFC->AFAPI_WriteBytes(inUseCache, inStartingByte, ioNumBytes, inBuffer);
|
||||
@@ -155,11 +155,11 @@ static OSStatus ReadPackets(
|
||||
Boolean inUseCache,
|
||||
UInt32 *outNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer)
|
||||
{
|
||||
return AFC->AFAPI_ReadPackets(inUseCache, outNumBytes, outPacketDescriptions,
|
||||
return AFC->AFAPI_ReadPackets(inUseCache, outNumBytes, outPacketDescriptions,
|
||||
inStartingPacket, ioNumPackets, outBuffer);
|
||||
}
|
||||
|
||||
@@ -168,11 +168,11 @@ static OSStatus ReadPacketData(
|
||||
Boolean inUseCache,
|
||||
UInt32 *ioNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer)
|
||||
{
|
||||
return AFC->AFAPI_ReadPacketData(inUseCache, ioNumBytes, outPacketDescriptions,
|
||||
return AFC->AFAPI_ReadPacketData(inUseCache, ioNumBytes, outPacketDescriptions,
|
||||
inStartingPacket, ioNumPackets, outBuffer);
|
||||
}
|
||||
|
||||
@@ -182,8 +182,8 @@ static OSStatus WritePackets(
|
||||
Boolean inUseCache,
|
||||
UInt32 inNumBytes,
|
||||
AudioStreamPacketDescription *inPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
const void *inBuffer)
|
||||
#else
|
||||
static OSStatus WritePackets(
|
||||
@@ -191,12 +191,12 @@ static OSStatus WritePackets(
|
||||
Boolean inUseCache,
|
||||
UInt32 inNumBytes,
|
||||
const AudioStreamPacketDescription *inPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
const void *inBuffer)
|
||||
#endif
|
||||
{
|
||||
return AFC->AFAPI_WritePackets(inUseCache, inNumBytes,
|
||||
return AFC->AFAPI_WritePackets(inUseCache, inNumBytes,
|
||||
(const AudioStreamPacketDescription *)inPacketDescriptions, // this should be const (and is in 10.5 headers)
|
||||
inStartingPacket, ioNumPackets, inBuffer);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ static OSStatus ExtensionIsThisFormat(
|
||||
{
|
||||
AudioFileFormatBase* aff = AFC->GetAudioFileFormatBase();
|
||||
if (!aff) return kAudio_ParamError;
|
||||
|
||||
|
||||
UInt32 res = aff->ExtensionIsThisFormat(inExtension);
|
||||
if (outResult) *outResult = res;
|
||||
return noErr;
|
||||
@@ -289,13 +289,13 @@ static OSStatus ExtensionIsThisFormat(
|
||||
|
||||
static OSStatus FileDataIsThisFormat(
|
||||
void * self,
|
||||
UInt32 inDataByteSize,
|
||||
UInt32 inDataByteSize,
|
||||
const void* inData,
|
||||
UInt32 *outResult)
|
||||
{
|
||||
AudioFileFormatBase* aff = AFC->GetAudioFileFormatBase();
|
||||
if (!aff) return kAudio_ParamError;
|
||||
|
||||
|
||||
UncertainResult res = aff->FileDataIsThisFormat(inDataByteSize, inData);
|
||||
if (outResult) *outResult = res;
|
||||
return noErr;
|
||||
@@ -346,33 +346,33 @@ AudioFileObjectComponentBase::~AudioFileObjectComponentBase()
|
||||
}
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_CreateURL(
|
||||
CFURLRef inFileRef,
|
||||
CFURLRef inFileRef,
|
||||
const AudioStreamBasicDescription *inFormat,
|
||||
UInt32 inFlags)
|
||||
{
|
||||
if (!mAudioFileObject) return kAudio_ParamError;
|
||||
|
||||
|
||||
OSStatus result = mAudioFileObject->DoCreate (inFileRef, inFormat, inFlags);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_OpenURL(
|
||||
CFURLRef inFileRef,
|
||||
CFURLRef inFileRef,
|
||||
SInt8 inPermissions,
|
||||
int inFD)
|
||||
{
|
||||
if (!mAudioFileObject) return kAudio_ParamError;
|
||||
|
||||
|
||||
OSStatus result = mAudioFileObject->DoOpen(inFileRef, inPermissions, inFD);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_OpenWithCallbacks(
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc)
|
||||
{
|
||||
@@ -382,9 +382,9 @@ OSStatus AudioFileObjectComponentBase::AFAPI_OpenWithCallbacks(
|
||||
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_InitializeWithCallbacks(
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc,
|
||||
UInt32 inFileType,
|
||||
@@ -392,11 +392,11 @@ OSStatus AudioFileObjectComponentBase::AFAPI_InitializeWithCallbacks(
|
||||
UInt32 inFlags)
|
||||
{
|
||||
if (!mAudioFileObject) return kAudio_ParamError;
|
||||
return mAudioFileObject->DoInitializeWithCallbacks(inRefCon, inReadFunc, inWriteFunc, inGetSizeFunc, inSetSizeFunc,
|
||||
return mAudioFileObject->DoInitializeWithCallbacks(inRefCon, inReadFunc, inWriteFunc, inGetSizeFunc, inSetSizeFunc,
|
||||
inFileType, inFormat, inFlags);
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_Close()
|
||||
{
|
||||
if (!mAudioFileObject) return kAudio_ParamError;
|
||||
@@ -409,10 +409,10 @@ OSStatus AudioFileObjectComponentBase::AFAPI_Optimize()
|
||||
return mAudioFileObject->DoOptimize();
|
||||
}
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_ReadBytes(
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_ReadBytes(
|
||||
Boolean inUseCache,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
void *outBuffer)
|
||||
{
|
||||
if (!mAudioFileObject) return kAudio_ParamError;
|
||||
@@ -420,10 +420,10 @@ OSStatus AudioFileObjectComponentBase::AFAPI_ReadBytes(
|
||||
}
|
||||
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_WriteBytes(
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_WriteBytes(
|
||||
Boolean inUseCache,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
const void *inBuffer)
|
||||
{
|
||||
if (!mAudioFileObject) return kAudio_ParamError;
|
||||
@@ -433,12 +433,12 @@ OSStatus AudioFileObjectComponentBase::AFAPI_WriteBytes(
|
||||
|
||||
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_ReadPackets(
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_ReadPackets(
|
||||
Boolean inUseCache,
|
||||
UInt32 *outNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer)
|
||||
{
|
||||
if (!mAudioFileObject) return kAudio_ParamError;
|
||||
@@ -446,12 +446,12 @@ OSStatus AudioFileObjectComponentBase::AFAPI_ReadPackets(
|
||||
inStartingPacket, ioNumPackets, outBuffer);
|
||||
}
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_ReadPacketData(
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_ReadPacketData(
|
||||
Boolean inUseCache,
|
||||
UInt32 *ioNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer)
|
||||
{
|
||||
if (!mAudioFileObject) return kAudio_ParamError;
|
||||
@@ -459,13 +459,13 @@ OSStatus AudioFileObjectComponentBase::AFAPI_ReadPacketData(
|
||||
inStartingPacket, ioNumPackets, outBuffer);
|
||||
}
|
||||
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_WritePackets(
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_WritePackets(
|
||||
Boolean inUseCache,
|
||||
UInt32 inNumBytes,
|
||||
const AudioStreamPacketDescription *inPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
const void *inBuffer)
|
||||
{
|
||||
if (!mAudioFileObject) return kAudio_ParamError;
|
||||
@@ -474,8 +474,8 @@ OSStatus AudioFileObjectComponentBase::AFAPI_WritePackets(
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_GetPropertyInfo(
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_GetPropertyInfo(
|
||||
AudioFilePropertyID inPropertyID,
|
||||
UInt32 *outDataSize,
|
||||
UInt32 *isWritable)
|
||||
@@ -484,23 +484,23 @@ OSStatus AudioFileObjectComponentBase::AFAPI_GetPropertyInfo(
|
||||
return mAudioFileObject->GetPropertyInfo(inPropertyID, outDataSize, isWritable);
|
||||
}
|
||||
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_GetProperty(
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_GetProperty(
|
||||
AudioFilePropertyID inPropertyID,
|
||||
UInt32 *ioPropertySize,
|
||||
void *ioPropertyData)
|
||||
{
|
||||
OSStatus err = noErr;
|
||||
|
||||
|
||||
if (!ioPropertyData) return kAudio_ParamError;
|
||||
|
||||
|
||||
if (!mAudioFileObject) return kAudio_ParamError;
|
||||
err = mAudioFileObject->GetProperty(inPropertyID, ioPropertySize, ioPropertyData);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_SetProperty(
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_SetProperty(
|
||||
AudioFilePropertyID inPropertyID,
|
||||
UInt32 inPropertySize,
|
||||
const void *inPropertyData)
|
||||
@@ -510,7 +510,7 @@ OSStatus AudioFileObjectComponentBase::AFAPI_SetProperty(
|
||||
}
|
||||
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_CountUserData(
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_CountUserData(
|
||||
UInt32 inUserDataID,
|
||||
UInt32 *outNumberItems)
|
||||
{
|
||||
@@ -518,7 +518,7 @@ OSStatus AudioFileObjectComponentBase::AFAPI_CountUserData(
|
||||
return mAudioFileObject->CountUserData(inUserDataID, outNumberItems);
|
||||
}
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_GetUserDataSize(
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_GetUserDataSize(
|
||||
UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 *outUserDataSize)
|
||||
@@ -527,7 +527,7 @@ OSStatus AudioFileObjectComponentBase::AFAPI_GetUserDataSize(
|
||||
return mAudioFileObject->GetUserDataSize(inUserDataID, inIndex, outUserDataSize);
|
||||
}
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_GetUserData(
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_GetUserData(
|
||||
UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 *ioUserDataSize,
|
||||
@@ -537,7 +537,7 @@ OSStatus AudioFileObjectComponentBase::AFAPI_GetUserData(
|
||||
return mAudioFileObject->GetUserData(inUserDataID, inIndex, ioUserDataSize, outUserData);
|
||||
}
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_SetUserData(
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_SetUserData(
|
||||
UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 inUserDataSize,
|
||||
@@ -547,7 +547,7 @@ OSStatus AudioFileObjectComponentBase::AFAPI_SetUserData(
|
||||
return mAudioFileObject->SetUserData(inUserDataID, inIndex, inUserDataSize, inUserData);
|
||||
}
|
||||
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_RemoveUserData(
|
||||
OSStatus AudioFileObjectComponentBase::AFAPI_RemoveUserData(
|
||||
UInt32 inUserDataID,
|
||||
UInt32 inIndex)
|
||||
{
|
||||
@@ -556,14 +556,14 @@ OSStatus AudioFileObjectComponentBase::AFAPI_RemoveUserData(
|
||||
}
|
||||
|
||||
|
||||
OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfoSize(
|
||||
OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfoSize(
|
||||
AudioFilePropertyID inPropertyID,
|
||||
UInt32 inSpecifierSize,
|
||||
const void* inSpecifier,
|
||||
UInt32 *outPropertySize)
|
||||
{
|
||||
OSStatus err = noErr;
|
||||
|
||||
|
||||
switch (inPropertyID)
|
||||
{
|
||||
case kAudioFileComponent_CanRead :
|
||||
@@ -578,15 +578,15 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfoSize(
|
||||
case kAudioFileComponent_ExtensionsForType :
|
||||
*outPropertySize = sizeof(CFArrayRef);
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileComponent_UTIsForType :
|
||||
*outPropertySize = sizeof(CFArrayRef);
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileComponent_MIMETypesForType :
|
||||
*outPropertySize = sizeof(CFArrayRef);
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileComponent_AvailableFormatIDs :
|
||||
{
|
||||
UInt32 size = 0xFFFFFFFF;
|
||||
@@ -608,7 +608,7 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfoSize(
|
||||
err = GetAudioFileFormatBase()->GetAvailableStreamDescriptions(inFormatID, outPropertySize, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
err = kAudioFileUnsupportedPropertyError;
|
||||
}
|
||||
@@ -616,7 +616,7 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfoSize(
|
||||
}
|
||||
|
||||
|
||||
OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
|
||||
OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
|
||||
AudioFilePropertyID inPropertyID,
|
||||
UInt32 inSpecifierSize,
|
||||
const void* inSpecifier,
|
||||
@@ -624,9 +624,9 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
|
||||
void *ioPropertyData)
|
||||
{
|
||||
OSStatus err = noErr;
|
||||
|
||||
|
||||
if (!ioPropertyData || !ioPropertySize) return kAudio_ParamError;
|
||||
|
||||
|
||||
switch (inPropertyID)
|
||||
{
|
||||
case kAudioFileComponent_CanRead :
|
||||
@@ -636,7 +636,7 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
|
||||
*flag = GetAudioFileFormatBase()->CanRead();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileComponent_CanWrite :
|
||||
{
|
||||
if (*ioPropertySize != sizeof(UInt32)) return kAudioFileBadPropertySizeError;
|
||||
@@ -644,7 +644,7 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
|
||||
*flag = GetAudioFileFormatBase()->CanWrite();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileComponent_FileTypeName :
|
||||
{
|
||||
if (*ioPropertySize != sizeof(CFStringRef)) return kAudioFileBadPropertySizeError;
|
||||
@@ -682,21 +682,21 @@ OSStatus AudioFileComponentBase::AFAPI_GetGlobalInfo(
|
||||
err = GetAudioFileFormatBase()->GetHFSCodes(ioPropertySize, ioPropertyData);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileComponent_AvailableFormatIDs :
|
||||
{
|
||||
err = GetAudioFileFormatBase()->GetAvailableFormatIDs(ioPropertySize, ioPropertyData);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileComponent_AvailableStreamDescriptionsForFormat :
|
||||
{
|
||||
if (inSpecifierSize != sizeof(UInt32)) return kAudioFileBadPropertySizeError;
|
||||
UInt32 inFormatID = *(UInt32*)inSpecifier;
|
||||
UInt32 inFormatID = *(UInt32*)inSpecifier;
|
||||
err = GetAudioFileFormatBase()->GetAvailableStreamDescriptions(inFormatID, ioPropertySize, ioPropertyData);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
err = kAudioFileUnsupportedPropertyError;
|
||||
}
|
||||
@@ -709,11 +709,11 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
{
|
||||
OSStatus result = noErr;
|
||||
if (inThis == NULL) return kAudio_ParamError;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
switch (params->what)
|
||||
{
|
||||
{
|
||||
case kComponentCanDoSelect:
|
||||
switch (GetSelectorForCanDo(params))
|
||||
{
|
||||
@@ -734,7 +734,7 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
case kAudioFileFileDataIsThisFormatSelect:
|
||||
case kAudioFileGetGlobalInfoSizeSelect:
|
||||
case kAudioFileGetGlobalInfoSelect:
|
||||
|
||||
|
||||
case kAudioFileCountUserDataSelect:
|
||||
case kAudioFileGetUserDataSizeSelect:
|
||||
case kAudioFileGetUserDataSelect:
|
||||
@@ -756,7 +756,7 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
PARAM(CFURLRef, inFileRef, 0, 3);
|
||||
PARAM(const AudioStreamBasicDescription*, inFormat, 1, 3);
|
||||
PARAM(UInt32, inFlags, 2, 3);
|
||||
|
||||
|
||||
result = inThis->AFAPI_CreateURL(inFileRef, inFormat, inFlags);
|
||||
}
|
||||
break;
|
||||
@@ -765,7 +765,7 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
PARAM(CFURLRef, inFileRef, 0, 3);
|
||||
PARAM(SInt32, inPermissions, 1, 3);
|
||||
PARAM(int, inFileDescriptor, 2, 3);
|
||||
|
||||
|
||||
result = inThis->AFAPI_OpenURL(inFileRef, inPermissions, inFileDescriptor);
|
||||
}
|
||||
break;
|
||||
@@ -776,8 +776,8 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
PARAM(AudioFile_WriteProc, inWriteFunc, 2, 5);
|
||||
PARAM(AudioFile_GetSizeProc, inGetSizeFunc, 3, 5);
|
||||
PARAM(AudioFile_SetSizeProc, inSetSizeFunc, 4, 5);
|
||||
|
||||
result = inThis->AFAPI_OpenWithCallbacks(inRefCon, inReadFunc, inWriteFunc,
|
||||
|
||||
result = inThis->AFAPI_OpenWithCallbacks(inRefCon, inReadFunc, inWriteFunc,
|
||||
inGetSizeFunc, inSetSizeFunc);
|
||||
}
|
||||
break;
|
||||
@@ -791,8 +791,8 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
PARAM(UInt32, inFileType, 5, 8);
|
||||
PARAM(const AudioStreamBasicDescription*, inFormat, 6, 8);
|
||||
PARAM(UInt32, inFlags, 7, 8);
|
||||
|
||||
result = inThis->AFAPI_InitializeWithCallbacks(inRefCon, inReadFunc, inWriteFunc,
|
||||
|
||||
result = inThis->AFAPI_InitializeWithCallbacks(inRefCon, inReadFunc, inWriteFunc,
|
||||
inGetSizeFunc, inSetSizeFunc,
|
||||
inFileType, inFormat, inFlags);
|
||||
}
|
||||
@@ -813,7 +813,7 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
PARAM(SInt64*, inStartingByte, 1, 4);
|
||||
PARAM(UInt32*, ioNumBytes, 2, 4);
|
||||
PARAM(void*, outBuffer, 3, 4);
|
||||
|
||||
|
||||
result = inThis->AFAPI_ReadBytes(inUseCache, *inStartingByte, ioNumBytes,
|
||||
outBuffer);
|
||||
}
|
||||
@@ -824,7 +824,7 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
PARAM(SInt64*, inStartingByte, 1, 4);
|
||||
PARAM(UInt32*, ioNumBytes, 2, 4);
|
||||
PARAM(const void*, inBuffer, 3, 4);
|
||||
|
||||
|
||||
result = inThis->AFAPI_WriteBytes(inUseCache, *inStartingByte, ioNumBytes,
|
||||
inBuffer);
|
||||
}
|
||||
@@ -837,8 +837,8 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
PARAM(SInt64*, inStartingPacket, 3, 6);
|
||||
PARAM(UInt32*, ioNumPackets, 4, 6);
|
||||
PARAM(void*, outBuffer, 5, 6);
|
||||
|
||||
result = inThis->AFAPI_ReadPackets(inUseCache, outNumBytes, outPacketDescriptions,
|
||||
|
||||
result = inThis->AFAPI_ReadPackets(inUseCache, outNumBytes, outPacketDescriptions,
|
||||
*inStartingPacket, ioNumPackets, outBuffer);
|
||||
}
|
||||
break;
|
||||
@@ -850,28 +850,28 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
PARAM(SInt64*, inStartingPacket, 3, 6);
|
||||
PARAM(UInt32*, ioNumPackets, 4, 6);
|
||||
PARAM(const void*, inBuffer, 5, 6);
|
||||
|
||||
result = inThis->AFAPI_WritePackets(inUseCache, inNumBytes, inPacketDescriptions,
|
||||
|
||||
result = inThis->AFAPI_WritePackets(inUseCache, inNumBytes, inPacketDescriptions,
|
||||
*inStartingPacket, ioNumPackets, inBuffer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileGetPropertyInfoSelect:
|
||||
{
|
||||
PARAM(AudioFileComponentPropertyID, inPropertyID, 0, 3);
|
||||
PARAM(UInt32*, outPropertySize, 1, 3);
|
||||
PARAM(UInt32*, outWritable, 2, 3);
|
||||
|
||||
|
||||
result = inThis->AFAPI_GetPropertyInfo(inPropertyID, outPropertySize, outWritable);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileGetPropertySelect:
|
||||
{
|
||||
PARAM(AudioFileComponentPropertyID, inPropertyID, 0, 3);
|
||||
PARAM(UInt32*, ioPropertyDataSize, 1, 3);
|
||||
PARAM(void*, outPropertyData, 2, 3);
|
||||
|
||||
|
||||
result = inThis->AFAPI_GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
|
||||
}
|
||||
break;
|
||||
@@ -880,18 +880,18 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
PARAM(AudioFileComponentPropertyID, inPropertyID, 0, 3);
|
||||
PARAM(UInt32, inPropertyDataSize, 1, 3);
|
||||
PARAM(const void*, inPropertyData, 2, 3);
|
||||
|
||||
|
||||
result = inThis->AFAPI_SetProperty(inPropertyID, inPropertyDataSize, inPropertyData);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileGetGlobalInfoSizeSelect:
|
||||
{
|
||||
PARAM(AudioFileComponentPropertyID, inPropertyID, 0, 4);
|
||||
PARAM(UInt32, inSpecifierSize, 1, 4);
|
||||
PARAM(const void*, inSpecifier, 2, 4);
|
||||
PARAM(UInt32*, outPropertyDataSize, 3, 4);
|
||||
|
||||
|
||||
result = inThis->AFAPI_GetGlobalInfoSize(inPropertyID, inSpecifierSize, inSpecifier,
|
||||
outPropertyDataSize);
|
||||
}
|
||||
@@ -903,34 +903,34 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
PARAM(const void*, inSpecifier, 2, 5);
|
||||
PARAM(UInt32*, ioPropertyDataSize, 3, 5);
|
||||
PARAM(void*, outPropertyData, 4, 5);
|
||||
|
||||
|
||||
result = inThis->AFAPI_GetGlobalInfo(inPropertyID, inSpecifierSize, inSpecifier,
|
||||
ioPropertyDataSize, outPropertyData);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileExtensionIsThisFormatSelect:
|
||||
{
|
||||
PARAM(CFStringRef, inExtension, 0, 2);
|
||||
PARAM(UInt32*, outResult, 1, 2);
|
||||
|
||||
|
||||
AudioFileFormatBase* aff = inThis->GetAudioFileFormatBase();
|
||||
if (!aff) return kAudio_ParamError;
|
||||
|
||||
|
||||
UInt32 res = aff->ExtensionIsThisFormat(inExtension);
|
||||
if (outResult) *outResult = res;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileFileDataIsThisFormatSelect:
|
||||
{
|
||||
PARAM(UInt32, inDataByteSize, 0, 3);
|
||||
PARAM(const void*, inData, 1, 3);
|
||||
PARAM(UInt32*, outResult, 2, 3);
|
||||
|
||||
|
||||
AudioFileFormatBase* aff = inThis->GetAudioFileFormatBase();
|
||||
if (!aff) return kAudio_ParamError;
|
||||
|
||||
|
||||
UncertainResult res = aff->FileDataIsThisFormat(inDataByteSize, inData);
|
||||
if (outResult) *outResult = res;
|
||||
}
|
||||
@@ -940,55 +940,55 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
{
|
||||
PARAM(UInt32, inUserDataID, 0, 2);
|
||||
PARAM(UInt32*, outNumberItems, 1, 2);
|
||||
|
||||
|
||||
result = inThis->AFAPI_CountUserData(inUserDataID, outNumberItems);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileGetUserDataSizeSelect:
|
||||
{
|
||||
PARAM(UInt32, inUserDataID, 0, 3);
|
||||
PARAM(UInt32, inIndex, 1, 3);
|
||||
PARAM(UInt32*, outUserDataSize, 2, 3);
|
||||
|
||||
|
||||
result = inThis->AFAPI_GetUserDataSize(inUserDataID, inIndex, outUserDataSize);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileGetUserDataSelect:
|
||||
{
|
||||
PARAM(UInt32, inUserDataID, 0, 4);
|
||||
PARAM(UInt32, inIndex, 1, 4);
|
||||
PARAM(UInt32*, ioUserDataSize, 2, 4);
|
||||
PARAM(void*, outUserData, 3, 4);
|
||||
|
||||
result = inThis->AFAPI_GetUserData(inUserDataID, inIndex,
|
||||
|
||||
result = inThis->AFAPI_GetUserData(inUserDataID, inIndex,
|
||||
ioUserDataSize, outUserData);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileSetUserDataSelect:
|
||||
{
|
||||
PARAM(UInt32, inUserDataID, 0, 4);
|
||||
PARAM(UInt32, inIndex, 1, 4);
|
||||
PARAM(UInt32, inUserDataSize, 2, 4);
|
||||
PARAM(const void*, inUserData, 3, 4);
|
||||
|
||||
result = inThis->AFAPI_SetUserData(inUserDataID, inIndex,
|
||||
|
||||
result = inThis->AFAPI_SetUserData(inUserDataID, inIndex,
|
||||
inUserDataSize, inUserData);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioFileRemoveUserDataSelect:
|
||||
{
|
||||
PARAM(UInt32, inUserDataID, 0, 2);
|
||||
PARAM(UInt32, inIndex, 1, 2);
|
||||
|
||||
|
||||
result = inThis->AFAPI_RemoveUserData(inUserDataID, inIndex);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
result = ComponentBase::ComponentEntryDispatch(params, inThis);
|
||||
break;
|
||||
@@ -996,13 +996,13 @@ OSStatus AudioFileComponentBase::ComponentEntryDispatch(ComponentParameters* par
|
||||
}
|
||||
COMPONENT_CATCH
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
AudioComponentMethod AudioFileComponentLookup::Lookup (SInt16 selector)
|
||||
{
|
||||
switch (selector) {
|
||||
|
||||
|
||||
#define DefCase(NAME) case kAudioFile##NAME##Select: return (AudioComponentMethod)NAME
|
||||
|
||||
DefCase(OpenWithCallbacks);
|
||||
@@ -1016,7 +1016,7 @@ AudioComponentMethod AudioFileComponentLookup::Lookup (SInt16 selector)
|
||||
DefCase(GetPropertyInfo);
|
||||
DefCase(GetProperty);
|
||||
DefCase(SetProperty);
|
||||
|
||||
|
||||
DefCase(ExtensionIsThisFormat);
|
||||
DefCase(GetGlobalInfoSize);
|
||||
DefCase(GetGlobalInfo);
|
||||
@@ -1030,7 +1030,7 @@ AudioComponentMethod AudioFileComponentLookup::Lookup (SInt16 selector)
|
||||
DefCase(OpenURL);
|
||||
DefCase(FileDataIsThisFormat);
|
||||
DefCase(ReadPacketData);
|
||||
|
||||
|
||||
// These selectors are deprecated and do not appear: Create, Open, Initialize, FileIsThisFormat, DataIsThisFormat.
|
||||
|
||||
default:
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AudioFileComponentBase.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AudioFileComponentBase_h__
|
||||
#define __AudioFileComponentBase_h__
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
virtual ~AudioFileComponentBase();
|
||||
|
||||
virtual AudioFileFormatBase* GetAudioFileFormatBase() const = 0;
|
||||
|
||||
|
||||
/* Public API Function Support */
|
||||
virtual OSStatus AFAPI_CreateURL(
|
||||
CFURLRef inFileRef,
|
||||
@@ -75,96 +75,96 @@ public:
|
||||
UInt32 inFlags) { return kAudio_UnimplementedError; }
|
||||
|
||||
virtual OSStatus AFAPI_OpenURL(
|
||||
CFURLRef inFileRef,
|
||||
CFURLRef inFileRef,
|
||||
SInt8 inPermissions,
|
||||
int inFD) { return kAudio_UnimplementedError; }
|
||||
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_Create(
|
||||
const FSRef *inParentRef,
|
||||
const FSRef *inParentRef,
|
||||
CFStringRef inFileName,
|
||||
const AudioStreamBasicDescription *inFormat,
|
||||
UInt32 inFlags,
|
||||
FSRef *outNewFileRef) { return kAudio_UnimplementedError; }
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_Initialize(
|
||||
const FSRef *inFileRef,
|
||||
const AudioStreamBasicDescription *inFormat,
|
||||
UInt32 inFlags) { return kAudio_UnimplementedError; }
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_Open(
|
||||
const FSRef *inFileRef,
|
||||
const FSRef *inFileRef,
|
||||
SInt8 inPermissions,
|
||||
SInt16 inRefNum) { return kAudio_UnimplementedError; }
|
||||
|
||||
virtual OSStatus AFAPI_OpenWithCallbacks(
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc)=0;
|
||||
|
||||
virtual OSStatus AFAPI_InitializeWithCallbacks(
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc,
|
||||
UInt32 inFileType,
|
||||
const AudioStreamBasicDescription *inFormat,
|
||||
UInt32 inFlags)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_Close()=0;
|
||||
virtual OSStatus AFAPI_Optimize()=0;
|
||||
virtual OSStatus AFAPI_ReadBytes( Boolean inUseCache,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
void *outBuffer)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_WriteBytes( Boolean inUseCache,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
const void *inBuffer)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_ReadPackets( Boolean inUseCache,
|
||||
UInt32 *outNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_ReadPacketData( Boolean inUseCache,
|
||||
UInt32 *ioNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_WritePackets( Boolean inUseCache,
|
||||
UInt32 inNumBytes,
|
||||
const AudioStreamPacketDescription *inPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
const void *inBuffer)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_GetPropertyInfo( AudioFilePropertyID inPropertyID,
|
||||
UInt32 *outDataSize,
|
||||
UInt32 *isWritable)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_GetProperty( AudioFilePropertyID inPropertyID,
|
||||
UInt32 *ioDataSize,
|
||||
void *ioPropertyData)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_SetProperty( AudioFilePropertyID inPropertyID,
|
||||
UInt32 inDataSize,
|
||||
const void *inPropertyData)=0;
|
||||
virtual OSStatus AFAPI_GetGlobalInfoSize(
|
||||
virtual OSStatus AFAPI_GetGlobalInfoSize(
|
||||
AudioFilePropertyID inPropertyID,
|
||||
UInt32 inSpecifierSize,
|
||||
const void* inSpecifier,
|
||||
UInt32 *outPropertySize);
|
||||
|
||||
virtual OSStatus AFAPI_GetGlobalInfo(
|
||||
virtual OSStatus AFAPI_GetGlobalInfo(
|
||||
AudioFilePropertyID inPropertyID,
|
||||
UInt32 inSpecifierSize,
|
||||
const void* inSpecifier,
|
||||
@@ -173,21 +173,21 @@ public:
|
||||
|
||||
virtual OSStatus AFAPI_CountUserData( UInt32 inUserDataID,
|
||||
UInt32 *outNumberItems)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_GetUserDataSize( UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 *outDataSize)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_GetUserData( UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 *ioDataSize,
|
||||
void *ioUserData)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_SetUserData( UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 inDataSize,
|
||||
const void *inUserData)=0;
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_RemoveUserData( UInt32 inUserDataID,
|
||||
UInt32 inIndex)=0;
|
||||
#if !CA_USE_AUDIO_PLUGIN_ONLY
|
||||
@@ -207,9 +207,9 @@ public:
|
||||
|
||||
virtual AudioFileFormat* GetAudioFormat() const = 0;
|
||||
virtual AudioFileFormatBase* GetAudioFileFormatBase() const { return GetAudioFormat(); }
|
||||
|
||||
|
||||
void SetAudioFileObject(AudioFileObject* inObject) { mAudioFileObject = inObject; }
|
||||
|
||||
|
||||
/* Public API Function Support */
|
||||
|
||||
virtual OSStatus AFAPI_CreateURL(
|
||||
@@ -218,92 +218,92 @@ public:
|
||||
UInt32 inFlags);
|
||||
|
||||
virtual OSStatus AFAPI_OpenURL(
|
||||
CFURLRef inFileRef,
|
||||
CFURLRef inFileRef,
|
||||
SInt8 inPermissions,
|
||||
int inFD);
|
||||
|
||||
virtual OSStatus AFAPI_OpenWithCallbacks(
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc);
|
||||
|
||||
virtual OSStatus AFAPI_InitializeWithCallbacks(
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc,
|
||||
UInt32 inFileType,
|
||||
const AudioStreamBasicDescription *inFormat,
|
||||
UInt32 inFlags);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_Close();
|
||||
virtual OSStatus AFAPI_Optimize();
|
||||
virtual OSStatus AFAPI_ReadBytes( Boolean inUseCache,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
void *outBuffer);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_WriteBytes( Boolean inUseCache,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
const void *inBuffer);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_ReadPackets( Boolean inUseCache,
|
||||
UInt32 *outNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_ReadPacketData( Boolean inUseCache,
|
||||
UInt32 *ioNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_WritePackets( Boolean inUseCache,
|
||||
UInt32 inNumBytes,
|
||||
const AudioStreamPacketDescription *inPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
const void *inBuffer);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_GetPropertyInfo( AudioFilePropertyID inPropertyID,
|
||||
UInt32 *outDataSize,
|
||||
UInt32 *isWritable);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_GetProperty( AudioFilePropertyID inPropertyID,
|
||||
UInt32 *ioDataSize,
|
||||
void *ioPropertyData);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_SetProperty( AudioFilePropertyID inPropertyID,
|
||||
UInt32 inDataSize,
|
||||
const void *inPropertyData);
|
||||
|
||||
virtual OSStatus AFAPI_CountUserData( UInt32 inUserDataID,
|
||||
UInt32 *outNumberItems);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_GetUserDataSize( UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 *outDataSize);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_GetUserData( UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 *ioDataSize,
|
||||
void *ioUserData);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_SetUserData( UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 inDataSize,
|
||||
const void *inUserData);
|
||||
|
||||
|
||||
virtual OSStatus AFAPI_RemoveUserData( UInt32 inUserDataID,
|
||||
UInt32 inIndex);
|
||||
|
||||
|
||||
protected:
|
||||
AudioFileObject* mAudioFileObject;
|
||||
};
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AudioFileFormat.cpp
|
||||
Abstract: AudioFileFormat.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,14 +40,14 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AudioFileFormat.h"
|
||||
#include "DataSource.h"
|
||||
|
||||
AudioFileFormatBase::AudioFileFormatBase(UInt32 inFileType)
|
||||
AudioFileFormatBase::AudioFileFormatBase(UInt32 inFileType)
|
||||
: mFileType(inFileType)
|
||||
{
|
||||
}
|
||||
@@ -61,7 +61,7 @@ OSStatus AudioFileFormatBase::GetHFSCodes(UInt32* ioDataSize, void* outPropertyD
|
||||
return kAudioFileUnsupportedPropertyError;
|
||||
}
|
||||
|
||||
AudioFileFormat::AudioFileFormat(UInt32 inFileType)
|
||||
AudioFileFormat::AudioFileFormat(UInt32 inFileType)
|
||||
: AudioFileFormatBase(inFileType)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AudioFileFormat.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,18 +40,18 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef _AudioFileFormat_H_
|
||||
#define _AudioFileFormat_H_
|
||||
|
||||
#include "AudioFileObject.h"
|
||||
|
||||
// AudioFileFormat is a factory class for AudioFileObjects.
|
||||
// AudioFileFormat is a factory class for AudioFileObjects.
|
||||
|
||||
// UncertainResult is needed for DataIsThisFormat.
|
||||
// UncertainResult is needed for DataIsThisFormat.
|
||||
// In the case of SoundDesigner 2 we can't determine if the data is SoundDesigner 2 or not.
|
||||
|
||||
typedef int UncertainResult;
|
||||
@@ -71,23 +71,23 @@ class AudioFileFormatBase
|
||||
public:
|
||||
AudioFileFormatBase(UInt32 inFileType);
|
||||
virtual ~AudioFileFormatBase();
|
||||
|
||||
|
||||
// return true if extension is of this format type
|
||||
virtual Boolean ExtensionIsThisFormat(CFStringRef inExtension) = 0;
|
||||
|
||||
|
||||
virtual UncertainResult FileDataIsThisFormat(
|
||||
UInt32 /*inDataByteSize*/,
|
||||
const void* /*inData*/) = 0;
|
||||
|
||||
|
||||
// support SoundDesigner II files while minimizing opening and closing files.
|
||||
virtual Boolean ResourceIsThisFormat(const FSRef* /*inRef*/) { return false; }
|
||||
|
||||
UInt32 GetFileType() const { return mFileType; }
|
||||
|
||||
|
||||
virtual UInt32 CanRead() const { return 1; }
|
||||
virtual UInt32 CanWrite() const { return 1; }
|
||||
virtual UInt32 HasResourceFork() const { return 0; }
|
||||
|
||||
|
||||
virtual void GetExtensions(CFArrayRef *outArray) = 0;
|
||||
virtual void GetUTIs(CFArrayRef *outArray) {}
|
||||
virtual void GetMIMETypes(CFArrayRef *outArray) {}
|
||||
@@ -95,10 +95,10 @@ public:
|
||||
virtual OSStatus GetAvailableFormatIDs(UInt32* ioDataSize, void* outPropertyData) = 0;
|
||||
virtual OSStatus GetAvailableStreamDescriptions(UInt32 inFormatID, UInt32* ioDataSize, void* outPropertyData) = 0;
|
||||
virtual OSStatus GetHFSCodes(UInt32* ioDataSize, void* outPropertyData);
|
||||
|
||||
|
||||
virtual AudioFileFormat* AsAudioFileFormat() { return NULL; }
|
||||
virtual AudioFileFormatComponent* AsAudioFileFormatComponent() { return NULL; }
|
||||
|
||||
|
||||
private:
|
||||
UInt32 mFileType;
|
||||
};
|
||||
@@ -110,13 +110,13 @@ class AudioFileFormat : public AudioFileFormatBase
|
||||
public:
|
||||
AudioFileFormat(UInt32 inFileType);
|
||||
virtual ~AudioFileFormat();
|
||||
|
||||
|
||||
// create an AudioFileObject for this format type.
|
||||
virtual AudioFileObject* New() = 0;
|
||||
virtual AudioFileObject* New() = 0;
|
||||
virtual AudioFileStreamObject* NewStream() { return NULL; }
|
||||
|
||||
|
||||
// return true if file is of this format type
|
||||
virtual UncertainResult FileDataIsThisFormat(UInt32 inDataByteSize, const void* inData) = 0;
|
||||
virtual UncertainResult FileDataIsThisFormat(UInt32 inDataByteSize, const void* inData) = 0;
|
||||
|
||||
virtual AudioFileFormat* AsAudioFileFormat() { return this; }
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,14 +2,14 @@
|
||||
File: AudioFileObject.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef _AudioFileObject_H_
|
||||
#define _AudioFileObject_H_
|
||||
@@ -96,12 +96,12 @@ enum {
|
||||
// as described by the magic cookie.
|
||||
// The specifier is an AudioFormatInfo struct. At a minimum formatID member of the ASBD struct must filled in. Other fields
|
||||
// may be filled in.
|
||||
|
||||
|
||||
kAudioFormatProperty_OutputFormatList = 'ofls',
|
||||
// Returns a list of AudioFormatListItem structs describing the audio formats which may be obtained by decoding the format
|
||||
// described by the specifier.
|
||||
// The specifier is an AudioFormatInfo struct. At a minimum formatID member of the ASBD struct must filled in. Other fields
|
||||
// may be filled in. If there is no magic cookie, then the number of channels and sample rate should be filled in.
|
||||
// may be filled in. If there is no magic cookie, then the number of channels and sample rate should be filled in.
|
||||
|
||||
};
|
||||
|
||||
@@ -134,7 +134,7 @@ enum {
|
||||
kUpperCase_IMACompression = 'IMA4', /*IMA 4:1*/
|
||||
kUpperCase_ULawCompression = 'ULAW', /*µLaw 2:1*/
|
||||
kUpperCase_ALawCompression = 'ALAW', /*aLaw 2:1*/
|
||||
|
||||
|
||||
kUpperCase_Float32 = 'FL32',
|
||||
kUpperCase_Float64 = 'FL64'
|
||||
};
|
||||
@@ -142,7 +142,7 @@ enum {
|
||||
enum
|
||||
{
|
||||
// in what header is this defined? what is it?
|
||||
kGSM = 'agsm',
|
||||
kGSM = 'agsm',
|
||||
kUpperCase_GSM = 'GSM '
|
||||
};
|
||||
|
||||
@@ -209,9 +209,9 @@ private:
|
||||
AudioStreamBasicDescription mDataFormat; // format of the audio data
|
||||
SInt64 mDataOffset; // position if the file where audio data begins
|
||||
UInt32 mIsOptimized; // 1 if there is nothing in the file following the audio data, 0 if there is
|
||||
UInt32 mFileType; // file type of the audio file (i.e. AIFF, WAVE, etc.)
|
||||
UInt32 mFileType; // file type of the audio file (i.e. AIFF, WAVE, etc.)
|
||||
CFURLRef mFileRef; // URL of the file passed to AudioFileOpen or AudioFileCreate
|
||||
int mFileD; // Ref num of the file after opening within Audio File
|
||||
int mFileD; // Ref num of the file after opening within Audio File
|
||||
SInt8 mPermissions; // file permissions indicated by the caller, passed by AudioFileOpen or set with SetProperty function
|
||||
Boolean mIsInitialized; // has the AudioFileObject for this file been intialized?
|
||||
DataSource *mDataSource;
|
||||
@@ -221,9 +221,9 @@ private:
|
||||
Boolean mNeedsSizeUpdate;
|
||||
Boolean mFirstSetFormat;
|
||||
Boolean mAlignDataWithFillerChunks;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
public:
|
||||
|
||||
AudioFileObject (UInt32 inFileType)
|
||||
: mNumBytes(0),
|
||||
mNumPackets(0),
|
||||
@@ -244,159 +244,159 @@ public:
|
||||
{
|
||||
memset(&mDataFormat, 0, sizeof(mDataFormat));
|
||||
}
|
||||
|
||||
|
||||
virtual ~AudioFileObject();
|
||||
|
||||
|
||||
|
||||
/* Public API Function Implementation */
|
||||
// The DoSomething() versions of these functions are wrappers that perform a standard prologue.
|
||||
// The Something() methods are those which should be overridden in the subclasses.
|
||||
|
||||
|
||||
OSStatus DoCreate( CFURLRef inFileRef,
|
||||
const AudioStreamBasicDescription *inFormat,
|
||||
UInt32 inFlags);
|
||||
|
||||
|
||||
virtual OSStatus Create( CFURLRef inFileRef,
|
||||
const AudioStreamBasicDescription *inFormat);
|
||||
|
||||
OSStatus DoOpen( CFURLRef inFileRef,
|
||||
|
||||
OSStatus DoOpen( CFURLRef inFileRef,
|
||||
SInt8 inPermissions,
|
||||
int inFD);
|
||||
|
||||
virtual OSStatus Open( CFURLRef inFileRef,
|
||||
|
||||
virtual OSStatus Open( CFURLRef inFileRef,
|
||||
SInt8 inPermissions,
|
||||
int inFD);
|
||||
|
||||
OSStatus DoOpenWithCallbacks(
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc);
|
||||
|
||||
|
||||
|
||||
|
||||
OSStatus DoInitialize( CFURLRef inFileRef,
|
||||
const AudioStreamBasicDescription *inFormat,
|
||||
UInt32 inFlags);
|
||||
|
||||
|
||||
virtual OSStatus Initialize( CFURLRef inFileRef,
|
||||
const AudioStreamBasicDescription *inFormat,
|
||||
UInt32 inFlags);
|
||||
|
||||
|
||||
OSStatus DoInitializeWithCallbacks(
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
void * inRefCon,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc,
|
||||
UInt32 inFileType,
|
||||
const AudioStreamBasicDescription *inFormat,
|
||||
UInt32 inFlags);
|
||||
|
||||
|
||||
virtual OSStatus OpenFromDataSource(void);
|
||||
|
||||
|
||||
virtual OSStatus InitializeDataSource(const AudioStreamBasicDescription *inFormat, UInt32 inFlags);
|
||||
|
||||
|
||||
OSStatus DoClose();
|
||||
|
||||
|
||||
virtual OSStatus Close();
|
||||
|
||||
|
||||
OSStatus DoOptimize();
|
||||
|
||||
|
||||
virtual OSStatus Optimize();
|
||||
|
||||
|
||||
virtual OSStatus ReadBytes( Boolean inUseCache,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
void *outBuffer);
|
||||
|
||||
|
||||
virtual OSStatus WriteBytes( Boolean inUseCache,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
SInt64 inStartingByte,
|
||||
UInt32 *ioNumBytes,
|
||||
const void *inBuffer);
|
||||
|
||||
|
||||
virtual OSStatus ReadPackets( Boolean inUseCache,
|
||||
UInt32 *outNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer);
|
||||
|
||||
virtual OSStatus ReadPacketData(
|
||||
virtual OSStatus ReadPacketData(
|
||||
Boolean inUseCache,
|
||||
UInt32 *ioNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer);
|
||||
|
||||
virtual OSStatus ReadPacketDataVBR(
|
||||
|
||||
virtual OSStatus ReadPacketDataVBR(
|
||||
Boolean inUseCache,
|
||||
UInt32 *ioNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer);
|
||||
|
||||
virtual OSStatus HowManyPacketsCanBeReadIntoBuffer(UInt32* ioNumBytes, SInt64 inStartingPacket, UInt32 *ioNumPackets);
|
||||
|
||||
virtual OSStatus ReadPacketDataVBR_InTable(
|
||||
virtual OSStatus ReadPacketDataVBR_InTable(
|
||||
Boolean inUseCache,
|
||||
UInt32 *ioNumBytes,
|
||||
AudioStreamPacketDescription *outPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
void *outBuffer);
|
||||
|
||||
|
||||
virtual OSStatus WritePackets( Boolean inUseCache,
|
||||
UInt32 inNumBytes,
|
||||
const AudioStreamPacketDescription *inPacketDescriptions,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
SInt64 inStartingPacket,
|
||||
UInt32 *ioNumPackets,
|
||||
const void *inBuffer);
|
||||
/* Property Support */
|
||||
|
||||
virtual OSStatus GetPropertyInfo (
|
||||
virtual OSStatus GetPropertyInfo (
|
||||
AudioFilePropertyID inPropertyID,
|
||||
UInt32 *outDataSize,
|
||||
UInt32 *isWritable);
|
||||
|
||||
|
||||
virtual OSStatus GetProperty ( AudioFilePropertyID inPropertyID,
|
||||
UInt32 *ioDataSize,
|
||||
void *ioPropertyData);
|
||||
|
||||
|
||||
virtual OSStatus SetProperty ( AudioFilePropertyID inPropertyID,
|
||||
UInt32 inDataSize,
|
||||
const void *inPropertyData);
|
||||
|
||||
|
||||
UInt32 GetFileType() const { return mFileType; }
|
||||
void SetFileType(UInt32 inFileType) { mFileType = inFileType; }
|
||||
|
||||
|
||||
// this will set the format in memory only.
|
||||
virtual OSStatus SetDataFormat(const AudioStreamBasicDescription* inStreamFormat);
|
||||
|
||||
|
||||
// this will update the format info on disk and in memory.
|
||||
virtual OSStatus UpdateDataFormat(const AudioStreamBasicDescription* inStreamFormat);
|
||||
|
||||
|
||||
const UInt32 GetBytesPerPacket() const { return mDataFormat.mBytesPerPacket; }
|
||||
|
||||
|
||||
const AudioStreamBasicDescription &GetDataFormat() const { return mDataFormat; }
|
||||
|
||||
|
||||
virtual OSStatus GetFormatListInfo( UInt32 &outDataSize,
|
||||
UInt32 &outWritable);
|
||||
|
||||
|
||||
virtual OSStatus GetFormatList( UInt32 &ioDataSize,
|
||||
AudioFormatListItem *ioPropertyData);
|
||||
|
||||
|
||||
virtual OSStatus SetFormatList( UInt32 inDataSize,
|
||||
const AudioFormatListItem *inPropertyData);
|
||||
|
||||
|
||||
virtual OSStatus UpdateSize() { return noErr; }
|
||||
UInt32 DeferSizeUpdates() { return mDeferSizeUpdates; }
|
||||
void SetDeferSizeUpdates(UInt32 inFlag) { mDeferSizeUpdates = inFlag; }
|
||||
OSStatus UpdateSizeIfNeeded();
|
||||
OSStatus SizeChanged();
|
||||
|
||||
|
||||
Boolean IsOptimized() const { return mIsOptimized != 0; }
|
||||
void SetIsOptimized(Boolean inIsOptimized) { mIsOptimized = inIsOptimized ? 1 : 0; }
|
||||
|
||||
@@ -407,79 +407,79 @@ public:
|
||||
|
||||
// this will update the header size info on disk
|
||||
OSStatus UpdateNumBytes(SInt64 inNumBytes);
|
||||
|
||||
|
||||
virtual SInt64 GetNumPackets(){ return mNumPackets; }
|
||||
virtual void SetNumPackets(SInt64 inNumPackets) { mNumPackets = inNumPackets; }
|
||||
|
||||
|
||||
// this will update the header size info on disk
|
||||
OSStatus UpdateNumPackets(SInt64 inNumPackets);
|
||||
|
||||
virtual OSStatus PacketToFrame(SInt64 inPacket, SInt64& outFirstFrameInPacket);
|
||||
virtual OSStatus FrameToPacket(SInt64 inFrame, SInt64& outPacket, UInt32& outFrameOffsetInPacket);
|
||||
|
||||
|
||||
virtual OSStatus PacketToByte(AudioBytePacketTranslation* abpt);
|
||||
|
||||
|
||||
virtual OSStatus ByteToPacket(AudioBytePacketTranslation* abpt);
|
||||
|
||||
|
||||
virtual OSStatus GetBitRate( UInt32 *outBitRate);
|
||||
|
||||
|
||||
virtual OSStatus GetMagicCookieDataSize( UInt32 *outDataSize,
|
||||
UInt32 *isWritable);
|
||||
|
||||
|
||||
virtual OSStatus GetMagicCookieData( UInt32 *ioDataSize,
|
||||
void *ioPropertyData);
|
||||
|
||||
|
||||
virtual OSStatus SetMagicCookieData( UInt32 inDataSize,
|
||||
const void *inPropertyData);
|
||||
|
||||
virtual OSStatus GetMarkerListSize( UInt32 *outDataSize,
|
||||
UInt32 *isWritable);
|
||||
|
||||
|
||||
virtual OSStatus GetMarkerList( UInt32 *ioDataSize,
|
||||
AudioFileMarkerList *ioMarkerList);
|
||||
|
||||
|
||||
virtual OSStatus SetMarkerList( UInt32 inDataSize,
|
||||
const AudioFileMarkerList *inMarkerList);
|
||||
|
||||
|
||||
virtual OSStatus GetRegionListSize( UInt32 *outDataSize,
|
||||
UInt32 *isWritable);
|
||||
|
||||
|
||||
virtual OSStatus GetRegionList( UInt32 *ioDataSize,
|
||||
AudioFileRegionList *ioRegionList);
|
||||
|
||||
|
||||
virtual OSStatus SetRegionList( UInt32 inDataSize,
|
||||
const AudioFileRegionList *inRegionList);
|
||||
|
||||
virtual OSStatus GetChannelLayoutSize( UInt32 *outDataSize,
|
||||
UInt32 *isWritable);
|
||||
|
||||
|
||||
virtual OSStatus GetChannelLayout( UInt32 *ioDataSize,
|
||||
AudioChannelLayout *ioChannelLayout);
|
||||
|
||||
|
||||
virtual OSStatus SetChannelLayout( UInt32 inDataSize,
|
||||
const AudioChannelLayout *inChannelLayout);
|
||||
|
||||
|
||||
virtual OSStatus GetInfoDictionarySize( UInt32 *outDataSize,
|
||||
UInt32 *isWritable);
|
||||
|
||||
|
||||
virtual OSStatus GetInfoDictionary( CACFDictionary *infoDict);
|
||||
|
||||
|
||||
virtual OSStatus SetInfoDictionary( CACFDictionary *infoDict);
|
||||
|
||||
virtual OSStatus GetSoundCheckDictionarySize( UInt32 *outDataSize,
|
||||
UInt32 *isWritable) { return kAudioFileUnsupportedPropertyError; }
|
||||
|
||||
|
||||
virtual OSStatus GetSoundCheckDictionary( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
|
||||
|
||||
|
||||
virtual OSStatus SetSoundCheckDictionary( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
|
||||
|
||||
|
||||
virtual OSStatus GetLoudnessInfo( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
|
||||
|
||||
|
||||
virtual OSStatus GetSoundCheckDictionaryFromLoudnessInfo(CACFDictionary* outInfoDict) { return kAudioFileUnsupportedPropertyError; }
|
||||
virtual OSStatus GetLoudnessInfoFromSoundCheckDictionary(CACFDictionary* outInfoDict) { return kAudioFileUnsupportedPropertyError; }
|
||||
|
||||
|
||||
virtual OSStatus SetLoudnessInfo( CACFDictionary *infoDict) { return kAudioFileUnsupportedPropertyError; }
|
||||
|
||||
virtual OSStatus GetLoudnessInfoSize( UInt32 *outDataSize,
|
||||
@@ -491,16 +491,16 @@ public:
|
||||
|
||||
virtual OSStatus CountUserData( UInt32 inUserDataID,
|
||||
UInt32 *outNumberItems);
|
||||
|
||||
|
||||
virtual OSStatus GetUserDataSize( UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 *outDataSize);
|
||||
|
||||
|
||||
virtual OSStatus GetUserData( UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 *ioDataSize,
|
||||
void *ioUserData);
|
||||
|
||||
|
||||
virtual OSStatus SetUserData( UInt32 inUserDataID,
|
||||
UInt32 inIndex,
|
||||
UInt32 inDataSize,
|
||||
@@ -516,14 +516,14 @@ public:
|
||||
Boolean CanWrite() const { return mPermissions & kAudioFileWritePermission; }
|
||||
|
||||
void SetPermissions(SInt8 inPermissions) { mPermissions = inPermissions; }
|
||||
|
||||
|
||||
/* Other Helper Methods: (some may not be necessary depending on how things are refactored) */
|
||||
|
||||
|
||||
OSStatus OpenFile(SInt8 inPermissions, int inFD);
|
||||
|
||||
OSStatus CreateDataFile (CFURLRef inFileRef, int &outFileD);
|
||||
|
||||
OSStatus AddDurationToInfoDictionary(CACFDictionary *infoDict, Float64 &inDuration);
|
||||
OSStatus AddDurationToInfoDictionary(CACFDictionary *infoDict, Float64 &inDuration);
|
||||
|
||||
virtual Boolean IsDataFormatSupported(const AudioStreamBasicDescription *inFormat) = 0;
|
||||
virtual Boolean IsDataFormatValid(const AudioStreamBasicDescription *inFormat);
|
||||
@@ -535,21 +535,21 @@ public:
|
||||
/* Accessors: */
|
||||
Boolean IsInitialized() const { return mIsInitialized; }
|
||||
void SetInitialized(Boolean inFlag) { mIsInitialized = inFlag; }
|
||||
|
||||
|
||||
DataSource* GetDataSource() const { return mDataSource; }
|
||||
void SetDataSource(DataSource *inDataSource);
|
||||
|
||||
|
||||
void SetURL (CFURLRef inURL);
|
||||
|
||||
|
||||
virtual UInt32 GetMaximumPacketSize() { return mMaximumPacketSize; }
|
||||
virtual UInt32 FindMaximumPacketSize() { return mMaximumPacketSize; }
|
||||
virtual void SetMaximumPacketSize(const UInt32 inPacketSize) { mMaximumPacketSize = inPacketSize; }
|
||||
|
||||
|
||||
virtual UInt32 GetPacketSizeUpperBound() { return GetMaximumPacketSize (); }
|
||||
|
||||
SInt64 GetDataOffset() const { return mDataOffset; }
|
||||
void SetDataOffset(SInt64 inOffset) { mDataOffset = inOffset; }
|
||||
|
||||
|
||||
SInt64 GetDataOffset() const { return mDataOffset; }
|
||||
void SetDataOffset(SInt64 inOffset) { mDataOffset = inOffset; }
|
||||
|
||||
// I like this idiom better than DoesPacketTableExist+NewPacketTable:
|
||||
CompressedPacketTable* GetPacketTable(Boolean inCreateIt = false)
|
||||
{
|
||||
@@ -557,35 +557,35 @@ public:
|
||||
mPacketTable = new CompressedPacketTable(mDataFormat.mFramesPerPacket);
|
||||
return mPacketTable;
|
||||
}
|
||||
void ClearPacketTable()
|
||||
void ClearPacketTable()
|
||||
{
|
||||
DeletePacketTable();
|
||||
GetPacketTable(true);
|
||||
}
|
||||
|
||||
virtual OSStatus ScanForPackets(SInt64 inToPacketCount, DataSource* inDataSrc = NULL, bool fullyParsedIfEndOfDataReached = true)
|
||||
|
||||
virtual OSStatus ScanForPackets(SInt64 inToPacketCount, DataSource* inDataSrc = NULL, bool fullyParsedIfEndOfDataReached = true)
|
||||
{
|
||||
// In formats that read packets lazily, this will be overridden to scan for packets up to the index.
|
||||
if (inToPacketCount > GetNumPackets())
|
||||
return kAudioFileEndOfFileError;
|
||||
|
||||
return noErr;
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
void AppendPacket(const AudioStreamPacketDescription &inPacket)
|
||||
|
||||
void AppendPacket(const AudioStreamPacketDescription &inPacket)
|
||||
{
|
||||
CompressedPacketTable* packetTable = GetPacketTable(true);
|
||||
UInt32 numFramesInPacket = mDataFormat.mFramesPerPacket ? mDataFormat.mFramesPerPacket : inPacket.mVariableFramesInPacket;
|
||||
|
||||
|
||||
AudioStreamPacketDescriptionExtended pext;
|
||||
memset(&pext, 0, sizeof(pext));
|
||||
pext.mStartOffset = inPacket.mStartOffset;
|
||||
pext.mDataByteSize = inPacket.mDataByteSize;
|
||||
pext.mVariableFramesInPacket = inPacket.mVariableFramesInPacket;
|
||||
pext.mFrameOffset = numFramesInPacket + (packetTable->size() ? packetTable->back().mFrameOffset : 0);
|
||||
|
||||
packetTable->push_back(pext);
|
||||
if (inPacket.mDataByteSize > mMaximumPacketSize)
|
||||
|
||||
packetTable->push_back(pext);
|
||||
if (inPacket.mDataByteSize > mMaximumPacketSize)
|
||||
mMaximumPacketSize = inPacket.mDataByteSize;
|
||||
}
|
||||
void DeletePacketTable() { delete mPacketTable; mPacketTable = NULL;}
|
||||
@@ -597,9 +597,9 @@ public:
|
||||
{
|
||||
// only get as many packet descriptions as can fit in outPacketDescriptions
|
||||
UInt32 count = *ioDataSize / sizeof(AudioStreamPacketDescription);
|
||||
if (count + inStartingPacket > GetPacketTableSize())
|
||||
if (count + inStartingPacket > GetPacketTableSize())
|
||||
count = (UInt32)(GetPacketTableSize() - inStartingPacket);
|
||||
|
||||
|
||||
*ioDataSize = 0;
|
||||
for (UInt32 i = inStartingPacket; i < (count + inStartingPacket); i++)
|
||||
{
|
||||
@@ -632,7 +632,7 @@ public:
|
||||
|
||||
Boolean GetNeedsSizeUpdate() const { return mNeedsSizeUpdate; }
|
||||
void SetNeedsSizeUpdate(Boolean inNeedsSizeUpdate) { mNeedsSizeUpdate = inNeedsSizeUpdate; }
|
||||
|
||||
|
||||
CFURLRef GetURL () const { return mFileRef; }
|
||||
|
||||
virtual OSStatus GetSourceBitDepth(SInt32& outValue) { outValue = 0; return kAudioFileUnsupportedPropertyError; }
|
||||
@@ -646,7 +646,7 @@ private:
|
||||
void SetAlignDataWithFillerChunks(Boolean inFlag) { mAlignDataWithFillerChunks = inFlag; }
|
||||
|
||||
OSStatus ValidateFormatAndData();
|
||||
|
||||
|
||||
/* debug */
|
||||
// virtual void PrintFile (FILE* inFile, const char *indent) = 0;
|
||||
};
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: CompressedPacketTable.cpp
|
||||
Abstract: CompressedPacketTable.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "CompressedPacketTable.h"
|
||||
#include "CAAutoDisposer.h"
|
||||
@@ -66,7 +66,7 @@ void CompressedPacketTable::push_back(const AudioStreamPacketDescriptionExtended
|
||||
{
|
||||
SInt64 baseIndex = mSize >> kShift;
|
||||
UInt32 packetIndex = (UInt32)(mSize & kMask);
|
||||
|
||||
|
||||
if (packetIndex == 0) {
|
||||
// first packet in a new sequence. create a new PacketBase.
|
||||
PacketBase newBase;
|
||||
@@ -75,16 +75,16 @@ void CompressedPacketTable::push_back(const AudioStreamPacketDescriptionExtended
|
||||
newBase.mDescType = kExtendedPacketDescription;
|
||||
mBases.push_back(newBase);
|
||||
}
|
||||
|
||||
|
||||
PacketBase& base = mBases[(size_t)baseIndex];
|
||||
AudioStreamPacketDescriptionExtended* descs = (AudioStreamPacketDescriptionExtended*)base.mDescs;
|
||||
descs[packetIndex] = inDesc;
|
||||
|
||||
|
||||
if (packetIndex == kMask) {
|
||||
// last packet in a sequence. compress the sequence.
|
||||
Compress(base);
|
||||
}
|
||||
|
||||
|
||||
mSize++;
|
||||
}
|
||||
|
||||
@@ -109,13 +109,13 @@ const AudioStreamPacketDescriptionExtended CompressedPacketTable::operator[](SIn
|
||||
|
||||
if ((size_t)baseIndex >= mBases.size())
|
||||
throw -1;
|
||||
|
||||
|
||||
const PacketBase& base = mBases[(size_t)baseIndex];
|
||||
|
||||
|
||||
SInt64 packetOffset = 0;
|
||||
UInt32 packetSize = 0;
|
||||
|
||||
switch (base.mDescType)
|
||||
|
||||
switch (base.mDescType)
|
||||
{
|
||||
ACCESS_TYPE(Tiny)
|
||||
ACCESS_TYPE(Small)
|
||||
@@ -123,7 +123,7 @@ const AudioStreamPacketDescriptionExtended CompressedPacketTable::operator[](SIn
|
||||
case kExtendedPacketDescription :
|
||||
return ((AudioStreamPacketDescriptionExtended*)base.mDescs)[packetIndex];
|
||||
}
|
||||
|
||||
|
||||
AudioStreamPacketDescriptionExtended outDesc;
|
||||
outDesc.mStartOffset = base.mBaseOffset + packetOffset;
|
||||
outDesc.mDataByteSize = packetSize;
|
||||
@@ -131,14 +131,14 @@ const AudioStreamPacketDescriptionExtended CompressedPacketTable::operator[](SIn
|
||||
outDesc.mFrameOffset = mFramesPerPacket * inPacketIndex;
|
||||
|
||||
//printf("get %d %10qd %10qd %2d %10qd %6d %10qd\n", base.mDescType, inPacketIndex, baseIndex, packetIndex, outDesc.mStartOffset, outDesc.mDataByteSize, outDesc.mFrameOffset);
|
||||
|
||||
|
||||
return outDesc;
|
||||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
bool CompressedPacketTable::isContiguous(PacketBase& base)
|
||||
{
|
||||
{
|
||||
AudioStreamPacketDescriptionExtended* descs = (AudioStreamPacketDescriptionExtended*)base.mDescs;
|
||||
SInt64 expectedOffset = descs[0].mStartOffset + descs[0].mDataByteSize;
|
||||
for (UInt32 i = 1; i <= kMask; ++i) {
|
||||
@@ -149,7 +149,7 @@ bool CompressedPacketTable::isContiguous(PacketBase& base)
|
||||
}
|
||||
|
||||
bool CompressedPacketTable::hasVariableFrames(PacketBase& base)
|
||||
{
|
||||
{
|
||||
AudioStreamPacketDescriptionExtended* descs = (AudioStreamPacketDescriptionExtended*)base.mDescs;
|
||||
for (UInt32 i = 0; i <= kMask; ++i) {
|
||||
if (descs[i].mVariableFramesInPacket) return true;
|
||||
@@ -158,7 +158,7 @@ bool CompressedPacketTable::hasVariableFrames(PacketBase& base)
|
||||
}
|
||||
|
||||
UInt32 CompressedPacketTable::largestPacket(PacketBase& base)
|
||||
{
|
||||
{
|
||||
UInt32 maxPacketSize = 0;
|
||||
AudioStreamPacketDescriptionExtended* descs = (AudioStreamPacketDescriptionExtended*)base.mDescs;
|
||||
for (UInt32 i = 0; i <= kMask; ++i) {
|
||||
@@ -193,17 +193,17 @@ UInt32 CompressedPacketTable::largestPacket(PacketBase& base)
|
||||
|
||||
void CompressedPacketTable::Compress(PacketBase& base)
|
||||
{
|
||||
if (hasVariableFrames(base))
|
||||
if (hasVariableFrames(base))
|
||||
return;
|
||||
|
||||
|
||||
bool contiguous = isContiguous(base);
|
||||
|
||||
|
||||
AudioStreamPacketDescriptionExtended* descs = (AudioStreamPacketDescriptionExtended*)base.mDescs;
|
||||
SInt64 delta = descs[kMask].mStartOffset + descs[kMask].mDataByteSize - descs[0].mStartOffset;
|
||||
|
||||
|
||||
SInt64 baseOffset = descs[0].mStartOffset;
|
||||
base.mBaseOffset = baseOffset;
|
||||
|
||||
|
||||
if (delta <= 65535LL) {
|
||||
COMPRESS_TYPE(Tiny, UInt16)
|
||||
} else if (delta <= 4294967295LL && largestPacket(base) <= 65535) {
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: CompressedPacketTable.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
@@ -72,17 +72,17 @@ class CompressedPacketTable
|
||||
public:
|
||||
CompressedPacketTable(UInt32 inFramesPerPacket) : mSize(0), mFramesPerPacket(inFramesPerPacket) {}
|
||||
~CompressedPacketTable();
|
||||
|
||||
|
||||
SInt64 size() const { return mSize; }
|
||||
void push_back(const AudioStreamPacketDescriptionExtended& inDesc);
|
||||
|
||||
|
||||
const AudioStreamPacketDescriptionExtended operator[](SInt64 inPacketIndex) const;
|
||||
const AudioStreamPacketDescriptionExtended front() const { return (*this)[0]; }
|
||||
const AudioStreamPacketDescriptionExtended back() const { return (*this)[mSize-1]; }
|
||||
|
||||
|
||||
//SInt64 PacketForByte(SInt64 inByteOffset) const;
|
||||
SInt64 ByteForPacket(SInt64 inPacketIndex) const { return (*this)[inPacketIndex].mStartOffset; }
|
||||
|
||||
|
||||
class iterator {
|
||||
public:
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
@@ -90,18 +90,18 @@ public:
|
||||
typedef SInt64 difference_type;
|
||||
typedef AudioStreamPacketDescriptionExtended value_type;
|
||||
typedef value_type& reference;
|
||||
|
||||
|
||||
iterator() : mTable(NULL), mIndex(0) {}
|
||||
iterator(const CompressedPacketTable* table, SInt64 index) : mTable(table), mIndex(index) {}
|
||||
iterator(const iterator& that) : mTable(that.mTable), mIndex(that.mIndex) {}
|
||||
|
||||
|
||||
iterator& operator=(const iterator& that) { mTable = that.mTable; mIndex = that.mIndex; return *this; }
|
||||
|
||||
|
||||
const AudioStreamPacketDescriptionExtended operator*() const { return (*mTable)[mIndex]; }
|
||||
const AudioStreamPacketDescriptionExtended* const operator->() { mValue = (*mTable)[mIndex]; return &mValue; }
|
||||
iterator& operator++() { ++mIndex; return *this; }
|
||||
iterator& operator--() { --mIndex; return *this; }
|
||||
|
||||
|
||||
SInt64 operator-(const iterator& that) { return mIndex - that.mIndex; }
|
||||
const iterator operator-(SInt64 index) { return iterator(mTable, mIndex - index); }
|
||||
const iterator operator+(SInt64 index) { return iterator(mTable, mIndex + index); }
|
||||
@@ -114,52 +114,52 @@ public:
|
||||
SInt64 mIndex;
|
||||
AudioStreamPacketDescriptionExtended mValue; // in order to support operator-> .
|
||||
};
|
||||
|
||||
|
||||
iterator begin() const { return iterator(this, 0); }
|
||||
iterator end() const { return iterator(this, mSize); }
|
||||
|
||||
|
||||
private:
|
||||
struct TinyContiguousPacketDescription
|
||||
{
|
||||
UInt16 mNextOffset;
|
||||
};
|
||||
|
||||
|
||||
struct TinyDiscontiguousPacketDescription : TinyContiguousPacketDescription
|
||||
{
|
||||
UInt16 mDataByteSize;
|
||||
};
|
||||
|
||||
// There could be a 24 bit packet description. But ALAC is who usually needs SmallContiguousPacketDescription and
|
||||
// it already uses 8x fewer packet descriptions than AAC due to the mFramesPerPacket being 8x greater.
|
||||
|
||||
// There could be a 24 bit packet description. But ALAC is who usually needs SmallContiguousPacketDescription and
|
||||
// it already uses 8x fewer packet descriptions than AAC due to the mFramesPerPacket being 8x greater.
|
||||
// So there isn't as great a need for saving space. 4 bytes per packet is OK for ALAC.
|
||||
|
||||
|
||||
struct SmallContiguousPacketDescription
|
||||
{
|
||||
UInt32 mNextOffset;
|
||||
};
|
||||
|
||||
|
||||
struct SmallDiscontiguousPacketDescription : SmallContiguousPacketDescription
|
||||
{
|
||||
UInt16 mDataByteSize;
|
||||
};
|
||||
|
||||
|
||||
struct BigContiguousPacketDescription
|
||||
{
|
||||
UInt64 mNextOffset;
|
||||
};
|
||||
|
||||
|
||||
struct BigDiscontiguousPacketDescription : BigContiguousPacketDescription
|
||||
{
|
||||
UInt32 mDataByteSize;
|
||||
};
|
||||
|
||||
|
||||
struct PacketBase
|
||||
{
|
||||
SInt64 mBaseOffset;
|
||||
UInt8 mDescType;
|
||||
void* mDescs;
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
kTinyContiguousPacketDescription,
|
||||
kTinyDiscontiguousPacketDescription,
|
||||
@@ -171,14 +171,14 @@ private:
|
||||
};
|
||||
static const UInt32 kShift;
|
||||
static const UInt32 kMask;
|
||||
|
||||
|
||||
bool isContiguous(PacketBase& base);
|
||||
bool hasVariableFrames(PacketBase& base);
|
||||
UInt32 largestPacket(PacketBase& base);
|
||||
|
||||
|
||||
void Compress(PacketBase& base);
|
||||
|
||||
private:
|
||||
private:
|
||||
std::vector<PacketBase> mBases;
|
||||
UInt64 mSize;
|
||||
UInt32 mFramesPerPacket;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: DataSource.cpp
|
||||
Abstract: DataSource.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "DataSource.h"
|
||||
#if TARGET_OS_WIN32
|
||||
@@ -70,7 +70,7 @@ DataSource::~DataSource()
|
||||
{
|
||||
}
|
||||
|
||||
SInt64 DataSource::CalcOffset( UInt16 positionMode,
|
||||
SInt64 DataSource::CalcOffset( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
SInt64 currentOffset,
|
||||
SInt64 size)
|
||||
@@ -120,10 +120,10 @@ OSStatus MacFile_DataSource::SetSize(SInt64 inSize)
|
||||
|
||||
|
||||
OSStatus MacFile_DataSource::ReadBytes(
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount)
|
||||
{
|
||||
if (actualCount) *actualCount = 0;
|
||||
@@ -135,10 +135,10 @@ OSStatus MacFile_DataSource::ReadBytes(
|
||||
}
|
||||
|
||||
OSStatus MacFile_DataSource::WriteBytes(
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt32* actualCount)
|
||||
{
|
||||
if (!buffer) return kAudio_ParamError;
|
||||
@@ -162,7 +162,7 @@ UnixFile_DataSource::~UnixFile_DataSource()
|
||||
{
|
||||
if (mCloseOnDelete) close(mFileD);
|
||||
}
|
||||
|
||||
|
||||
OSStatus UnixFile_DataSource::GetSize(SInt64& outSize)
|
||||
{
|
||||
#if 0 // 6764274 using the cached file size causes a regression for apps that play a file while writing to it.
|
||||
@@ -197,31 +197,31 @@ OSStatus UnixFile_DataSource::GetPos(SInt64& outPos) const
|
||||
return noErr;
|
||||
}
|
||||
|
||||
SInt64 UnixFile_DataSource::UFCurrentOffset (UInt16 positionMode,
|
||||
SInt64 UnixFile_DataSource::UFCurrentOffset (UInt16 positionMode,
|
||||
SInt64 positionOffset)
|
||||
{
|
||||
SInt64 offset = -1;
|
||||
switch (positionMode & kPositionModeMask)
|
||||
switch (positionMode & kPositionModeMask)
|
||||
{
|
||||
/*case fsAtMark :
|
||||
/*case fsAtMark :
|
||||
{
|
||||
SInt64 pos;
|
||||
OSStatus result = GetPos (pos);
|
||||
if (result) return result;
|
||||
offset = pos;
|
||||
offset = pos;
|
||||
break;
|
||||
}*/
|
||||
case SEEK_SET :
|
||||
{
|
||||
offset = positionOffset;
|
||||
offset = positionOffset;
|
||||
break;
|
||||
}
|
||||
case SEEK_END :
|
||||
case SEEK_END :
|
||||
{
|
||||
SInt64 size;
|
||||
OSStatus result = GetSize (size);
|
||||
if (result) return result;
|
||||
offset = size + positionOffset;
|
||||
offset = size + positionOffset;
|
||||
break;
|
||||
}
|
||||
case SEEK_CUR :
|
||||
@@ -229,23 +229,23 @@ SInt64 UnixFile_DataSource::UFCurrentOffset (UInt16 positionMode,
|
||||
SInt64 pos;
|
||||
OSStatus result = GetPos (pos);
|
||||
if (result) return result;
|
||||
offset = positionOffset + pos;
|
||||
offset = positionOffset + pos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
OSStatus UnixFile_DataSource::ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount)
|
||||
{
|
||||
if (actualCount) *actualCount = 0;
|
||||
if (!buffer) return kAudio_ParamError;
|
||||
|
||||
// can't use current offset as we need to go to the disk too much
|
||||
// can't use current offset as we need to go to the disk too much
|
||||
SInt64 offset = UFCurrentOffset (positionMode, positionOffset);
|
||||
if (offset < 0) return kAudioFilePositionError;
|
||||
|
||||
@@ -260,7 +260,7 @@ OSStatus UnixFile_DataSource::ReadBytes( UInt16 positionMode,
|
||||
else if (requestCount > remain) requestCount = remain;
|
||||
} while (false);
|
||||
#endif
|
||||
|
||||
|
||||
if (requestCount <= 0) {
|
||||
if (actualCount) *actualCount = 0;
|
||||
return noErr;
|
||||
@@ -283,20 +283,20 @@ OSStatus UnixFile_DataSource::ReadBytes( UInt16 positionMode,
|
||||
#endif
|
||||
if (numBytes == -1) return kAudioFilePositionError;
|
||||
mFilePointer = offset + numBytes;
|
||||
|
||||
|
||||
if (actualCount) *actualCount = (UInt32)numBytes;
|
||||
return noErr;
|
||||
}
|
||||
|
||||
OSStatus UnixFile_DataSource::WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
|
||||
OSStatus UnixFile_DataSource::WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt32* actualCount)
|
||||
{
|
||||
if (!buffer) return kAudio_ParamError;
|
||||
|
||||
// can't use current offset as we need to go to the disk too much
|
||||
// can't use current offset as we need to go to the disk too much
|
||||
SInt64 offset = UFCurrentOffset (positionMode, positionOffset);
|
||||
if (offset < 0) return kAudioFilePositionError;
|
||||
|
||||
@@ -320,7 +320,7 @@ OSStatus UnixFile_DataSource::WriteBytes(UInt16 positionMode,
|
||||
#endif
|
||||
if (numBytes == -1) return kAudioFilePositionError;
|
||||
mFilePointer = offset + numBytes;
|
||||
|
||||
|
||||
if (actualCount) *actualCount = (UInt32)numBytes;
|
||||
return noErr;
|
||||
}
|
||||
@@ -330,50 +330,50 @@ OSStatus UnixFile_DataSource::WriteBytes(UInt16 positionMode,
|
||||
#define NO_CACHE 0
|
||||
|
||||
OSStatus Cached_DataSource::ReadFromHeaderCache(
|
||||
SInt64 offset,
|
||||
SInt64 offset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
void *buffer,
|
||||
UInt32* actualCount)
|
||||
{
|
||||
if (actualCount) *actualCount = 0;
|
||||
OSStatus err = noErr;
|
||||
ByteCount theActualCount = 0;
|
||||
|
||||
#if VERBOSE
|
||||
#if VERBOSE
|
||||
printf("read from header %lld %lu %lld %lu\n", offset, requestCount, 0LL, mHeaderCacheSize);
|
||||
#endif
|
||||
|
||||
if (!mHeaderCache())
|
||||
if (!mHeaderCache())
|
||||
{
|
||||
mHeaderCache.allocBytes(mHeaderCacheSize, true);
|
||||
err = mDataSource->ReadBytes(SEEK_SET, 0, mHeaderCacheSize, mHeaderCache(), &mHeaderCacheSize);
|
||||
if (err == kAudioFileEndOfFileError) err = noErr;
|
||||
if (err) return err;
|
||||
}
|
||||
|
||||
|
||||
ByteCount firstPart = std::min((ByteCount)requestCount, (ByteCount)(mHeaderCacheSize - offset));
|
||||
ByteCount secondPart = requestCount - firstPart;
|
||||
|
||||
|
||||
memcpy(buffer, mHeaderCache + (ByteCount)offset, firstPart);
|
||||
theActualCount = firstPart;
|
||||
|
||||
|
||||
if (secondPart) {
|
||||
UInt32 secondPartActualCount = 0;
|
||||
err = mDataSource->ReadBytes(SEEK_SET, mHeaderCacheSize, static_cast<UInt32>(secondPart), (char*)buffer + firstPart, &secondPartActualCount);
|
||||
theActualCount += secondPartActualCount;
|
||||
}
|
||||
|
||||
|
||||
if (actualCount) *actualCount = (UInt32)theActualCount;
|
||||
mOffset = offset + theActualCount;
|
||||
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
OSStatus Cached_DataSource::ReadBytes(
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount)
|
||||
{
|
||||
if (actualCount) *actualCount = 0;
|
||||
@@ -384,7 +384,7 @@ OSStatus Cached_DataSource::ReadBytes(
|
||||
if (!buffer) return kAudio_ParamError;
|
||||
|
||||
if ((positionMode & kPositionModeMask) != SEEK_END) size = 0; // not used in this case
|
||||
else
|
||||
else
|
||||
{
|
||||
err = GetSize(size);
|
||||
if (err) return err;
|
||||
@@ -392,7 +392,7 @@ OSStatus Cached_DataSource::ReadBytes(
|
||||
|
||||
SInt64 offset = CalcOffset(positionMode, positionOffset, mOffset, size);
|
||||
if (offset < 0) return kAudioFilePositionError;
|
||||
|
||||
|
||||
if (offset < mHeaderCacheSize) {
|
||||
return ReadFromHeaderCache(offset, requestCount, buffer, actualCount);
|
||||
}
|
||||
@@ -405,10 +405,10 @@ OSStatus Cached_DataSource::ReadBytes(
|
||||
SInt64 cacheEnd = mBodyCacheOffset + mBodyCacheCurSize;
|
||||
if (mBodyCache() && requestCount < mBodyCacheSize && offset >= mBodyCacheOffset && offset < cacheEnd)
|
||||
{
|
||||
if (offset + requestCount <= cacheEnd)
|
||||
if (offset + requestCount <= cacheEnd)
|
||||
{
|
||||
// request is entirely within cache
|
||||
#if VERBOSE
|
||||
#if VERBOSE
|
||||
printf("request is entirely within cache %lld %lu %lld %lu\n", offset, requestCount, mBodyCacheOffset, mBodyCacheCurSize);
|
||||
#endif
|
||||
memcpy(buffer, mBodyCache + (size_t)(offset - mBodyCacheOffset), requestCount);
|
||||
@@ -417,25 +417,25 @@ OSStatus Cached_DataSource::ReadBytes(
|
||||
else
|
||||
{
|
||||
// part of request is within cache. copy, read next cache block, copy.
|
||||
#if VERBOSE
|
||||
#if VERBOSE
|
||||
printf("part of request is within cache %lld %lu %lld %lu\n", offset, requestCount, mBodyCacheOffset, mBodyCacheCurSize);
|
||||
#endif
|
||||
|
||||
|
||||
// copy first part.
|
||||
ByteCount firstPart = (ByteCount)(cacheEnd - offset);
|
||||
ByteCount secondPart = requestCount - firstPart;
|
||||
#if VERBOSE
|
||||
printf("memcpy offset %lld mBodyCacheOffset %lld offset - mBodyCacheOffset %lld firstPart %lu requestCount %lu\n",
|
||||
#if VERBOSE
|
||||
printf("memcpy offset %lld mBodyCacheOffset %lld offset - mBodyCacheOffset %lld firstPart %lu requestCount %lu\n",
|
||||
offset, mBodyCacheOffset, offset - mBodyCacheOffset, firstPart, requestCount);
|
||||
#endif
|
||||
memcpy(buffer, mBodyCache + (size_t)(offset - mBodyCacheOffset), firstPart);
|
||||
|
||||
|
||||
theActualCount = static_cast<UInt32>(firstPart);
|
||||
|
||||
|
||||
// read new block
|
||||
SInt64 nextOffset = mBodyCacheOffset + mBodyCacheCurSize;
|
||||
err = mDataSource->ReadBytes(SEEK_SET, nextOffset, mBodyCacheSize, mBodyCache(), &mBodyCacheCurSize);
|
||||
|
||||
|
||||
if (err == kAudioFileEndOfFileError) err = noErr;
|
||||
if (err) goto leave;
|
||||
|
||||
@@ -447,11 +447,11 @@ OSStatus Cached_DataSource::ReadBytes(
|
||||
theActualCount = static_cast<UInt32>(firstPart + secondPart);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (requestCount > mBodyCacheSize)
|
||||
{
|
||||
#if VERBOSE
|
||||
#if VERBOSE
|
||||
printf("large request %lld %lu %lld %lu\n", offset, requestCount, mBodyCacheOffset, mBodyCacheCurSize);
|
||||
#endif
|
||||
// the request is larger than we normally cache, just do a read and don't cache.
|
||||
@@ -461,19 +461,19 @@ OSStatus Cached_DataSource::ReadBytes(
|
||||
else
|
||||
{
|
||||
// request is outside cache. read new block.
|
||||
#if VERBOSE
|
||||
#if VERBOSE
|
||||
printf("request is outside cache %lld %lu %lld %lu\n", offset, requestCount, mBodyCacheOffset, mBodyCacheCurSize);
|
||||
#endif
|
||||
if (!mBodyCache())
|
||||
if (!mBodyCache())
|
||||
{
|
||||
mBodyCache.allocBytes(mBodyCacheSize, true);
|
||||
#if VERBOSE
|
||||
#if VERBOSE
|
||||
printf("alloc mBodyCache %08X\n", mBodyCache());
|
||||
#endif
|
||||
}
|
||||
mBodyCacheOffset = offset;
|
||||
err = mDataSource->ReadBytes(SEEK_SET, mBodyCacheOffset, mBodyCacheSize, mBodyCache(), &mBodyCacheCurSize);
|
||||
#if VERBOSE
|
||||
#if VERBOSE
|
||||
printf("read %08X %d mBodyCacheOffset %lld %lu %lu\n", err, err, mBodyCacheOffset, mBodyCacheSize, mBodyCacheCurSize);
|
||||
#endif
|
||||
if (err == kAudioFileEndOfFileError) err = noErr;
|
||||
@@ -482,32 +482,32 @@ OSStatus Cached_DataSource::ReadBytes(
|
||||
theActualCount = std::min(requestCount, mBodyCacheCurSize);
|
||||
memcpy(buffer, mBodyCache(), theActualCount);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
leave:
|
||||
#endif
|
||||
if (actualCount) *actualCount = (UInt32)theActualCount;
|
||||
#if VERBOSE
|
||||
#if VERBOSE
|
||||
printf("<<read err %d actualCount %lu\n", err, *actualCount);
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
||||
OSStatus Cached_DataSource::WriteBytes(
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt32* actualCount)
|
||||
{
|
||||
OSStatus err = noErr;
|
||||
SInt64 size;
|
||||
|
||||
if (!buffer) return kAudio_ParamError;
|
||||
|
||||
|
||||
if ((positionMode & kPositionModeMask) != SEEK_END) size = 0; // not used in this case
|
||||
else
|
||||
else
|
||||
{
|
||||
err = GetSize(size);
|
||||
if (err) return err;
|
||||
@@ -515,18 +515,18 @@ OSStatus Cached_DataSource::WriteBytes(
|
||||
|
||||
SInt64 offset = CalcOffset(positionMode, positionOffset, mOffset, size);
|
||||
if (offset < 0) return kAudioFilePositionError;
|
||||
|
||||
if (mHeaderCache() && offset < mHeaderCacheSize)
|
||||
|
||||
if (mHeaderCache() && offset < mHeaderCacheSize)
|
||||
{
|
||||
// header cache write through
|
||||
ByteCount firstPart = std::min((ByteCount)requestCount, (ByteCount)(mHeaderCacheSize - offset));
|
||||
#if VERBOSE
|
||||
#if VERBOSE
|
||||
printf("header cache write through %lu %lu\n", mHeaderCacheSize, firstPart);
|
||||
#endif
|
||||
memcpy(mHeaderCache + (size_t)offset, buffer, firstPart);
|
||||
}
|
||||
|
||||
#if VERBOSE
|
||||
|
||||
#if VERBOSE
|
||||
printf("write %lld %lu %lld %d %lld\n", offset, requestCount, mOffset, positionMode, positionOffset);
|
||||
#endif
|
||||
|
||||
@@ -535,18 +535,18 @@ OSStatus Cached_DataSource::WriteBytes(
|
||||
{
|
||||
// body cache write through
|
||||
ByteCount firstPart = std::min((SInt64)requestCount, cacheEnd - offset);
|
||||
#if VERBOSE
|
||||
#if VERBOSE
|
||||
printf("body cache write through %lld %lu %lld %lu\n", mBodyCacheOffset, mBodyCacheCurSize, offset, firstPart);
|
||||
#endif
|
||||
memcpy(mBodyCache + (offset - mBodyCacheOffset), buffer, firstPart);
|
||||
}
|
||||
|
||||
|
||||
UInt32 theActualCount;
|
||||
err = mDataSource->WriteBytes(positionMode, positionOffset, requestCount, buffer, &theActualCount);
|
||||
|
||||
|
||||
mOffset = offset + theActualCount;
|
||||
if (actualCount) *actualCount = (UInt32)theActualCount;
|
||||
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -555,11 +555,11 @@ OSStatus Cached_DataSource::WriteBytes(
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Seekable_DataSource::Seekable_DataSource( void * inClientData,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc)
|
||||
: DataSource(false), mClientData(inClientData), mReadFunc(inReadFunc), mWriteFunc(inWriteFunc),
|
||||
: DataSource(false), mClientData(inClientData), mReadFunc(inReadFunc), mWriteFunc(inWriteFunc),
|
||||
mSizeFunc(inGetSizeFunc), mSetSizeFunc(inSetSizeFunc)
|
||||
{
|
||||
}
|
||||
@@ -585,15 +585,15 @@ OSStatus Seekable_DataSource::SetSize(SInt64 inSize)
|
||||
return (*mSetSizeFunc)(mClientData, inSize);
|
||||
}
|
||||
|
||||
OSStatus Seekable_DataSource::ReadBytes(
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
OSStatus Seekable_DataSource::ReadBytes(
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount)
|
||||
{
|
||||
OSStatus err;
|
||||
|
||||
|
||||
if (actualCount) *actualCount = 0;
|
||||
if (!mReadFunc) return kAudioFileOperationNotSupportedError;
|
||||
if (!buffer) return kAudio_ParamError;
|
||||
@@ -605,16 +605,16 @@ OSStatus Seekable_DataSource::ReadBytes(
|
||||
if (err) return err;
|
||||
|
||||
SInt64 offset = CalcOffset(positionMode, positionOffset, mOffset, size);
|
||||
|
||||
|
||||
// request is outside bounds of file
|
||||
if (offset < 0)
|
||||
if (offset < 0)
|
||||
return kAudioFilePositionError;
|
||||
if (offset >= size)
|
||||
if (offset >= size)
|
||||
return kAudioFileEndOfFileError;
|
||||
|
||||
|
||||
// reduce request if it exceeds the amount available
|
||||
requestCount = static_cast<UInt32>(std::min((SInt64)requestCount, size - offset));
|
||||
|
||||
|
||||
UInt32 theActualCount = 0;
|
||||
err = (*mReadFunc)(mClientData, offset, requestCount, buffer, &theActualCount);
|
||||
if (actualCount) *actualCount = theActualCount;
|
||||
@@ -622,23 +622,23 @@ OSStatus Seekable_DataSource::ReadBytes(
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSStatus Seekable_DataSource::WriteBytes(
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt32* actualCount)
|
||||
{
|
||||
OSStatus err;
|
||||
|
||||
|
||||
if (!mWriteFunc) return kAudioFileOperationNotSupportedError;
|
||||
if (!buffer) return kAudio_ParamError;
|
||||
|
||||
SInt64 size;
|
||||
positionMode &= kPositionModeMask;
|
||||
if (positionMode != SEEK_END) size = 0; // not used in this case
|
||||
else
|
||||
else
|
||||
{
|
||||
err = GetSize(size);
|
||||
if (err) return err;
|
||||
@@ -646,7 +646,7 @@ OSStatus Seekable_DataSource::WriteBytes(
|
||||
|
||||
SInt64 offset = CalcOffset(positionMode, positionOffset, mOffset, size);
|
||||
if (offset < 0) return kAudioFilePositionError;
|
||||
|
||||
|
||||
UInt32 theActualCount;
|
||||
err = (*mWriteFunc)(mClientData, offset, requestCount, buffer, &theActualCount);
|
||||
if (err) return err;
|
||||
@@ -658,16 +658,16 @@ OSStatus Seekable_DataSource::WriteBytes(
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
OSStatus Buffer_DataSource::ReadBytes(
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount)
|
||||
{
|
||||
if (actualCount) *actualCount = 0;
|
||||
SInt64 offsetWithinBuffer = CalcOffset(positionMode, positionOffset, mOffset, mDataByteSize + mStartOffset) - mStartOffset;
|
||||
SInt64 offsetWithinBuffer = CalcOffset(positionMode, positionOffset, mOffset, mDataByteSize + mStartOffset) - mStartOffset;
|
||||
if (offsetWithinBuffer < 0 || offsetWithinBuffer >= mDataByteSize) return kAudioFilePositionError;
|
||||
|
||||
|
||||
SInt64 bytesAfterOffset = mDataByteSize - offsetWithinBuffer;
|
||||
SInt64 theActualCount = std::min(bytesAfterOffset, (SInt64)requestCount);
|
||||
|
||||
@@ -677,7 +677,7 @@ OSStatus Buffer_DataSource::ReadBytes(
|
||||
}
|
||||
|
||||
memcpy(buffer, mData + offsetWithinBuffer, theActualCount);
|
||||
|
||||
|
||||
if (actualCount) *actualCount = static_cast<UInt32>(theActualCount);
|
||||
mOffset = offsetWithinBuffer + theActualCount;
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: DataSource.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __DataSource_h__
|
||||
#define __DataSource_h__
|
||||
@@ -63,10 +63,10 @@
|
||||
class DataSource
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
DataSource(Boolean inCloseOnDelete);
|
||||
virtual ~DataSource();
|
||||
|
||||
|
||||
virtual OSStatus GetSize32(UInt32& outSize)
|
||||
{
|
||||
SInt64 size64;
|
||||
@@ -76,43 +76,43 @@ public:
|
||||
outSize = (UInt32)size64;
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
||||
virtual OSStatus GetSize(SInt64& outSize) =0;
|
||||
|
||||
|
||||
virtual OSStatus SetSize(SInt64 inSize)=0;
|
||||
|
||||
virtual OSStatus GetPos(SInt64& outPos) const=0;
|
||||
|
||||
/* non seekable data sources should use fsAtMark for the positionMode (or SEEK_CUR with offset zero,
|
||||
or SEEK_SET with offset equal to the current position in the stream, in other words no seeking from the
|
||||
|
||||
virtual OSStatus GetPos(SInt64& outPos) const=0;
|
||||
|
||||
/* non seekable data sources should use fsAtMark for the positionMode (or SEEK_CUR with offset zero,
|
||||
or SEEK_SET with offset equal to the current position in the stream, in other words no seeking from the
|
||||
current position is allowed.)
|
||||
*/
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount)=0;
|
||||
|
||||
virtual OSStatus WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
|
||||
virtual OSStatus WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt32* actualCount)=0;
|
||||
|
||||
|
||||
virtual void SetCloseOnDelete(Boolean inFlag) { mCloseOnDelete = inFlag; }
|
||||
|
||||
|
||||
virtual Boolean CanSeek() const=0;
|
||||
virtual Boolean CanGetSize() const=0;
|
||||
virtual Boolean CanSetSize() const=0;
|
||||
virtual Boolean CanRead() const=0;
|
||||
virtual Boolean CanWrite() const=0;
|
||||
|
||||
|
||||
protected:
|
||||
Boolean mCloseOnDelete;
|
||||
|
||||
|
||||
/* utility method */
|
||||
SInt64 CalcOffset( UInt16 positionMode,
|
||||
SInt64 CalcOffset( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
SInt64 currentOffset,
|
||||
SInt64 size);
|
||||
@@ -131,33 +131,33 @@ class MacFile_DataSource : public DataSource
|
||||
{
|
||||
FSIORefNum mFileNum;
|
||||
SInt8 mPermissions;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
MacFile_DataSource( FSIORefNum inForkRefNum, SInt8 inPermissions, Boolean inCloseOnDelete);
|
||||
virtual ~MacFile_DataSource();
|
||||
|
||||
|
||||
virtual OSStatus GetSize(SInt64& outSize);
|
||||
virtual OSStatus GetPos(SInt64& outPos) const;
|
||||
|
||||
virtual OSStatus GetPos(SInt64& outPos) const;
|
||||
|
||||
virtual OSStatus SetSize(SInt64 inSize);
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
virtual OSStatus WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
|
||||
virtual OSStatus WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
|
||||
virtual Boolean CanSeek() const { return true; }
|
||||
virtual Boolean CanGetSize() const { return true; }
|
||||
virtual Boolean CanSetSize() const { return true; }
|
||||
|
||||
|
||||
virtual Boolean CanRead() const { return mPermissions & kAudioFileReadPermission; }
|
||||
virtual Boolean CanWrite() const { return mPermissions & kAudioFileWritePermission; }
|
||||
};
|
||||
@@ -171,39 +171,39 @@ class UnixFile_DataSource : public DataSource
|
||||
UInt32 mNoCache;
|
||||
SInt64 mCachedSize;
|
||||
SInt64 mFilePointer;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
UnixFile_DataSource( int inFD, SInt8 inPermissions, Boolean inCloseOnDelete);
|
||||
virtual ~UnixFile_DataSource();
|
||||
|
||||
|
||||
virtual OSStatus GetSize(SInt64& outSize);
|
||||
virtual OSStatus GetPos(SInt64& outPos) const;
|
||||
|
||||
virtual OSStatus GetPos(SInt64& outPos) const;
|
||||
|
||||
virtual OSStatus SetSize(SInt64 inSize);
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
virtual OSStatus WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
|
||||
virtual OSStatus WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
|
||||
virtual Boolean CanSeek() const { return true; }
|
||||
virtual Boolean CanGetSize() const { return true; }
|
||||
virtual Boolean CanSetSize() const { return true; }
|
||||
|
||||
|
||||
virtual Boolean CanRead() const { return mPermissions & kAudioFileReadPermission; }
|
||||
virtual Boolean CanWrite() const { return mPermissions & kAudioFileWritePermission; }
|
||||
|
||||
private:
|
||||
|
||||
SInt64 UFCurrentOffset (UInt16 positionMode,
|
||||
SInt64 UFCurrentOffset (UInt16 positionMode,
|
||||
SInt64 positionOffset);
|
||||
};
|
||||
|
||||
@@ -225,50 +225,50 @@ class Cached_DataSource : public DataSource
|
||||
SInt64 mBodyCacheOffset;
|
||||
SInt64 mOffset;
|
||||
Boolean mOwnDataSource;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
Cached_DataSource(DataSource* inDataSource, UInt32 inHeaderCacheSize = 4096, UInt32 inBodyCacheSize = 32768, Boolean inOwnDataSource = true)
|
||||
: DataSource(false),
|
||||
mDataSource(inDataSource), mHeaderCacheSize(inHeaderCacheSize),
|
||||
mBodyCacheSize(inBodyCacheSize), mBodyCacheCurSize(0), mBodyCacheOffset(-1),
|
||||
: DataSource(false),
|
||||
mDataSource(inDataSource), mHeaderCacheSize(inHeaderCacheSize),
|
||||
mBodyCacheSize(inBodyCacheSize), mBodyCacheCurSize(0), mBodyCacheOffset(-1),
|
||||
mOffset(0),
|
||||
mOwnDataSource(inOwnDataSource)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual ~Cached_DataSource()
|
||||
{
|
||||
if (mOwnDataSource) delete mDataSource;
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual OSStatus GetSize(SInt64& outSize) { return mDataSource->GetSize(outSize); }
|
||||
virtual OSStatus GetPos(SInt64& outPos) const { return mDataSource->GetPos(outPos); }
|
||||
|
||||
virtual OSStatus GetPos(SInt64& outPos) const { return mDataSource->GetPos(outPos); }
|
||||
|
||||
virtual OSStatus SetSize(SInt64 inSize) { return mDataSource->SetSize(inSize); }
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
virtual OSStatus WriteBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
OSStatus ReadFromHeaderCache( SInt64 offset,
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
|
||||
virtual OSStatus WriteBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
OSStatus ReadFromHeaderCache( SInt64 offset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
virtual Boolean CanSeek() const { return mDataSource->CanSeek(); }
|
||||
virtual Boolean CanGetSize() const { return mDataSource->CanGetSize(); }
|
||||
virtual Boolean CanSetSize() const { return mDataSource->CanSetSize(); }
|
||||
|
||||
|
||||
virtual Boolean CanRead() const { return mDataSource->CanRead(); }
|
||||
virtual Boolean CanWrite() const { return mDataSource->CanWrite(); }
|
||||
};
|
||||
@@ -286,37 +286,37 @@ class Seekable_DataSource : public DataSource
|
||||
{
|
||||
void * mClientData;
|
||||
SInt64 mOffset;
|
||||
|
||||
|
||||
AudioFile_ReadProc mReadFunc;
|
||||
AudioFile_WriteProc mWriteFunc;
|
||||
AudioFile_GetSizeProc mSizeFunc;
|
||||
AudioFile_SetSizeProc mSetSizeFunc;
|
||||
|
||||
|
||||
public:
|
||||
Seekable_DataSource( void * inClientData,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_ReadProc inReadFunc,
|
||||
AudioFile_WriteProc inWriteFunc,
|
||||
AudioFile_GetSizeProc inGetSizeFunc,
|
||||
AudioFile_SetSizeProc inSetSizeFunc
|
||||
);
|
||||
|
||||
|
||||
virtual ~Seekable_DataSource();
|
||||
|
||||
|
||||
virtual OSStatus GetSize(SInt64& outSize);
|
||||
virtual OSStatus GetPos(SInt64& outPos) const { outPos = mOffset; return noErr; };
|
||||
|
||||
virtual OSStatus GetPos(SInt64& outPos) const { outPos = mOffset; return noErr; };
|
||||
|
||||
virtual OSStatus SetSize(SInt64 inSize);
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
virtual OSStatus WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
|
||||
virtual OSStatus WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
virtual Boolean CanSeek() const { return true; }
|
||||
@@ -340,24 +340,24 @@ public:
|
||||
const void * inData,
|
||||
SInt64 inStartOffset = 0
|
||||
) : DataSource(false), mDataByteSize(inDataByteSize), mData((const char*)inData), mStartOffset(inStartOffset), mOffset(mStartOffset) {}
|
||||
|
||||
|
||||
virtual ~Buffer_DataSource() {}
|
||||
|
||||
|
||||
virtual OSStatus GetSize(SInt64& outSize) { outSize = mDataByteSize + mStartOffset; return noErr; }
|
||||
virtual OSStatus GetPos(SInt64& outPos) const { outPos = mOffset; return noErr; };
|
||||
|
||||
virtual OSStatus GetPos(SInt64& outPos) const { outPos = mOffset; return noErr; };
|
||||
|
||||
virtual OSStatus SetSize(SInt64 inSize) { throw std::runtime_error("not writable"); }
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
|
||||
virtual OSStatus ReadBytes( UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
void *buffer,
|
||||
UInt32* actualCount);
|
||||
|
||||
virtual OSStatus WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
|
||||
virtual OSStatus WriteBytes(UInt16 positionMode,
|
||||
SInt64 positionOffset,
|
||||
UInt32 requestCount,
|
||||
const void *buffer,
|
||||
UInt32* actualCount) { throw std::runtime_error("not writable"); }
|
||||
|
||||
virtual Boolean CanSeek() const { return true; }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,14 +2,14 @@
|
||||
File: AUBase.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUBase_h__
|
||||
#define __AUBase_h__
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
#ifndef AUTRACE
|
||||
#define AUTRACE(code, obj, a, b, c, d)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "AUPlugInDispatch.h"
|
||||
|
||||
@@ -92,11 +92,11 @@
|
||||
|
||||
#define kAUDefaultSampleRate 44100.0
|
||||
#if !TARGET_OS_WIN32
|
||||
#define kAUDefaultMaxFramesPerSlice 1156
|
||||
#define kAUDefaultMaxFramesPerSlice 1156
|
||||
//this allows enough default frames for a 512 dest 44K and SRC from 96K
|
||||
// add a padding of 4 frames for any altivec rounding
|
||||
#else
|
||||
#define kAUDefaultMaxFramesPerSlice 2048
|
||||
#define kAUDefaultMaxFramesPerSlice 2048
|
||||
#endif
|
||||
|
||||
// ________________________________________________________________________
|
||||
@@ -106,16 +106,16 @@ class AUBase : public ComponentBase {
|
||||
public:
|
||||
|
||||
/*! @ctor AUBase */
|
||||
AUBase( AudioComponentInstance inInstance,
|
||||
AUBase( AudioComponentInstance inInstance,
|
||||
UInt32 numInputElements,
|
||||
UInt32 numOutputElements,
|
||||
UInt32 numGroupElements = 0);
|
||||
/*! @dtor AUBase */
|
||||
virtual ~AUBase();
|
||||
|
||||
|
||||
/*! @method PostConstructor */
|
||||
virtual void PostConstructor() { CreateElements(); }
|
||||
|
||||
|
||||
/*! @method PreDestructor */
|
||||
virtual void PreDestructor();
|
||||
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
// ________________________________________________________________________
|
||||
// Virtual methods (mostly) directly corresponding to the entry points. Many of these
|
||||
// have useful implementations here and will not need overriding.
|
||||
|
||||
|
||||
/*! @method DoInitialize */
|
||||
OSStatus DoInitialize();
|
||||
// this implements the entry point and makes sure that initialization
|
||||
@@ -143,16 +143,16 @@ public:
|
||||
virtual OSStatus Initialize();
|
||||
// ... so that overrides to this method can assume that they will only
|
||||
// be called exactly once.
|
||||
|
||||
|
||||
/*! @method IsInitialized */
|
||||
bool IsInitialized() const { return mInitialized; }
|
||||
/*! @method HasBegunInitializing */
|
||||
bool HasBegunInitializing() const { return mHasBegunInitializing; }
|
||||
|
||||
|
||||
/*! @method DoCleanup */
|
||||
void DoCleanup();
|
||||
// same pattern as with Initialize
|
||||
|
||||
|
||||
/*! @method Cleanup */
|
||||
virtual void Cleanup();
|
||||
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
AudioUnitElement inElement);
|
||||
|
||||
// Note about GetPropertyInfo, GetProperty, SetProperty:
|
||||
// Certain properties are trapped out in these dispatch functions and handled with different virtual
|
||||
// Certain properties are trapped out in these dispatch functions and handled with different virtual
|
||||
// methods. (To discourage hacks and keep vtable size down, these are non-virtual)
|
||||
|
||||
/*! @method DispatchGetPropertyInfo */
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
AudioUnitElement inElement,
|
||||
const void * inData,
|
||||
UInt32 inDataSize);
|
||||
|
||||
|
||||
OSStatus DispatchRemovePropertyValue( AudioUnitPropertyID inID,
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitElement inElement);
|
||||
@@ -207,7 +207,7 @@ public:
|
||||
AudioUnitElement inElement,
|
||||
const void * inData,
|
||||
UInt32 inDataSize);
|
||||
|
||||
|
||||
/*! @method ClearPropertyUsage */
|
||||
virtual OSStatus RemovePropertyValue ( AudioUnitPropertyID inID,
|
||||
AudioUnitScope inScope,
|
||||
@@ -217,28 +217,28 @@ public:
|
||||
virtual OSStatus AddPropertyListener( AudioUnitPropertyID inID,
|
||||
AudioUnitPropertyListenerProc inProc,
|
||||
void * inProcRefCon);
|
||||
|
||||
|
||||
/*! @method RemovePropertyListener */
|
||||
virtual OSStatus RemovePropertyListener( AudioUnitPropertyID inID,
|
||||
AudioUnitPropertyListenerProc inProc,
|
||||
void * inProcRefCon,
|
||||
bool refConSpecified);
|
||||
|
||||
|
||||
/*! @method SetRenderNotification */
|
||||
virtual OSStatus SetRenderNotification( AURenderCallback inProc,
|
||||
void * inRefCon);
|
||||
|
||||
|
||||
/*! @method RemoveRenderNotification */
|
||||
virtual OSStatus RemoveRenderNotification(
|
||||
AURenderCallback inProc,
|
||||
void * inRefCon);
|
||||
|
||||
|
||||
/*! @method GetParameter */
|
||||
virtual OSStatus GetParameter( AudioUnitParameterID inID,
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
AudioUnitParameterValue & outValue);
|
||||
|
||||
|
||||
/*! @method SetParameter */
|
||||
virtual OSStatus SetParameter( AudioUnitParameterID inID,
|
||||
AudioUnitScope inScope,
|
||||
@@ -252,7 +252,7 @@ public:
|
||||
/*! @method ScheduleParameter */
|
||||
virtual OSStatus ScheduleParameter ( const AudioUnitParameterEvent *inParameterEvent,
|
||||
UInt32 inNumEvents);
|
||||
|
||||
|
||||
|
||||
/*! @method DoRender */
|
||||
OSStatus DoRender( AudioUnitRenderActionFlags & ioActionFlags,
|
||||
@@ -260,14 +260,14 @@ public:
|
||||
UInt32 inBusNumber,
|
||||
UInt32 inNumberFrames,
|
||||
AudioBufferList & ioData);
|
||||
|
||||
|
||||
|
||||
/*! @method Process */
|
||||
OSStatus DoProcess ( AudioUnitRenderActionFlags & ioActionFlags,
|
||||
const AudioTimeStamp & inTimeStamp,
|
||||
UInt32 inFramesToProcess,
|
||||
AudioBufferList & ioData);
|
||||
|
||||
|
||||
/*! @method ProcessMultiple */
|
||||
OSStatus DoProcessMultiple ( AudioUnitRenderActionFlags & ioActionFlags,
|
||||
const AudioTimeStamp & inTimeStamp,
|
||||
@@ -276,7 +276,7 @@ public:
|
||||
const AudioBufferList ** inInputBufferLists,
|
||||
UInt32 inNumberOutputBufferLists,
|
||||
AudioBufferList ** ioOutputBufferLists);
|
||||
|
||||
|
||||
/*! @method ProcessBufferLists */
|
||||
virtual OSStatus ProcessBufferLists( AudioUnitRenderActionFlags & ioActionFlags,
|
||||
const AudioBufferList & inBuffer,
|
||||
@@ -288,26 +288,26 @@ public:
|
||||
|
||||
/*! @method ProcessMultipleBufferLists */
|
||||
virtual OSStatus ProcessMultipleBufferLists( AudioUnitRenderActionFlags & ioActionFlags,
|
||||
UInt32 inFramesToProcess,
|
||||
UInt32 inFramesToProcess,
|
||||
UInt32 inNumberInputBufferLists,
|
||||
const AudioBufferList ** inInputBufferLists,
|
||||
UInt32 inNumberOutputBufferLists,
|
||||
AudioBufferList ** ioOutputBufferLists)
|
||||
AudioBufferList ** ioOutputBufferLists)
|
||||
{
|
||||
return kAudio_UnimplementedError;
|
||||
}
|
||||
|
||||
|
||||
/*! @method ComplexRender */
|
||||
virtual OSStatus ComplexRender( AudioUnitRenderActionFlags & ioActionFlags,
|
||||
const AudioTimeStamp & inTimeStamp,
|
||||
UInt32 inOutputBusNumber,
|
||||
UInt32 inNumberOfPackets,
|
||||
UInt32 * outNumberOfPackets,
|
||||
AudioStreamPacketDescription * outPacketDescriptions,
|
||||
AudioBufferList & ioData,
|
||||
void * outMetadata,
|
||||
UInt32 * outMetadataByteSize)
|
||||
{
|
||||
virtual OSStatus ComplexRender( AudioUnitRenderActionFlags & ioActionFlags,
|
||||
const AudioTimeStamp & inTimeStamp,
|
||||
UInt32 inOutputBusNumber,
|
||||
UInt32 inNumberOfPackets,
|
||||
UInt32 * outNumberOfPackets,
|
||||
AudioStreamPacketDescription * outPacketDescriptions,
|
||||
AudioBufferList & ioData,
|
||||
void * outMetadata,
|
||||
UInt32 * outMetadataByteSize)
|
||||
{
|
||||
return kAudio_UnimplementedError;
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ public:
|
||||
// Otherwise, override Render().
|
||||
//
|
||||
// N.B. Implementations of this method can assume that the output's buffer list has already been
|
||||
// prepared and access it with GetOutput(inBusNumber)->GetBufferList() instead of
|
||||
// prepared and access it with GetOutput(inBusNumber)->GetBufferList() instead of
|
||||
// GetOutput(inBusNumber)->PrepareBuffer(nFrames) -- if PrepareBuffer is called, a
|
||||
// copy may occur after rendering.
|
||||
/*! @method RenderBus */
|
||||
@@ -331,7 +331,7 @@ public:
|
||||
}
|
||||
|
||||
// N.B. For a unit with only one output bus, it can assume in its implementation of this
|
||||
// method that the output's buffer list has already been prepared and access it with
|
||||
// method that the output's buffer list has already been prepared and access it with
|
||||
// GetOutput(0)->GetBufferList() instead of GetOutput(0)->PrepareBuffer(nFrames)
|
||||
// -- if PrepareBuffer is called, a copy may occur after rendering.
|
||||
/*! @method Render */
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Property Dispatch
|
||||
|
||||
@@ -361,10 +361,10 @@ public:
|
||||
|
||||
/*! @method SetConnection */
|
||||
virtual OSStatus SetConnection( const AudioUnitConnection & inConnection);
|
||||
|
||||
|
||||
/*! @method SetInputCallback */
|
||||
virtual OSStatus SetInputCallback( UInt32 inPropertyID,
|
||||
AudioUnitElement inElement,
|
||||
AudioUnitElement inElement,
|
||||
AURenderCallback inProc,
|
||||
void * inRefCon);
|
||||
|
||||
@@ -386,7 +386,7 @@ public:
|
||||
|
||||
/*! @method SaveState */
|
||||
virtual OSStatus SaveState( CFPropertyListRef * outData);
|
||||
|
||||
|
||||
/*! @method SaveExtendedScopes */
|
||||
virtual void SaveExtendedScopes( CFMutableDataRef outData) {};
|
||||
|
||||
@@ -399,8 +399,8 @@ public:
|
||||
CFArrayRef * outStrings);
|
||||
|
||||
/*! @method CopyClumpName */
|
||||
virtual OSStatus CopyClumpName( AudioUnitScope inScope,
|
||||
UInt32 inClumpID,
|
||||
virtual OSStatus CopyClumpName( AudioUnitScope inScope,
|
||||
UInt32 inClumpID,
|
||||
UInt32 inDesiredNameLength,
|
||||
CFStringRef * outClumpName);
|
||||
|
||||
@@ -411,14 +411,14 @@ public:
|
||||
// and the name should be valid, or the preset WON'T take
|
||||
/*! @method SetAFactoryPresetAsCurrent */
|
||||
bool SetAFactoryPresetAsCurrent (const AUPreset & inPreset);
|
||||
|
||||
|
||||
// Called when someone sets a new, valid preset
|
||||
// If this is a valid preset, then the subclass sets its state to that preset
|
||||
// and returns noErr.
|
||||
// If not a valid preset, return an error, and the pre-existing preset is restored
|
||||
/*! @method NewFactoryPresetSet */
|
||||
virtual OSStatus NewFactoryPresetSet (const AUPreset & inNewFactoryPreset);
|
||||
|
||||
|
||||
/*! @method NewCustomPresetSet */
|
||||
virtual OSStatus NewCustomPresetSet (const AUPreset & inNewCustomPreset);
|
||||
|
||||
@@ -429,10 +429,10 @@ public:
|
||||
/*! @method GetUIComponentDescs */
|
||||
virtual void GetUIComponentDescs (ComponentDescription* inDescArray);
|
||||
#endif
|
||||
|
||||
|
||||
/*! @method CopyIconLocation */
|
||||
virtual CFURLRef CopyIconLocation ();
|
||||
|
||||
|
||||
// default is no latency, and unimplemented tail time
|
||||
/*! @method GetLatency */
|
||||
virtual Float64 GetLatency() {return 0.0;}
|
||||
@@ -444,18 +444,18 @@ public:
|
||||
/*! @method IsStreamFormatWritable */
|
||||
bool IsStreamFormatWritable( AudioUnitScope scope,
|
||||
AudioUnitElement element);
|
||||
|
||||
|
||||
/*! @method StreamFormatWritable */
|
||||
virtual bool StreamFormatWritable( AudioUnitScope scope,
|
||||
AudioUnitElement element) = 0;
|
||||
// scope will always be input or output
|
||||
|
||||
|
||||
// pass in a pointer to get the struct, and num channel infos
|
||||
// you can pass in NULL to just get the number
|
||||
// a return value of 0 (the default in AUBase) means the property is not supported...
|
||||
/*! @method SupportedNumChannels */
|
||||
virtual UInt32 SupportedNumChannels ( const AUChannelInfo** outInfo);
|
||||
|
||||
|
||||
/*! @method ValidFormat */
|
||||
virtual bool ValidFormat( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
@@ -466,7 +466,7 @@ public:
|
||||
// native-endian 32-bit float, any sample rate,
|
||||
// any number of channels; override when other
|
||||
// formats are supported. A subclass's override can
|
||||
// choose to always return true and trap invalid
|
||||
// choose to always return true and trap invalid
|
||||
// formats in ChangeStreamFormat.
|
||||
|
||||
|
||||
@@ -489,7 +489,7 @@ public:
|
||||
const CAStreamBasicDescription & inNewFormat);
|
||||
// Will only be called after StreamFormatWritable
|
||||
// and ValidFormat have succeeded.
|
||||
|
||||
|
||||
// ________________________________________________________________________
|
||||
|
||||
#if !CA_USE_AUDIO_PLUGIN_ONLY
|
||||
@@ -500,7 +500,7 @@ public:
|
||||
|
||||
// ________________________________________________________________________
|
||||
// Methods useful for subclasses
|
||||
|
||||
|
||||
/*! @method GetScope */
|
||||
AUScope & GetScope( AudioUnitScope inScope)
|
||||
{
|
||||
@@ -511,10 +511,10 @@ public:
|
||||
}
|
||||
return mScopes[inScope];
|
||||
}
|
||||
|
||||
|
||||
/*! @method GetScopeExtended */
|
||||
virtual AUScope * GetScopeExtended (AudioUnitScope inScope) { return NULL; }
|
||||
|
||||
|
||||
/*! @method GlobalScope */
|
||||
AUScope & GlobalScope() { return mScopes[kAudioUnitScope_Global]; }
|
||||
/*! @method Inputs */
|
||||
@@ -527,7 +527,7 @@ public:
|
||||
#endif
|
||||
/*! @method Globals */
|
||||
AUElement * Globals() { return mScopes[kAudioUnitScope_Global].GetElement(0); }
|
||||
|
||||
|
||||
/*! @method SetNumberOfElements */
|
||||
void SetNumberOfElements( AudioUnitScope inScope,
|
||||
UInt32 numElements);
|
||||
@@ -538,14 +538,14 @@ public:
|
||||
{
|
||||
return GetScope(inScope).GetElement(inElement);
|
||||
}
|
||||
|
||||
|
||||
/*! @method GetIOElement */
|
||||
AUIOElement * GetIOElement( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement)
|
||||
{
|
||||
return GetScope(inScope).GetIOElement(inElement);
|
||||
}
|
||||
|
||||
|
||||
/*! @method SafeGetElement */
|
||||
AUElement * SafeGetElement( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement)
|
||||
@@ -558,13 +558,13 @@ public:
|
||||
{
|
||||
return static_cast<AUInputElement *>(Inputs().SafeGetElement(inElement));
|
||||
}
|
||||
|
||||
|
||||
/*! @method GetOutput */
|
||||
AUOutputElement * GetOutput( AudioUnitElement inElement)
|
||||
{
|
||||
return static_cast<AUOutputElement *>(Outputs().SafeGetElement(inElement));
|
||||
}
|
||||
|
||||
|
||||
#if !CA_BASIC_AU_FEATURES
|
||||
/*! @method GetGroup */
|
||||
AUElement * GetGroup( AudioUnitElement inElement)
|
||||
@@ -572,7 +572,7 @@ public:
|
||||
return Groups().SafeGetElement(inElement);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*! @method PullInput */
|
||||
OSStatus PullInput( UInt32 inBusNumber,
|
||||
AudioUnitRenderActionFlags &ioActionFlags,
|
||||
@@ -589,7 +589,7 @@ public:
|
||||
bool UsesFixedBlockSize() const { return mUsesFixedBlockSize; }
|
||||
/*! @method SetUsesFixedBlockSize */
|
||||
void SetUsesFixedBlockSize(bool inUsesFixedBlockSize) { mUsesFixedBlockSize = inUsesFixedBlockSize; }
|
||||
|
||||
|
||||
/*! @method GetVectorUnitType */
|
||||
static SInt32 GetVectorUnitType() { return sVectorUnitType; }
|
||||
/*! @method HasVectorUnit */
|
||||
@@ -600,12 +600,12 @@ public:
|
||||
static bool HasSSE2() { return sVectorUnitType >= kVecSSE2; }
|
||||
/*! @method HasSSE3 */
|
||||
static bool HasSSE3() { return sVectorUnitType >= kVecSSE3; }
|
||||
|
||||
|
||||
/*! @method AudioUnitAPIVersion */
|
||||
UInt8 AudioUnitAPIVersion() const { return mAudioUnitAPIVersion; }
|
||||
|
||||
|
||||
/*! @method IsRenderThread */
|
||||
bool InRenderThread () const
|
||||
bool InRenderThread () const
|
||||
{
|
||||
#if TARGET_OS_MAC
|
||||
return (mRenderThreadID ? pthread_equal (mRenderThreadID, pthread_self()) : false);
|
||||
@@ -623,7 +623,7 @@ public:
|
||||
|
||||
/*! @method PropertyChanged */
|
||||
virtual void PropertyChanged( AudioUnitPropertyID inID,
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitElement inElement);
|
||||
|
||||
#if !CA_NO_AU_UI_FEATURES
|
||||
@@ -634,12 +634,12 @@ public:
|
||||
// as this can save work in the host.
|
||||
|
||||
/*! @method CallHostBeatAndTempo */
|
||||
OSStatus CallHostBeatAndTempo (Float64 *outCurrentBeat,
|
||||
OSStatus CallHostBeatAndTempo (Float64 *outCurrentBeat,
|
||||
Float64 *outCurrentTempo)
|
||||
{
|
||||
return (mHostCallbackInfo.beatAndTempoProc
|
||||
? (*mHostCallbackInfo.beatAndTempoProc) (mHostCallbackInfo.hostUserData,
|
||||
outCurrentBeat,
|
||||
return (mHostCallbackInfo.beatAndTempoProc
|
||||
? (*mHostCallbackInfo.beatAndTempoProc) (mHostCallbackInfo.hostUserData,
|
||||
outCurrentBeat,
|
||||
outCurrentTempo)
|
||||
: -1);
|
||||
}
|
||||
@@ -650,14 +650,14 @@ public:
|
||||
UInt32 *outTimeSig_Denominator,
|
||||
Float64 *outCurrentMeasureDownBeat)
|
||||
{
|
||||
return (mHostCallbackInfo.musicalTimeLocationProc
|
||||
return (mHostCallbackInfo.musicalTimeLocationProc
|
||||
? (*mHostCallbackInfo.musicalTimeLocationProc) (mHostCallbackInfo.hostUserData,
|
||||
outDeltaSampleOffsetToNextBeat,
|
||||
outTimeSig_Numerator,
|
||||
outTimeSig_Denominator,
|
||||
outCurrentMeasureDownBeat)
|
||||
: -1);
|
||||
}
|
||||
}
|
||||
|
||||
/*! @method CallHostTransportState */
|
||||
OSStatus CallHostTransportState (Boolean *outIsPlaying,
|
||||
@@ -667,7 +667,7 @@ public:
|
||||
Float64 *outCycleStartBeat,
|
||||
Float64 *outCycleEndBeat)
|
||||
{
|
||||
return (mHostCallbackInfo.transportStateProc
|
||||
return (mHostCallbackInfo.transportStateProc
|
||||
? (*mHostCallbackInfo.transportStateProc) (mHostCallbackInfo.hostUserData,
|
||||
outIsPlaying,
|
||||
outTransportStateChanged,
|
||||
@@ -680,7 +680,7 @@ public:
|
||||
#endif
|
||||
|
||||
char* GetLoggingString () const;
|
||||
|
||||
|
||||
CAMutex* GetMutex() { return mAUMutex; }
|
||||
|
||||
// ________________________________________________________________________
|
||||
@@ -698,7 +698,7 @@ public:
|
||||
virtual OSStatus Start() { return kAudio_UnimplementedError; }
|
||||
/*! @method Stop */
|
||||
virtual OSStatus Stop() { return kAudio_UnimplementedError; }
|
||||
|
||||
|
||||
#if !CA_BASIC_AU_FEATURES
|
||||
#pragma mark -
|
||||
#pragma mark AU Music Base Dispatch
|
||||
@@ -711,38 +711,38 @@ public:
|
||||
/*! @method PrepareInstrument */
|
||||
virtual OSStatus ReleaseInstrument(MusicDeviceInstrumentID inInstrument) { return kAudio_UnimplementedError; }
|
||||
#endif
|
||||
|
||||
|
||||
// ________________________________________________________________________
|
||||
// ________________________________________________________________________
|
||||
// ________________________________________________________________________
|
||||
// music device/music effect methods -- incomplete
|
||||
/*! @method MIDIEvent */
|
||||
virtual OSStatus MIDIEvent( UInt32 inStatus,
|
||||
UInt32 inData1,
|
||||
UInt32 inData2,
|
||||
virtual OSStatus MIDIEvent( UInt32 inStatus,
|
||||
UInt32 inData1,
|
||||
UInt32 inData2,
|
||||
UInt32 inOffsetSampleFrame) { return kAudio_UnimplementedError; }
|
||||
|
||||
/*! @method SysEx */
|
||||
virtual OSStatus SysEx( const UInt8 * inData,
|
||||
virtual OSStatus SysEx( const UInt8 * inData,
|
||||
UInt32 inLength) { return kAudio_UnimplementedError;}
|
||||
|
||||
|
||||
/*! @method StartNote */
|
||||
virtual OSStatus StartNote( MusicDeviceInstrumentID inInstrument,
|
||||
MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID * outNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
virtual OSStatus StartNote( MusicDeviceInstrumentID inInstrument,
|
||||
MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID * outNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
const MusicDeviceNoteParams &inParams) { return kAudio_UnimplementedError; }
|
||||
|
||||
/*! @method StopNote */
|
||||
virtual OSStatus StopNote( MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
virtual OSStatus StopNote( MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame) { return kAudio_UnimplementedError; }
|
||||
#endif
|
||||
|
||||
// ________________________________________________________________________
|
||||
// ________________________________________________________________________
|
||||
// ________________________________________________________________________
|
||||
|
||||
|
||||
protected:
|
||||
#pragma mark -
|
||||
#pragma mark Implementation methods
|
||||
@@ -751,7 +751,7 @@ protected:
|
||||
virtual void ReallocateBuffers();
|
||||
// needs to be called when mMaxFramesPerSlice changes
|
||||
virtual void DeallocateIOBuffers();
|
||||
|
||||
|
||||
/*! @method FillInParameterName */
|
||||
static void FillInParameterName (AudioUnitParameterInfo& ioInfo, CFStringRef inName, bool inShouldRelease)
|
||||
{
|
||||
@@ -761,25 +761,25 @@ protected:
|
||||
ioInfo.flags |= kAudioUnitParameterFlag_CFNameRelease;
|
||||
CFStringGetCString (inName, ioInfo.name, offsetof (AudioUnitParameterInfo, clumpID), kCFStringEncodingUTF8);
|
||||
}
|
||||
|
||||
static void HasClump (AudioUnitParameterInfo& ioInfo, UInt32 inClumpID)
|
||||
|
||||
static void HasClump (AudioUnitParameterInfo& ioInfo, UInt32 inClumpID)
|
||||
{
|
||||
ioInfo.clumpID = inClumpID;
|
||||
ioInfo.flags |= kAudioUnitParameterFlag_HasClump;
|
||||
}
|
||||
|
||||
|
||||
/*! @method SetMaxFramesPerSlice */
|
||||
virtual void SetMaxFramesPerSlice(UInt32 nFrames);
|
||||
|
||||
/*! @method CanSetMaxFrames */
|
||||
virtual OSStatus CanSetMaxFrames() const;
|
||||
|
||||
|
||||
/*! @method WantsRenderThreadID */
|
||||
bool WantsRenderThreadID () const { return mWantsRenderThreadID; }
|
||||
|
||||
|
||||
/*! @method SetWantsRenderThreadID */
|
||||
void SetWantsRenderThreadID (bool inFlag);
|
||||
|
||||
|
||||
/*! @method SetRenderError */
|
||||
OSStatus SetRenderError (OSStatus inErr)
|
||||
{
|
||||
@@ -789,7 +789,7 @@ protected:
|
||||
}
|
||||
return inErr;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
/*! @method DoRenderBus */
|
||||
// shared between Render and RenderSlice, inlined to minimize function call overhead
|
||||
@@ -829,13 +829,13 @@ private:
|
||||
memset (&mCurrentRenderTime, 0, sizeof(mCurrentRenderTime));
|
||||
mCurrentRenderTime.mSampleTime = kNoLastRenderedSampleTime;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
/*! @method GetAudioChannelLayout */
|
||||
virtual UInt32 GetChannelLayoutTags( AudioUnitScope scope,
|
||||
AudioUnitElement element,
|
||||
AudioChannelLayoutTag * outLayoutTags);
|
||||
|
||||
|
||||
/*! @method GetAudioChannelLayout */
|
||||
virtual UInt32 GetAudioChannelLayout( AudioUnitScope scope,
|
||||
AudioUnitElement element,
|
||||
@@ -843,13 +843,13 @@ protected:
|
||||
Boolean & outWritable);
|
||||
|
||||
/*! @method SetAudioChannelLayout */
|
||||
virtual OSStatus SetAudioChannelLayout( AudioUnitScope scope,
|
||||
virtual OSStatus SetAudioChannelLayout( AudioUnitScope scope,
|
||||
AudioUnitElement element,
|
||||
const AudioChannelLayout * inLayout);
|
||||
|
||||
/*! @method RemoveAudioChannelLayout */
|
||||
virtual OSStatus RemoveAudioChannelLayout(AudioUnitScope scope, AudioUnitElement element);
|
||||
|
||||
|
||||
/*! @method NeedsToRender */
|
||||
bool NeedsToRender( const AudioTimeStamp & inTimeStamp)
|
||||
{
|
||||
@@ -858,7 +858,7 @@ protected:
|
||||
mCurrentRenderTime = inTimeStamp;
|
||||
return needsToRender;
|
||||
}
|
||||
|
||||
|
||||
// Scheduled parameter implementation:
|
||||
|
||||
typedef std::vector<AudioUnitParameterEvent> ParameterEventList;
|
||||
@@ -869,14 +869,14 @@ protected:
|
||||
// for which the DSP code depends. ProcessForScheduledParams() will call (potentially repeatedly)
|
||||
// virtual method ProcessScheduledSlice() to perform the actual DSP for a given sub-division of
|
||||
// the buffer. The job of ProcessForScheduledParams() is to sub-divide the buffer into smaller
|
||||
// pieces according to the scheduled times found in the ParameterEventList (usually coming
|
||||
// pieces according to the scheduled times found in the ParameterEventList (usually coming
|
||||
// directly from a previous call to ScheduleParameter() ), setting the appropriate immediate or
|
||||
// ramped parameter values for the corresponding scopes and elements, then calling ProcessScheduledSlice()
|
||||
// to do the actual DSP for each of these divisions.
|
||||
virtual OSStatus ProcessForScheduledParams( ParameterEventList &inParamList,
|
||||
UInt32 inFramesToProcess,
|
||||
void *inUserData );
|
||||
|
||||
|
||||
// This method is called (potentially repeatedly) by ProcessForScheduledParams()
|
||||
// in order to perform the actual DSP required for this portion of the entire buffer
|
||||
// being processed. The entire buffer can be divided up into smaller "slices"
|
||||
@@ -889,11 +889,11 @@ protected:
|
||||
UInt32 inStartFrameInBuffer,
|
||||
UInt32 inSliceFramesToProcess,
|
||||
UInt32 inTotalBufferFrames ) {return noErr;}; // default impl does nothing...
|
||||
|
||||
|
||||
|
||||
|
||||
/*! @method CurrentRenderTime */
|
||||
const AudioTimeStamp & CurrentRenderTime () const { return mCurrentRenderTime; }
|
||||
|
||||
|
||||
// ________________________________________________________________________
|
||||
// Private data members to discourage hacking in subclasses
|
||||
private:
|
||||
@@ -902,23 +902,23 @@ private:
|
||||
mRenderNotify(proc),
|
||||
mRenderNotifyRefCon(ref)
|
||||
{ }
|
||||
|
||||
|
||||
AURenderCallback mRenderNotify;
|
||||
void * mRenderNotifyRefCon;
|
||||
|
||||
|
||||
bool operator == (const RenderCallback &other) {
|
||||
return this->mRenderNotify == other.mRenderNotify &&
|
||||
this->mRenderNotifyRefCon == other.mRenderNotifyRefCon;
|
||||
}
|
||||
};
|
||||
typedef TThreadSafeList<RenderCallback> RenderCallbackList;
|
||||
|
||||
|
||||
#if !CA_BASIC_AU_FEATURES
|
||||
enum { kNumScopes = 4 };
|
||||
#else
|
||||
enum { kNumScopes = 3 };
|
||||
#endif
|
||||
|
||||
|
||||
/*! @var mElementsCreated */
|
||||
bool mElementsCreated;
|
||||
protected:
|
||||
@@ -929,7 +929,7 @@ protected:
|
||||
private:
|
||||
/*! @var mAudioUnitAPIVersion */
|
||||
UInt8 mAudioUnitAPIVersion;
|
||||
|
||||
|
||||
/*! @var mInitNumInputEls */
|
||||
const UInt32 mInitNumInputEls;
|
||||
/*! @var mInitNumOutputEls */
|
||||
@@ -940,36 +940,36 @@ private:
|
||||
#endif
|
||||
/*! @var mScopes */
|
||||
AUScope mScopes[kNumScopes];
|
||||
|
||||
|
||||
/*! @var mRenderCallbacks */
|
||||
RenderCallbackList mRenderCallbacks;
|
||||
bool mRenderCallbacksTouched;
|
||||
|
||||
|
||||
/*! @var mRenderThreadID */
|
||||
#if TARGET_OS_MAC
|
||||
pthread_t mRenderThreadID;
|
||||
#elif TARGET_OS_WIN32
|
||||
UInt32 mRenderThreadID;
|
||||
#endif
|
||||
|
||||
|
||||
/*! @var mWantsRenderThreadID */
|
||||
bool mWantsRenderThreadID;
|
||||
|
||||
|
||||
/*! @var mCurrentRenderTime */
|
||||
AudioTimeStamp mCurrentRenderTime;
|
||||
|
||||
|
||||
/*! @var mMaxFramesPerSlice */
|
||||
UInt32 mMaxFramesPerSlice;
|
||||
|
||||
|
||||
/*! @var mLastRenderError */
|
||||
OSStatus mLastRenderError;
|
||||
/*! @var mCurrentPreset */
|
||||
AUPreset mCurrentPreset;
|
||||
|
||||
|
||||
protected:
|
||||
/*! @var mUsesFixedBlockSize */
|
||||
bool mUsesFixedBlockSize;
|
||||
|
||||
|
||||
struct PropertyListener {
|
||||
AudioUnitPropertyID propertyID;
|
||||
AudioUnitPropertyListenerProc listenerProc;
|
||||
@@ -981,10 +981,10 @@ protected:
|
||||
ParameterEventList mParamList;
|
||||
/*! @var mPropertyListeners */
|
||||
PropertyListeners mPropertyListeners;
|
||||
|
||||
|
||||
/*! @var mBuffersAllocated */
|
||||
bool mBuffersAllocated;
|
||||
|
||||
|
||||
/*! @var mLogString */
|
||||
// if this is NOT null, it will contain identifying info about this AU.
|
||||
char* mLogString;
|
||||
@@ -1012,7 +1012,7 @@ protected:
|
||||
#endif
|
||||
};
|
||||
|
||||
inline OSStatus AUInputElement::PullInputWithBufferList(
|
||||
inline OSStatus AUInputElement::PullInputWithBufferList(
|
||||
AudioUnitRenderActionFlags & ioActionFlags,
|
||||
const AudioTimeStamp & inTimeStamp,
|
||||
AudioUnitElement inElement,
|
||||
@@ -1020,7 +1020,7 @@ inline OSStatus AUInputElement::PullInputWithBufferList(
|
||||
AudioBufferList * inBufferList)
|
||||
{
|
||||
OSStatus theResult;
|
||||
|
||||
|
||||
if (HasConnection()) {
|
||||
// only support connections for V2 audio units
|
||||
#if !CA_USE_AUDIO_PLUGIN_ONLY
|
||||
@@ -1036,7 +1036,7 @@ inline OSStatus AUInputElement::PullInputWithBufferList(
|
||||
theResult = (mInputProc)(
|
||||
mInputProcRefCon, &ioActionFlags, &inTimeStamp, inElement, nFrames, inBufferList);
|
||||
}
|
||||
|
||||
|
||||
if (mInputType == kNoInput) // defense: the guy upstream could have disconnected
|
||||
// it's a horrible thing to do, but may happen!
|
||||
return kAudioUnitErr_NoConnection;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUDispatch.cpp
|
||||
Abstract: AUDispatch.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUBase.h"
|
||||
#include "CAXException.h"
|
||||
@@ -101,19 +101,19 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
case kAudioUnitRenderSelect:
|
||||
result = (This->AudioUnitAPIVersion() > 1);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return ComponentBase::ComponentEntryDispatch(params, This);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioUnitInitializeSelect:
|
||||
{
|
||||
CAMutex::Locker lock2(This->GetMutex());
|
||||
result = This->DoInitialize();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioUnitUninitializeSelect:
|
||||
{
|
||||
CAMutex::Locker lock2(This->GetMutex());
|
||||
@@ -136,7 +136,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
// always assume they're non-null
|
||||
UInt32 dataSize;
|
||||
Boolean writable;
|
||||
|
||||
|
||||
result = This->DispatchGetPropertyInfo(pinID, pinScope, pinElement, dataSize, writable);
|
||||
if (poutDataSize != NULL)
|
||||
*poutDataSize = dataSize;
|
||||
@@ -158,7 +158,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
Boolean writable;
|
||||
char *tempBuffer;
|
||||
void *destBuffer;
|
||||
|
||||
|
||||
if (pioDataSize == NULL) {
|
||||
ca_debug_string("AudioUnitGetProperty: null size pointer");
|
||||
result = kAudio_ParamError;
|
||||
@@ -166,12 +166,12 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
}
|
||||
if (poutData == NULL) {
|
||||
UInt32 dataSize;
|
||||
|
||||
|
||||
result = This->DispatchGetPropertyInfo(pinID, pinScope, pinElement, dataSize, writable);
|
||||
*pioDataSize = dataSize;
|
||||
goto finishGetProperty;
|
||||
}
|
||||
|
||||
|
||||
clientBufferSize = *pioDataSize;
|
||||
if (clientBufferSize == 0)
|
||||
{
|
||||
@@ -180,13 +180,13 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
result = kAudio_ParamError;
|
||||
goto finishGetProperty;
|
||||
}
|
||||
|
||||
result = This->DispatchGetPropertyInfo(pinID, pinScope, pinElement,
|
||||
|
||||
result = This->DispatchGetPropertyInfo(pinID, pinScope, pinElement,
|
||||
actualPropertySize, writable);
|
||||
if (result)
|
||||
if (result)
|
||||
goto finishGetProperty;
|
||||
|
||||
if (clientBufferSize < actualPropertySize)
|
||||
|
||||
if (clientBufferSize < actualPropertySize)
|
||||
{
|
||||
tempBuffer = new char[actualPropertySize];
|
||||
destBuffer = tempBuffer;
|
||||
@@ -194,9 +194,9 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
tempBuffer = NULL;
|
||||
destBuffer = poutData;
|
||||
}
|
||||
|
||||
|
||||
result = This->DispatchGetProperty(pinID, pinScope, pinElement, destBuffer);
|
||||
|
||||
|
||||
if (result == noErr) {
|
||||
if (clientBufferSize < actualPropertySize && tempBuffer != NULL)
|
||||
{
|
||||
@@ -213,7 +213,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioUnitSetPropertySelect:
|
||||
{
|
||||
CAMutex::Locker lock(This->GetMutex());
|
||||
@@ -222,7 +222,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
PARAM(AudioUnitElement, pinElement, 2, 5);
|
||||
PARAM(const void *, pinData, 3, 5);
|
||||
PARAM(UInt32, pinDataSize, 4, 5);
|
||||
|
||||
|
||||
if (pinData && pinDataSize)
|
||||
result = This->DispatchSetProperty(pinID, pinScope, pinElement, pinData, pinDataSize);
|
||||
else {
|
||||
@@ -247,7 +247,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioUnitAddPropertyListenerSelect:
|
||||
{
|
||||
CAMutex::Locker lock(This->GetMutex());
|
||||
@@ -278,7 +278,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
result = This->RemovePropertyListener(pinID, pinProc, pinProcRefCon, true);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kAudioUnitAddRenderNotifySelect:
|
||||
{
|
||||
CAMutex::Locker lock(This->GetMutex());
|
||||
@@ -344,7 +344,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
PARAM(UInt32, pinNumberFrames, 3, 5);
|
||||
PARAM(AudioBufferList *, pioData, 4, 5);
|
||||
AudioUnitRenderActionFlags tempFlags;
|
||||
|
||||
|
||||
if (pinTimeStamp == NULL || pioData == NULL)
|
||||
result = kAudio_ParamError;
|
||||
else {
|
||||
@@ -354,7 +354,7 @@ OSStatus AUBase::ComponentEntryDispatch(ComponentParameters *params, AUBase *Th
|
||||
}
|
||||
result = This->DoRender(*pinActionFlags, *pinTimeStamp, pinOutputBusNumber, pinNumberFrames, *pioData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -385,13 +385,13 @@ OSStatus CMgr_AudioUnitBaseGetParameter( AUBase * This,
|
||||
float *outValue)
|
||||
{
|
||||
OSStatus result = AUBase::noErr;
|
||||
|
||||
|
||||
try {
|
||||
if (This == NULL || outValue == NULL) return kAudio_ParamError;
|
||||
result = This->GetParameter(inID, inScope, inElement, *outValue);
|
||||
}
|
||||
COMPONENT_CATCH
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -403,13 +403,13 @@ OSStatus CMgr_AudioUnitBaseSetParameter( AUBase * This,
|
||||
UInt32 inBufferOffset)
|
||||
{
|
||||
OSStatus result = AUBase::noErr;
|
||||
|
||||
|
||||
try {
|
||||
if (This == NULL) return kAudio_ParamError;
|
||||
result = This->SetParameter(inID, inScope, inElement, inValue, inBufferOffset);
|
||||
}
|
||||
COMPONENT_CATCH
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -421,10 +421,10 @@ OSStatus CMgr_AudioUnitBaseRender( AUBase * This,
|
||||
AudioBufferList * ioData)
|
||||
{
|
||||
if (inTimeStamp == NULL || ioData == NULL) return kAudio_ParamError;
|
||||
|
||||
|
||||
OSStatus result = AUBase::noErr;
|
||||
AudioUnitRenderActionFlags tempFlags;
|
||||
|
||||
|
||||
try {
|
||||
if (ioActionFlags == NULL) {
|
||||
tempFlags = 0;
|
||||
@@ -433,6 +433,6 @@ OSStatus CMgr_AudioUnitBaseRender( AUBase * This,
|
||||
result = This->DoRender(*ioActionFlags, *inTimeStamp, inBusNumber, inNumberFrames, *ioData);
|
||||
}
|
||||
COMPONENT_CATCH
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUDispatch.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUDispatch_h__
|
||||
#define __AUDispatch_h__
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUInputElement.cpp
|
||||
Abstract: AUInputElement.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUBase.h"
|
||||
|
||||
@@ -76,8 +76,8 @@ void AUInputElement::SetConnection(const AudioUnitConnection &conn)
|
||||
if (conn.sourceAudioUnit == 0) {
|
||||
Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mInputType = kFromConnection;
|
||||
mConnection = conn;
|
||||
AllocateBuffer();
|
||||
@@ -136,16 +136,16 @@ OSStatus AUInputElement::PullInput( AudioUnitRenderActionFlags & ioActionFlag
|
||||
const AudioTimeStamp & inTimeStamp,
|
||||
AudioUnitElement inElement,
|
||||
UInt32 nFrames)
|
||||
{
|
||||
{
|
||||
if (!IsActive())
|
||||
return kAudioUnitErr_NoConnection;
|
||||
|
||||
|
||||
AudioBufferList *pullBuffer;
|
||||
|
||||
|
||||
if (HasConnection() || !WillAllocateBuffer())
|
||||
pullBuffer = &mIOBuffer.PrepareNullBuffer(mStreamFormat, nFrames);
|
||||
else
|
||||
pullBuffer = &mIOBuffer.PrepareBuffer(mStreamFormat, nFrames);
|
||||
|
||||
|
||||
return PullInputWithBufferList (ioActionFlags, inTimeStamp, inElement, nFrames, pullBuffer);
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUInputElement.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUInput_h__
|
||||
#define __AUInput_h__
|
||||
@@ -53,7 +53,7 @@
|
||||
/*! @class AUInputElement */
|
||||
class AUInputElement : public AUIOElement {
|
||||
public:
|
||||
|
||||
|
||||
/*! @ctor AUInputElement */
|
||||
AUInputElement(AUBase *audioUnit);
|
||||
/*! @dtor ~AUInputElement */
|
||||
@@ -103,7 +103,7 @@ protected:
|
||||
AURenderCallback mInputProc;
|
||||
/*! @var mInputProcRefCon */
|
||||
void * mInputProcRefCon;
|
||||
|
||||
|
||||
// if from connection:
|
||||
/*! @var mConnection */
|
||||
AudioUnitConnection mConnection;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUOutputElement.cpp
|
||||
Abstract: AUOutputElement.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,14 +40,14 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUOutputElement.h"
|
||||
#include "AUBase.h"
|
||||
|
||||
AUOutputElement::AUOutputElement(AUBase *audioUnit) :
|
||||
AUOutputElement::AUOutputElement(AUBase *audioUnit) :
|
||||
AUIOElement(audioUnit)
|
||||
{
|
||||
AllocateBuffer();
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUOutputElement.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUOutput_h__
|
||||
#define __AUOutput_h__
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUPlugInDispatch.cpp
|
||||
Abstract: AUPlugInDispatch.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUPlugInDispatch.h"
|
||||
#include "CAXException.h"
|
||||
@@ -83,7 +83,7 @@ static OSStatus AUMethodGetPropertyInfo(void *self, AudioUnitPropertyID prop, Au
|
||||
try {
|
||||
UInt32 dataSize = 0; // 13517289 GetPropetyInfo was returning an uninitialized value when there is an error. This is a problem for auval.
|
||||
Boolean writable = false;
|
||||
|
||||
|
||||
AUI_LOCK
|
||||
result = AUI->DispatchGetPropertyInfo(prop, scope, elem, dataSize, writable);
|
||||
if (outDataSize != NULL)
|
||||
@@ -103,7 +103,7 @@ static OSStatus AUMethodGetProperty(void *self, AudioUnitPropertyID inID, AudioU
|
||||
Boolean writable;
|
||||
char *tempBuffer;
|
||||
void *destBuffer;
|
||||
|
||||
|
||||
AUI_LOCK
|
||||
if (ioDataSize == NULL) {
|
||||
ca_debug_string("AudioUnitGetProperty: null size pointer");
|
||||
@@ -112,12 +112,12 @@ static OSStatus AUMethodGetProperty(void *self, AudioUnitPropertyID inID, AudioU
|
||||
}
|
||||
if (outData == NULL) {
|
||||
UInt32 dataSize;
|
||||
|
||||
|
||||
result = AUI->DispatchGetPropertyInfo(inID, inScope, inElement, dataSize, writable);
|
||||
*ioDataSize = dataSize;
|
||||
goto finishGetProperty;
|
||||
}
|
||||
|
||||
|
||||
clientBufferSize = *ioDataSize;
|
||||
if (clientBufferSize == 0)
|
||||
{
|
||||
@@ -126,12 +126,12 @@ static OSStatus AUMethodGetProperty(void *self, AudioUnitPropertyID inID, AudioU
|
||||
result = kAudio_ParamError;
|
||||
goto finishGetProperty;
|
||||
}
|
||||
|
||||
|
||||
result = AUI->DispatchGetPropertyInfo(inID, inScope, inElement, actualPropertySize, writable);
|
||||
if (result != noErr)
|
||||
if (result != noErr)
|
||||
goto finishGetProperty;
|
||||
|
||||
if (clientBufferSize < actualPropertySize)
|
||||
|
||||
if (clientBufferSize < actualPropertySize)
|
||||
{
|
||||
tempBuffer = new char[actualPropertySize];
|
||||
destBuffer = tempBuffer;
|
||||
@@ -139,9 +139,9 @@ static OSStatus AUMethodGetProperty(void *self, AudioUnitPropertyID inID, AudioU
|
||||
tempBuffer = NULL;
|
||||
destBuffer = outData;
|
||||
}
|
||||
|
||||
|
||||
result = AUI->DispatchGetProperty(inID, inScope, inElement, destBuffer);
|
||||
|
||||
|
||||
if (result == noErr) {
|
||||
if (clientBufferSize < actualPropertySize && tempBuffer != NULL)
|
||||
{
|
||||
@@ -285,7 +285,7 @@ static OSStatus AUMethodRender(void *self, AudioUnitRenderActionFlags *ioActionF
|
||||
#endif
|
||||
// this is a processing method; no lock
|
||||
AudioUnitRenderActionFlags tempFlags;
|
||||
|
||||
|
||||
if (inTimeStamp == NULL || ioData == NULL)
|
||||
result = kAudio_ParamError;
|
||||
else {
|
||||
@@ -313,7 +313,7 @@ static OSStatus AUMethodComplexRender(void *self, AudioUnitRenderActionFlags *io
|
||||
#endif
|
||||
// this is a processing method; no lock
|
||||
AudioUnitRenderActionFlags tempFlags;
|
||||
|
||||
|
||||
if (inTimeStamp == NULL || ioData == NULL)
|
||||
result = kAudio_ParamError;
|
||||
else {
|
||||
@@ -362,7 +362,7 @@ static OSStatus AUMethodProcess (void *self, AudioUnitRenderActionFlags *ioActio
|
||||
if (*ioActionFlags & (1 << 9)/*kAudioUnitRenderAction_DoNotCheckRenderArgs*/)
|
||||
doParamCheck = false;
|
||||
}
|
||||
|
||||
|
||||
if (doParamCheck && (inTimeStamp == NULL || ioData == NULL))
|
||||
result = kAudio_ParamError;
|
||||
else {
|
||||
@@ -380,15 +380,15 @@ static OSStatus AUMethodProcess (void *self, AudioUnitRenderActionFlags *ioActio
|
||||
static OSStatus AUMethodProcessMultiple (void *self, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, UInt32 inNumberInputBufferLists, const AudioBufferList **inInputBufferLists, UInt32 inNumberOutputBufferLists, AudioBufferList **ioOutputBufferLists)
|
||||
{
|
||||
OSStatus result = noErr;
|
||||
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
try {
|
||||
#endif
|
||||
// this is a processing method; no lock
|
||||
bool doParamCheck = true;
|
||||
|
||||
|
||||
AudioUnitRenderActionFlags tempFlags;
|
||||
|
||||
|
||||
if (ioActionFlags == NULL) {
|
||||
tempFlags = 0;
|
||||
ioActionFlags = &tempFlags;
|
||||
@@ -402,7 +402,7 @@ static OSStatus AUMethodProcessMultiple (void *self, AudioUnitRenderActionFlags
|
||||
else {
|
||||
result = AUI->DoProcessMultiple(*ioActionFlags, *inTimeStamp, inNumberFrames, inNumberInputBufferLists, inInputBufferLists, inNumberOutputBufferLists, ioOutputBufferLists);
|
||||
}
|
||||
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
}
|
||||
COMPONENT_CATCH
|
||||
@@ -465,7 +465,7 @@ static OSStatus AUMethodStartNote(void *self, MusicDeviceInstrumentID inInstrume
|
||||
OSStatus result = noErr;
|
||||
try {
|
||||
// this is a potential render-time method; no lock
|
||||
if (inParams == NULL || outNoteInstanceID == NULL)
|
||||
if (inParams == NULL || outNoteInstanceID == NULL)
|
||||
result = kAudio_ParamError;
|
||||
else
|
||||
result = AUI->StartNote(inInstrument, inGroupID, outNoteInstanceID, inOffsetSampleFrame, *inParams);
|
||||
@@ -559,10 +559,10 @@ AudioComponentMethod AUComplexOutputLookup::Lookup (SInt16 selector)
|
||||
{
|
||||
AudioComponentMethod method = AUBaseLookup::Lookup(selector);
|
||||
if (method) return method;
|
||||
|
||||
|
||||
method = AUOutputLookup::Lookup(selector);
|
||||
if (method) return method;
|
||||
|
||||
|
||||
if (selector == kAudioUnitComplexRenderSelect)
|
||||
return (AudioComponentMethod)AUMethodComplexRender;
|
||||
return NULL;
|
||||
@@ -572,10 +572,10 @@ AudioComponentMethod AUBaseProcessLookup::Lookup (SInt16 selector)
|
||||
{
|
||||
AudioComponentMethod method = AUBaseLookup::Lookup(selector);
|
||||
if (method) return method;
|
||||
|
||||
|
||||
if (selector == kAudioUnitProcessSelect)
|
||||
return (AudioComponentMethod)AUMethodProcess;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -583,10 +583,10 @@ AudioComponentMethod AUBaseProcessMultipleLookup::Lookup (SInt16 selector)
|
||||
{
|
||||
AudioComponentMethod method = AUBaseLookup::Lookup(selector);
|
||||
if (method) return method;
|
||||
|
||||
|
||||
if (selector == kAudioUnitProcessMultipleSelect)
|
||||
return (AudioComponentMethod)AUMethodProcessMultiple;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -597,7 +597,7 @@ AudioComponentMethod AUBaseProcessAndMultipleLookup::Lookup (SInt16 selector)
|
||||
|
||||
method = AUBaseProcessMultipleLookup::Lookup(selector);
|
||||
if (method) return method;
|
||||
|
||||
|
||||
method = AUBaseProcessLookup::Lookup(selector);
|
||||
if (method) return method;
|
||||
|
||||
@@ -620,7 +620,7 @@ AudioComponentMethod AUMIDILookup::Lookup (SInt16 selector)
|
||||
{
|
||||
AudioComponentMethod method = AUBaseLookup::Lookup(selector);
|
||||
if (method) return method;
|
||||
|
||||
|
||||
return MIDI_Lookup(selector);
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ AudioComponentMethod AUMIDIProcessLookup::Lookup (SInt16 selector)
|
||||
{
|
||||
AudioComponentMethod method = AUBaseProcessLookup::Lookup(selector);
|
||||
if (method) return method;
|
||||
|
||||
|
||||
return MIDI_Lookup(selector);
|
||||
}
|
||||
|
||||
@@ -644,7 +644,7 @@ AudioComponentMethod AUMusicLookup::Lookup (SInt16 selector)
|
||||
case kMusicDevicePrepareInstrumentSelect: return (AudioComponentMethod)AUMethodPrepareInstrument;
|
||||
case kMusicDeviceReleaseInstrumentSelect: return (AudioComponentMethod)AUMethodReleaseInstrument;
|
||||
#endif
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return MIDI_Lookup (selector);
|
||||
@@ -656,10 +656,10 @@ AudioComponentMethod AUAuxBaseLookup::Lookup (SInt16 selector)
|
||||
case kAudioUnitGetPropertyInfoSelect: return (AudioComponentMethod)AUMethodGetPropertyInfo;
|
||||
case kAudioUnitGetPropertySelect: return (AudioComponentMethod)AUMethodGetProperty;
|
||||
case kAudioUnitSetPropertySelect: return (AudioComponentMethod)AUMethodSetProperty;
|
||||
|
||||
|
||||
case kAudioUnitGetParameterSelect: return (AudioComponentMethod)AUMethodGetParameter;
|
||||
case kAudioUnitSetParameterSelect: return (AudioComponentMethod)AUMethodSetParameter;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUPlugInDispatch.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUPlugInBase_h__
|
||||
#define __AUPlugInBase_h__
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUScopeElement.cpp
|
||||
Abstract: AUScopeElement.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUScopeElement.h"
|
||||
#include "AUBase.h"
|
||||
@@ -57,7 +57,7 @@
|
||||
//
|
||||
void AUElement::UseIndexedParameters(int inNumberOfParameters)
|
||||
{
|
||||
mIndexedParameters.resize (inNumberOfParameters);
|
||||
mIndexedParameters.resize (inNumberOfParameters);
|
||||
mUseIndexedParameters = true;
|
||||
}
|
||||
|
||||
@@ -69,12 +69,12 @@ void AUElement::UseIndexedParameters(int inNumberOfParameters)
|
||||
inline ParameterMapEvent& AUElement::GetParamEvent(AudioUnitParameterID paramID)
|
||||
{
|
||||
ParameterMapEvent *event;
|
||||
|
||||
|
||||
if(mUseIndexedParameters)
|
||||
{
|
||||
if(paramID >= mIndexedParameters.size() )
|
||||
COMPONENT_THROW(kAudioUnitErr_InvalidParameter);
|
||||
|
||||
|
||||
event = &mIndexedParameters[paramID];
|
||||
}
|
||||
else
|
||||
@@ -82,10 +82,10 @@ inline ParameterMapEvent& AUElement::GetParamEvent(AudioUnitParameterID paramID)
|
||||
ParameterMap::iterator i = mParameters.find(paramID);
|
||||
if (i == mParameters.end())
|
||||
COMPONENT_THROW(kAudioUnitErr_InvalidParameter);
|
||||
|
||||
|
||||
event = &(*i).second;
|
||||
}
|
||||
|
||||
|
||||
return *event;
|
||||
}
|
||||
|
||||
@@ -95,19 +95,19 @@ inline ParameterMapEvent& AUElement::GetParamEvent(AudioUnitParameterID paramID)
|
||||
// returns whether the specified paramID is known to the element
|
||||
//
|
||||
bool AUElement::HasParameterID (AudioUnitParameterID paramID) const
|
||||
{
|
||||
{
|
||||
if(mUseIndexedParameters)
|
||||
{
|
||||
if(paramID >= mIndexedParameters.size() )
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
ParameterMap::const_iterator i = mParameters.find(paramID);
|
||||
if (i == mParameters.end())
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ bool AUElement::HasParameterID (AudioUnitParameterID paramID) const
|
||||
AudioUnitParameterValue AUElement::GetParameter(AudioUnitParameterID paramID)
|
||||
{
|
||||
ParameterMapEvent &event = GetParamEvent(paramID);
|
||||
|
||||
|
||||
return event.GetValue();
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ void AUElement::GetRampSliceStartEnd( AudioUnitParameterID paramID,
|
||||
|
||||
{
|
||||
ParameterMapEvent &event = GetParamEvent(paramID);
|
||||
|
||||
|
||||
// works even if the value is constant (immediate parameter value)
|
||||
event.GetRampSliceStartEnd(outStartValue, outEndValue, outValuePerFrameDelta );
|
||||
}
|
||||
@@ -143,7 +143,7 @@ AudioUnitParameterValue AUElement::GetEndValue( AudioUnitParameterID paramID)
|
||||
|
||||
{
|
||||
ParameterMapEvent &event = GetParamEvent(paramID);
|
||||
|
||||
|
||||
// works even if the value is constant (immediate parameter value)
|
||||
return event.GetEndValue();
|
||||
}
|
||||
@@ -160,21 +160,21 @@ void AUElement::SetParameter(AudioUnitParameterID paramID, AudioUnitParameterV
|
||||
else
|
||||
{
|
||||
ParameterMap::iterator i = mParameters.find(paramID);
|
||||
|
||||
|
||||
if (i == mParameters.end())
|
||||
{
|
||||
if (mAudioUnit->IsInitialized() && !okWhenInitialized) {
|
||||
// The AU should not be creating new parameters once initialized.
|
||||
// If a client tries to set an undefined parameter, we could throw as follows,
|
||||
// If a client tries to set an undefined parameter, we could throw as follows,
|
||||
// but this might cause a regression. So it is better to just fail silently.
|
||||
// COMPONENT_THROW(kAudioUnitErr_InvalidParameter);
|
||||
#if DEBUG
|
||||
fprintf(stderr, "WARNING: %s SetParameter for undefined param ID %d while initialized. Ignoring..\n",
|
||||
fprintf(stderr, "WARNING: %s SetParameter for undefined param ID %d while initialized. Ignoring..\n",
|
||||
mAudioUnit->GetLoggingString(), (int)paramID);
|
||||
#endif
|
||||
} else {
|
||||
// create new entry in map for the paramID (only happens first time)
|
||||
ParameterMapEvent event(inValue);
|
||||
ParameterMapEvent event(inValue);
|
||||
mParameters[paramID] = event;
|
||||
}
|
||||
}
|
||||
@@ -203,21 +203,21 @@ void AUElement::SetScheduledEvent( AudioUnitParameterID paramID,
|
||||
else
|
||||
{
|
||||
ParameterMap::iterator i = mParameters.find(paramID);
|
||||
|
||||
|
||||
if (i == mParameters.end())
|
||||
{
|
||||
if (mAudioUnit->IsInitialized() && !okWhenInitialized) {
|
||||
// The AU should not be creating new parameters once initialized.
|
||||
// If a client tries to set an undefined parameter, we could throw as follows,
|
||||
// If a client tries to set an undefined parameter, we could throw as follows,
|
||||
// but this might cause a regression. So it is better to just fail silently.
|
||||
// COMPONENT_THROW(kAudioUnitErr_InvalidParameter);
|
||||
#if DEBUG
|
||||
fprintf(stderr, "WARNING: %s SetScheduledEvent for undefined param ID %d while initialized. Ignoring..\n",
|
||||
fprintf(stderr, "WARNING: %s SetScheduledEvent for undefined param ID %d while initialized. Ignoring..\n",
|
||||
mAudioUnit->GetLoggingString(), (int)paramID);
|
||||
#endif
|
||||
} else {
|
||||
// create new entry in map for the paramID (only happens first time)
|
||||
ParameterMapEvent event(inEvent, inSliceOffsetInBuffer, inSliceDurationFrames);
|
||||
ParameterMapEvent event(inEvent, inSliceOffsetInBuffer, inSliceDurationFrames);
|
||||
mParameters[paramID] = event;
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ void AUElement::SetScheduledEvent( AudioUnitParameterID paramID,
|
||||
{
|
||||
// paramID already exists in map so simply change its value
|
||||
ParameterMapEvent &event = (*i).second;
|
||||
|
||||
|
||||
event.SetScheduledEvent(inEvent, inSliceOffsetInBuffer, inSliceDurationFrames );
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@ void AUElement::SaveState(CFMutableDataRef data)
|
||||
UInt32 nparams = static_cast<UInt32>(mIndexedParameters.size());
|
||||
UInt32 theData = CFSwapInt32HostToBig(nparams);
|
||||
CFDataAppendBytes(data, (UInt8 *)&theData, sizeof(nparams));
|
||||
|
||||
|
||||
for (UInt32 i = 0; i < nparams; i++)
|
||||
{
|
||||
struct {
|
||||
@@ -267,12 +267,12 @@ void AUElement::SaveState(CFMutableDataRef data)
|
||||
//CFSwappedFloat32 value; crashes gcc3 PFE
|
||||
UInt32 value; // really a big-endian float
|
||||
} entry;
|
||||
|
||||
|
||||
entry.paramID = CFSwapInt32HostToBig(i);
|
||||
|
||||
|
||||
AudioUnitParameterValue v = mIndexedParameters[i].GetValue();
|
||||
entry.value = CFSwapInt32HostToBig(*(UInt32 *)&v );
|
||||
|
||||
|
||||
CFDataAppendBytes(data, (UInt8 *)&entry, sizeof(entry));
|
||||
}
|
||||
}
|
||||
@@ -280,19 +280,19 @@ void AUElement::SaveState(CFMutableDataRef data)
|
||||
{
|
||||
UInt32 nparams = CFSwapInt32HostToBig(static_cast<uint32_t>(mParameters.size()));
|
||||
CFDataAppendBytes(data, (UInt8 *)&nparams, sizeof(nparams));
|
||||
|
||||
|
||||
for (ParameterMap::iterator i = mParameters.begin(); i != mParameters.end(); ++i) {
|
||||
struct {
|
||||
UInt32 paramID;
|
||||
//CFSwappedFloat32 value; crashes gcc3 PFE
|
||||
UInt32 value; // really a big-endian float
|
||||
} entry;
|
||||
|
||||
|
||||
entry.paramID = CFSwapInt32HostToBig((*i).first);
|
||||
|
||||
|
||||
AudioUnitParameterValue v = (*i).second.GetValue();
|
||||
entry.value = CFSwapInt32HostToBig(*(UInt32 *)&v );
|
||||
|
||||
|
||||
CFDataAppendBytes(data, (UInt8 *)&entry, sizeof(entry));
|
||||
}
|
||||
}
|
||||
@@ -306,20 +306,20 @@ const UInt8 * AUElement::RestoreState(const UInt8 *state)
|
||||
const UInt8 *p = state;
|
||||
UInt32 nparams = CFSwapInt32BigToHost(*(UInt32 *)p);
|
||||
p += sizeof(UInt32);
|
||||
|
||||
|
||||
for (UInt32 i = 0; i < nparams; ++i) {
|
||||
struct {
|
||||
AudioUnitParameterID paramID;
|
||||
AudioUnitParameterValue value;
|
||||
} entry;
|
||||
|
||||
|
||||
entry.paramID = CFSwapInt32BigToHost(*(UInt32 *)p);
|
||||
p += sizeof(UInt32);
|
||||
FloatInt32 temp;
|
||||
temp.i = CFSwapInt32BigToHost(*(UInt32 *)p);
|
||||
entry.value = temp.f;
|
||||
p += sizeof(AudioUnitParameterValue);
|
||||
|
||||
|
||||
SetParameter(entry.paramID, entry.value);
|
||||
}
|
||||
return p;
|
||||
@@ -327,10 +327,10 @@ const UInt8 * AUElement::RestoreState(const UInt8 *state)
|
||||
|
||||
//_____________________________________________________________________________
|
||||
//
|
||||
void AUElement::SetName (CFStringRef inName)
|
||||
{
|
||||
void AUElement::SetName (CFStringRef inName)
|
||||
{
|
||||
if (mElementName) CFRelease (mElementName);
|
||||
mElementName = inName;
|
||||
mElementName = inName;
|
||||
if (mElementName) CFRetain (mElementName);
|
||||
}
|
||||
|
||||
@@ -362,9 +362,9 @@ void AUIOElement::AllocateBuffer(UInt32 inFramesToAllocate)
|
||||
if (GetAudioUnit()->HasBegunInitializing())
|
||||
{
|
||||
UInt32 framesToAllocate = inFramesToAllocate > 0 ? inFramesToAllocate : GetAudioUnit()->GetMaxFramesPerSlice();
|
||||
|
||||
|
||||
// printf ("will allocate: %d\n", (int)((mWillAllocate && NeedsBufferSpace()) ? framesToAllocate : 0));
|
||||
|
||||
|
||||
mIOBuffer.Allocate(mStreamFormat, (mWillAllocate && NeedsBufferSpace()) ? framesToAllocate : 0);
|
||||
}
|
||||
}
|
||||
@@ -381,21 +381,21 @@ void AUIOElement::DeallocateBuffer()
|
||||
// AudioChannelLayout support
|
||||
|
||||
// outLayoutTagsPtr WILL be NULL if called to find out how many
|
||||
// layouts that Audio Unit will report
|
||||
// layouts that Audio Unit will report
|
||||
// return 0 (ie. NO channel layouts) if the AU doesn't require channel layout knowledge
|
||||
UInt32 AUIOElement::GetChannelLayoutTags (AudioChannelLayoutTag *outLayoutTagsPtr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// As the AudioChannelLayout can be a variable length structure
|
||||
|
||||
// As the AudioChannelLayout can be a variable length structure
|
||||
// (though in most cases it won't be!!!)
|
||||
// The size of the ACL is always returned by the method
|
||||
// if outMapPtr is NOT-NULL, then AU should copy into this pointer (outMapPtr) the current ACL that it has in use.
|
||||
// if outMapPtr is NOT-NULL, then AU should copy into this pointer (outMapPtr) the current ACL that it has in use.
|
||||
// the AU should also return whether the property is writable (that is the client can provide any arbitrary ACL that the audio unit will then honour)
|
||||
// or if the property is read only - which is the generally preferred mode.
|
||||
// If the AU doesn't require an AudioChannelLayout, then just return 0.
|
||||
UInt32 AUIOElement::GetAudioChannelLayout (AudioChannelLayout *outMapPtr,
|
||||
UInt32 AUIOElement::GetAudioChannelLayout (AudioChannelLayout *outMapPtr,
|
||||
Boolean &outWritable)
|
||||
{
|
||||
return 0;
|
||||
@@ -500,7 +500,7 @@ bool AUScope::RestoreElementNames (CFDictionaryRef& inNameDict)
|
||||
//first we have to see if we have enough elements
|
||||
bool didAddElements = false;
|
||||
unsigned int maxElNum = GetNumberOfElements();
|
||||
|
||||
|
||||
int dictSize = static_cast<int>(CFDictionaryGetCount(inNameDict));
|
||||
CFStringRef * keys = (CFStringRef*)CA_malloc (dictSize * sizeof (CFStringRef));
|
||||
CFDictionaryGetKeysAndValues (inNameDict, reinterpret_cast<const void**>(keys), NULL);
|
||||
@@ -519,7 +519,7 @@ bool AUScope::RestoreElementNames (CFDictionaryRef& inNameDict)
|
||||
}
|
||||
}
|
||||
free (keys);
|
||||
|
||||
|
||||
return didAddElements;
|
||||
}
|
||||
|
||||
@@ -534,11 +534,11 @@ void AUScope::SaveState(CFMutableDataRef data)
|
||||
UInt32 scope;
|
||||
UInt32 element;
|
||||
} hdr;
|
||||
|
||||
|
||||
hdr.scope = CFSwapInt32HostToBig(GetScope());
|
||||
hdr.element = CFSwapInt32HostToBig(ielem);
|
||||
CFDataAppendBytes(data, (UInt8 *)&hdr, sizeof(hdr));
|
||||
|
||||
|
||||
element->SaveState(data);
|
||||
}
|
||||
}
|
||||
@@ -556,10 +556,10 @@ const UInt8 * AUScope::RestoreState(const UInt8 *state)
|
||||
} entry;
|
||||
UInt32 nparams = CFSwapInt32BigToHost(*(UInt32 *)p);
|
||||
p += sizeof(UInt32);
|
||||
|
||||
|
||||
p += nparams * sizeof(entry);
|
||||
} else
|
||||
p = element->RestoreState(p);
|
||||
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUScopeElement.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUScopeElement_h__
|
||||
#define __AUScopeElement_h__
|
||||
@@ -69,15 +69,15 @@ class ParameterMapEvent
|
||||
{
|
||||
public:
|
||||
/*! @ctor ParameterMapEvent */
|
||||
ParameterMapEvent()
|
||||
: mEventType(kParameterEvent_Immediate), mBufferOffset(0), mDurationInFrames(0), mValue1(0.0f), mValue2(0.0f), mSliceDurationFrames(0)
|
||||
ParameterMapEvent()
|
||||
: mEventType(kParameterEvent_Immediate), mBufferOffset(0), mDurationInFrames(0), mValue1(0.0f), mValue2(0.0f), mSliceDurationFrames(0)
|
||||
{}
|
||||
|
||||
/*! @ctor ParameterMapEvent */
|
||||
ParameterMapEvent(AudioUnitParameterValue inValue)
|
||||
: mEventType(kParameterEvent_Immediate), mBufferOffset(0), mDurationInFrames(0), mValue1(inValue), mValue2(inValue), mSliceDurationFrames(0)
|
||||
: mEventType(kParameterEvent_Immediate), mBufferOffset(0), mDurationInFrames(0), mValue1(inValue), mValue2(inValue), mSliceDurationFrames(0)
|
||||
{}
|
||||
|
||||
|
||||
// constructor for scheduled event
|
||||
/*! @ctor ParameterMapEvent */
|
||||
ParameterMapEvent( const AudioUnitParameterEvent &inEvent,
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
{
|
||||
SetScheduledEvent(inEvent, inSliceOffsetInBuffer, inSliceDurationFrames );
|
||||
};
|
||||
|
||||
|
||||
/*! @method SetScheduledEvent */
|
||||
void SetScheduledEvent( const AudioUnitParameterEvent &inEvent,
|
||||
UInt32 inSliceOffsetInBuffer,
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
{
|
||||
mEventType = inEvent.eventType;
|
||||
mSliceDurationFrames = inSliceDurationFrames;
|
||||
|
||||
|
||||
if(mEventType == kParameterEvent_Immediate )
|
||||
{
|
||||
// constant immediate value for the whole slice
|
||||
@@ -111,9 +111,9 @@ public:
|
||||
mValue2 = inEvent.eventValues.ramp.endValue;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! @method GetEventType */
|
||||
AUParameterEventType GetEventType() const {return mEventType;};
|
||||
|
||||
@@ -122,13 +122,13 @@ public:
|
||||
/*! @method GetEndValue */
|
||||
AudioUnitParameterValue GetEndValue() const {return mValue2;}; // only valid if immediate event type
|
||||
/*! @method SetValue */
|
||||
void SetValue(AudioUnitParameterValue inValue)
|
||||
void SetValue(AudioUnitParameterValue inValue)
|
||||
{
|
||||
mEventType = kParameterEvent_Immediate;
|
||||
mValue1 = inValue;
|
||||
mEventType = kParameterEvent_Immediate;
|
||||
mValue1 = inValue;
|
||||
mValue2 = inValue;
|
||||
}
|
||||
|
||||
|
||||
// interpolates the start and end values corresponding to the current processing slice
|
||||
// most ramp parameter implementations will want to use this method
|
||||
// the start value will correspond to the start of the slice
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
{
|
||||
if (mEventType == kParameterEvent_Ramped) {
|
||||
outValuePerFrameDelta = (mValue2 - mValue1) / mDurationInFrames;
|
||||
|
||||
|
||||
outStartValue = mValue1 + outValuePerFrameDelta * (-mBufferOffset); // corresponds to frame 0 of this slice
|
||||
outEndValue = outStartValue + outValuePerFrameDelta * mSliceDurationFrames;
|
||||
} else {
|
||||
@@ -178,15 +178,15 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
private:
|
||||
AUParameterEventType mEventType;
|
||||
|
||||
|
||||
SInt32 mBufferOffset; // ramp start offset relative to start of this slice (may be negative)
|
||||
UInt32 mDurationInFrames; // total duration of ramp parameter
|
||||
AudioUnitParameterValue mValue1; // value if immediate : startValue if ramp
|
||||
AudioUnitParameterValue mValue2; // endValue (only used for ramp)
|
||||
|
||||
UInt32 mSliceDurationFrames; // duration of this processing slice
|
||||
|
||||
UInt32 mSliceDurationFrames; // duration of this processing slice
|
||||
};
|
||||
|
||||
|
||||
@@ -201,10 +201,10 @@ public:
|
||||
/*! @ctor AUElement */
|
||||
AUElement(AUBase *audioUnit) : mAudioUnit(audioUnit),
|
||||
mUseIndexedParameters(false), mElementName(0) { }
|
||||
|
||||
|
||||
/*! @dtor ~AUElement */
|
||||
virtual ~AUElement() { if (mElementName) CFRelease (mElementName); }
|
||||
|
||||
|
||||
/*! @method GetNumberOfParameters */
|
||||
virtual UInt32 GetNumberOfParameters()
|
||||
{
|
||||
@@ -214,12 +214,12 @@ public:
|
||||
virtual void GetParameterList(AudioUnitParameterID *outList);
|
||||
/*! @method HasParameterID */
|
||||
bool HasParameterID (AudioUnitParameterID paramID) const;
|
||||
|
||||
|
||||
/*! @method GetParameter */
|
||||
AudioUnitParameterValue GetParameter(AudioUnitParameterID paramID);
|
||||
/*! @method SetParameter */
|
||||
void SetParameter(AudioUnitParameterID paramID, AudioUnitParameterValue value, bool okWhenInitialized = false);
|
||||
// Only set okWhenInitialized to true when you know the outside world cannot access this element. Otherwise the parameter map could get corrupted.
|
||||
// Only set okWhenInitialized to true when you know the outside world cannot access this element. Otherwise the parameter map could get corrupted.
|
||||
|
||||
// interpolates the start and end values corresponding to the current processing slice
|
||||
// most ramp parameter implementations will want to use this method
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
AudioUnitParameterValue & outStartValue,
|
||||
AudioUnitParameterValue & outEndValue,
|
||||
AudioUnitParameterValue & outValuePerFrameDelta );
|
||||
|
||||
|
||||
/*! @method GetEndValue */
|
||||
AudioUnitParameterValue GetEndValue( AudioUnitParameterID paramID);
|
||||
|
||||
@@ -238,7 +238,7 @@ public:
|
||||
UInt32 inSliceOffsetInBuffer,
|
||||
UInt32 inSliceDurationFrames,
|
||||
bool okWhenInitialized = false );
|
||||
// Only set okWhenInitialized to true when you know the outside world cannot access this element. Otherwise the parameter map could get corrupted.
|
||||
// Only set okWhenInitialized to true when you know the outside world cannot access this element. Otherwise the parameter map could get corrupted.
|
||||
|
||||
|
||||
/*! @method GetAudioUnit */
|
||||
@@ -259,13 +259,13 @@ public:
|
||||
|
||||
/*! @method AsIOElement*/
|
||||
virtual AUIOElement* AsIOElement () { return NULL; }
|
||||
|
||||
|
||||
protected:
|
||||
inline ParameterMapEvent& GetParamEvent(AudioUnitParameterID paramID);
|
||||
|
||||
|
||||
private:
|
||||
typedef std::map<AudioUnitParameterID, ParameterMapEvent, std::less<AudioUnitParameterID> > ParameterMap;
|
||||
|
||||
|
||||
/*! @var mAudioUnit */
|
||||
AUBase * mAudioUnit;
|
||||
/*! @var mParameters */
|
||||
@@ -275,7 +275,7 @@ private:
|
||||
bool mUseIndexedParameters;
|
||||
/*! @var mIndexedParameters */
|
||||
std::vector<ParameterMapEvent> mIndexedParameters;
|
||||
|
||||
|
||||
/*! @var mElementName */
|
||||
CFStringRef mElementName;
|
||||
};
|
||||
@@ -292,7 +292,7 @@ public:
|
||||
|
||||
/*! @method GetStreamFormat */
|
||||
const CAStreamBasicDescription &GetStreamFormat() const { return mStreamFormat; }
|
||||
|
||||
|
||||
/*! @method SetStreamFormat */
|
||||
virtual OSStatus SetStreamFormat(const CAStreamBasicDescription &desc);
|
||||
|
||||
@@ -304,14 +304,14 @@ public:
|
||||
virtual bool NeedsBufferSpace() const = 0;
|
||||
|
||||
/*! @method SetWillAllocateBuffer */
|
||||
void SetWillAllocateBuffer(bool inFlag) {
|
||||
mWillAllocate = inFlag;
|
||||
void SetWillAllocateBuffer(bool inFlag) {
|
||||
mWillAllocate = inFlag;
|
||||
}
|
||||
/*! @method WillAllocateBuffer */
|
||||
bool WillAllocateBuffer() const {
|
||||
return mWillAllocate;
|
||||
bool WillAllocateBuffer() const {
|
||||
return mWillAllocate;
|
||||
}
|
||||
|
||||
|
||||
/*! @method UseExternalBuffer */
|
||||
void UseExternalBuffer(const AudioUnitExternalBuffer &buf) {
|
||||
mIOBuffer.UseExternalBuffer(mStreamFormat, buf);
|
||||
@@ -392,7 +392,7 @@ public:
|
||||
|
||||
/*! @method SetAudioChannelLayout */
|
||||
virtual OSStatus SetAudioChannelLayout (const AudioChannelLayout &inData);
|
||||
|
||||
|
||||
/*! @method RemoveAudioChannelLayout */
|
||||
virtual OSStatus RemoveAudioChannelLayout ();
|
||||
|
||||
@@ -416,32 +416,32 @@ protected:
|
||||
class AUScopeDelegate {
|
||||
public:
|
||||
/*! @ctor AUScopeDelegate */
|
||||
AUScopeDelegate() : mCreator(NULL), mScope(0) { }
|
||||
AUScopeDelegate() : mCreator(NULL), mScope(0) { }
|
||||
/*! @dtor ~AUScopeDelegate */
|
||||
virtual ~AUScopeDelegate() {}
|
||||
|
||||
|
||||
/*! @method Initialize */
|
||||
void Initialize( AUBase *creator,
|
||||
AudioUnitScope scope,
|
||||
void Initialize( AUBase *creator,
|
||||
AudioUnitScope scope,
|
||||
UInt32 numElements)
|
||||
{
|
||||
mCreator = creator;
|
||||
mScope = scope;
|
||||
SetNumberOfElements(numElements);
|
||||
}
|
||||
|
||||
|
||||
/*! @method SetNumberOfElements */
|
||||
virtual void SetNumberOfElements(UInt32 numElements) = 0;
|
||||
|
||||
|
||||
/*! @method GetNumberOfElements */
|
||||
virtual UInt32 GetNumberOfElements() = 0;
|
||||
|
||||
|
||||
/*! @method GetElement */
|
||||
virtual AUElement * GetElement(UInt32 elementIndex) = 0;
|
||||
|
||||
|
||||
AUBase * GetCreator() const { return mCreator; }
|
||||
AudioUnitScope GetScope() const { return mScope; }
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/*! @var mCreator */
|
||||
@@ -458,13 +458,13 @@ private:
|
||||
class AUScope {
|
||||
public:
|
||||
/*! @ctor AUScope */
|
||||
AUScope() : mCreator(NULL), mScope(0), mDelegate(0) { }
|
||||
AUScope() : mCreator(NULL), mScope(0), mDelegate(0) { }
|
||||
/*! @dtor ~AUScope */
|
||||
~AUScope();
|
||||
|
||||
|
||||
/*! @method Initialize */
|
||||
void Initialize(AUBase *creator,
|
||||
AudioUnitScope scope,
|
||||
void Initialize(AUBase *creator,
|
||||
AudioUnitScope scope,
|
||||
UInt32 numElements)
|
||||
{
|
||||
mCreator = creator;
|
||||
@@ -472,22 +472,22 @@ public:
|
||||
|
||||
if (mDelegate)
|
||||
return mDelegate->Initialize(creator, scope, numElements);
|
||||
|
||||
|
||||
SetNumberOfElements(numElements);
|
||||
}
|
||||
|
||||
|
||||
/*! @method SetNumberOfElements */
|
||||
void SetNumberOfElements(UInt32 numElements);
|
||||
|
||||
|
||||
/*! @method GetNumberOfElements */
|
||||
UInt32 GetNumberOfElements() const
|
||||
UInt32 GetNumberOfElements() const
|
||||
{
|
||||
if (mDelegate)
|
||||
return mDelegate->GetNumberOfElements();
|
||||
|
||||
|
||||
return static_cast<UInt32>(mElements.size());
|
||||
}
|
||||
|
||||
|
||||
/*! @method GetElement */
|
||||
AUElement * GetElement(UInt32 elementIndex) const
|
||||
{
|
||||
@@ -498,7 +498,7 @@ public:
|
||||
// catch passing -1 in as the elementIndex - causes a wrap around
|
||||
return (i >= mElements.end() || i < mElements.begin()) ? NULL : *i;
|
||||
}
|
||||
|
||||
|
||||
/*! @method SafeGetElement */
|
||||
AUElement * SafeGetElement(UInt32 elementIndex)
|
||||
{
|
||||
@@ -507,7 +507,7 @@ public:
|
||||
COMPONENT_THROW(kAudioUnitErr_InvalidElement);
|
||||
return element;
|
||||
}
|
||||
|
||||
|
||||
/*! @method GetIOElement */
|
||||
AUIOElement * GetIOElement(UInt32 elementIndex) const
|
||||
{
|
||||
@@ -517,15 +517,15 @@ public:
|
||||
COMPONENT_THROW (kAudioUnitErr_InvalidElement);
|
||||
return ioel;
|
||||
}
|
||||
|
||||
|
||||
/*! @method HasElementWithName */
|
||||
bool HasElementWithName () const;
|
||||
|
||||
|
||||
/*! @method AddElementNamesToDict */
|
||||
void AddElementNamesToDict (CFMutableDictionaryRef & inNameDict);
|
||||
|
||||
|
||||
bool RestoreElementNames (CFDictionaryRef& inNameDict);
|
||||
|
||||
|
||||
AudioUnitScope GetScope() const { return mScope; }
|
||||
|
||||
void SetDelegate(AUScopeDelegate* inDelegate) { mDelegate = inDelegate; }
|
||||
@@ -535,7 +535,7 @@ public:
|
||||
|
||||
/*! @method RestoreState */
|
||||
const UInt8 * RestoreState(const UInt8 *state);
|
||||
|
||||
|
||||
private:
|
||||
typedef std::vector<AUElement *> ElementVector;
|
||||
/*! @var mCreator */
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ComponentBase.cpp
|
||||
Abstract: ComponentBase.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "ComponentBase.h"
|
||||
#include "CAXException.h"
|
||||
@@ -72,11 +72,11 @@ static OSStatus CB_GetComponentDescription (const AudioComponentInstance inInsta
|
||||
static OSStatus CMgr_GetComponentDescription (const AudioComponentInstance inInstance, AudioComponentDescription * outDesc);
|
||||
#endif
|
||||
|
||||
ComponentBase::ComponentBase(AudioComponentInstance inInstance)
|
||||
: mComponentInstance(inInstance),
|
||||
mInstanceType(sNewInstanceType)
|
||||
{
|
||||
GetComponentDescription();
|
||||
ComponentBase::ComponentBase(AudioComponentInstance inInstance)
|
||||
: mComponentInstance(inInstance),
|
||||
mInstanceType(sNewInstanceType)
|
||||
{
|
||||
GetComponentDescription();
|
||||
}
|
||||
|
||||
ComponentBase::~ComponentBase()
|
||||
@@ -99,7 +99,7 @@ OSStatus ComponentBase::AP_Open(void *self, AudioUnit compInstance)
|
||||
OSStatus result = noErr;
|
||||
try {
|
||||
ComponentInitLocker lock;
|
||||
|
||||
|
||||
ComponentBase::sNewInstanceType = ComponentBase::kAudioComponentInstance;
|
||||
ComponentBase *cb = (ComponentBase *)(*ACPI->mConstruct)(&ACPI->mInstanceStorage, compInstance);
|
||||
cb->PostConstructor(); // allows base class to do additional initialization
|
||||
@@ -137,13 +137,13 @@ OSStatus ComponentBase::ComponentEntryDispatch(ComponentParameters *p, Componen
|
||||
if (This == NULL) return kAudio_ParamError;
|
||||
|
||||
OSStatus result = noErr;
|
||||
|
||||
|
||||
switch (p->what) {
|
||||
case kComponentCloseSelect:
|
||||
This->PreDestructor();
|
||||
delete This;
|
||||
break;
|
||||
|
||||
|
||||
case kComponentVersionSelect:
|
||||
result = This->Version();
|
||||
break;
|
||||
@@ -158,7 +158,7 @@ OSStatus ComponentBase::ComponentEntryDispatch(ComponentParameters *p, Componen
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
result = badComponentSelector;
|
||||
break;
|
||||
@@ -169,7 +169,7 @@ OSStatus ComponentBase::ComponentEntryDispatch(ComponentParameters *p, Componen
|
||||
SInt16 ComponentBase::GetSelectorForCanDo(ComponentParameters *params)
|
||||
{
|
||||
if (params->what != kComponentCanDoSelect) return 0;
|
||||
|
||||
|
||||
#if TARGET_CPU_X86
|
||||
SInt16 sel = params->params[0];
|
||||
#elif TARGET_CPU_X86_64
|
||||
@@ -179,9 +179,9 @@ SInt16 ComponentBase::GetSelectorForCanDo(ComponentParameters *params)
|
||||
#else
|
||||
SInt16 sel = params->params[0];
|
||||
#endif
|
||||
|
||||
|
||||
return sel;
|
||||
/*
|
||||
/*
|
||||
printf ("flags:%d, paramSize: %d, what: %d\n\t", params->flags, params->paramSize, params->what);
|
||||
for (int i = 0; i < params->paramSize; ++i) {
|
||||
printf ("[%d]:%d(0x%x), ", i, params->params[i], params->params[i]);
|
||||
@@ -192,7 +192,7 @@ SInt16 ComponentBase::GetSelectorForCanDo(ComponentParameters *params)
|
||||
|
||||
#endif
|
||||
|
||||
#if CA_DO_NOT_USE_AUDIO_COMPONENT
|
||||
#if CA_DO_NOT_USE_AUDIO_COMPONENT
|
||||
static OSStatus ComponentBase_GetComponentDescription (const AudioComponentInstance & inInstance, AudioComponentDescription &outDesc);
|
||||
#endif
|
||||
|
||||
@@ -200,20 +200,20 @@ AudioComponentDescription ComponentBase::GetComponentDescription() const
|
||||
{
|
||||
AudioComponentDescription desc;
|
||||
OSStatus result = 1;
|
||||
|
||||
|
||||
if (IsPluginObject()) {
|
||||
ca_require_noerr(result = CB_GetComponentDescription (mComponentInstance, &desc), home);
|
||||
}
|
||||
#if !CA_USE_AUDIO_PLUGIN_ONLY
|
||||
else {
|
||||
ca_require_noerr(result = CMgr_GetComponentDescription (mComponentInstance, &desc), home);
|
||||
ca_require_noerr(result = CMgr_GetComponentDescription (mComponentInstance, &desc), home);
|
||||
}
|
||||
#endif
|
||||
|
||||
home:
|
||||
if (result)
|
||||
memset (&desc, 0, sizeof(AudioComponentDescription));
|
||||
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
@@ -239,13 +239,13 @@ static OSStatus CB_GetComponentDescription (const AudioComponentInstance inInsta
|
||||
{
|
||||
typedef AudioComponent (*AudioComponentInstanceGetComponentProc) (AudioComponentInstance);
|
||||
static AudioComponentInstanceGetComponentProc aciGCProc = NULL;
|
||||
|
||||
|
||||
typedef OSStatus (*AudioComponentGetDescriptionProc)(AudioComponent, AudioComponentDescription *);
|
||||
static AudioComponentGetDescriptionProc acGDProc = NULL;
|
||||
|
||||
|
||||
static int doneInit = 0;
|
||||
if (doneInit == 0) {
|
||||
doneInit = 1;
|
||||
doneInit = 1;
|
||||
void* theImage = dlopen("/System/Library/Frameworks/AudioUnit.framework/AudioUnit", RTLD_LAZY);
|
||||
if (theImage != NULL)
|
||||
{
|
||||
@@ -255,13 +255,13 @@ static OSStatus CB_GetComponentDescription (const AudioComponentInstance inInsta
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OSStatus result = kAudio_UnimplementedError;
|
||||
if (acGDProc && aciGCProc) {
|
||||
AudioComponent comp = (*aciGCProc)(inInstance);
|
||||
if (comp)
|
||||
result = (*acGDProc)(comp, outDesc);
|
||||
}
|
||||
}
|
||||
#if !CA_USE_AUDIO_PLUGIN_ONLY
|
||||
else {
|
||||
result = CMgr_GetComponentDescription (inInstance, outDesc);
|
||||
@@ -317,7 +317,7 @@ static void CSInit ()
|
||||
dispatch_once_f(&sCSInitOnce, NULL, CSInitOnce);
|
||||
}
|
||||
|
||||
#else
|
||||
#else
|
||||
|
||||
static void CSInit ()
|
||||
{
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: ComponentBase.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __ComponentBase_h__
|
||||
#define __ComponentBase_h__
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
#if !CA_USE_AUDIO_PLUGIN_ONLY
|
||||
#include <CoreServices/../Frameworks/CarbonCore.framework/Headers/Components.h>
|
||||
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5)
|
||||
#define AudioComponentInstance ComponentInstance
|
||||
#define AudioComponentDescription ComponentDescription
|
||||
@@ -115,13 +115,13 @@ public:
|
||||
|
||||
/*! @ctor ComponentBase */
|
||||
ComponentBase(AudioComponentInstance inInstance);
|
||||
|
||||
|
||||
/*! @dtor ~ComponentBase */
|
||||
virtual ~ComponentBase();
|
||||
|
||||
|
||||
/*! @method PostConstructor */
|
||||
virtual void PostConstructor();
|
||||
|
||||
|
||||
/*! @method PreDestructor */
|
||||
virtual void PreDestructor();
|
||||
|
||||
@@ -135,14 +135,14 @@ public:
|
||||
/*! GetSelectorForCanDo */
|
||||
static SInt16 GetSelectorForCanDo(ComponentParameters *params);
|
||||
#endif
|
||||
|
||||
|
||||
/*! @method GetComponentInstance */
|
||||
AudioComponentInstance GetComponentInstance() const { return mComponentInstance; }
|
||||
|
||||
/*! @method GetComponentDescription */
|
||||
AudioComponentDescription GetComponentDescription() const;
|
||||
|
||||
// This global variable is so that new instances know how they were instantiated: via the Component Manager,
|
||||
// This global variable is so that new instances know how they were instantiated: via the Component Manager,
|
||||
// or as AudioComponents. It's ugly, but preferable to altering the constructor of every class in the hierarchy.
|
||||
// It's safe because construction is protected by ComponentInitLocker.
|
||||
enum EInstanceType { kComponentMgrInstance, kAudioComponentInstance };
|
||||
@@ -158,27 +158,27 @@ public:
|
||||
|
||||
/*! @method AP_Close */
|
||||
static OSStatus AP_Close(void *self);
|
||||
|
||||
|
||||
protected:
|
||||
/*! @var mComponentInstance */
|
||||
AudioComponentInstance mComponentInstance;
|
||||
EInstanceType mInstanceType;
|
||||
};
|
||||
|
||||
class ComponentInitLocker
|
||||
class ComponentInitLocker
|
||||
{
|
||||
#if TARGET_OS_MAC
|
||||
public:
|
||||
ComponentInitLocker()
|
||||
{
|
||||
ComponentInitLocker()
|
||||
{
|
||||
pthread_once(&sOnce, InitComponentInitLocker);
|
||||
pthread_mutex_lock(&sComponentOpenMutex);
|
||||
pthread_mutex_lock(&sComponentOpenMutex);
|
||||
mPreviousNewInstanceType = ComponentBase::sNewInstanceType;
|
||||
}
|
||||
~ComponentInitLocker()
|
||||
{
|
||||
~ComponentInitLocker()
|
||||
{
|
||||
ComponentBase::sNewInstanceType = mPreviousNewInstanceType;
|
||||
pthread_mutex_unlock(&sComponentOpenMutex);
|
||||
pthread_mutex_unlock(&sComponentOpenMutex);
|
||||
}
|
||||
|
||||
// There are situations (11844772) where we need to be able to release the lock early.
|
||||
@@ -190,7 +190,7 @@ public:
|
||||
}
|
||||
~Unlocker()
|
||||
{
|
||||
pthread_mutex_lock(&sComponentOpenMutex);
|
||||
pthread_mutex_lock(&sComponentOpenMutex);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -198,7 +198,7 @@ private:
|
||||
static pthread_mutex_t sComponentOpenMutex;
|
||||
static pthread_once_t sOnce;
|
||||
static void InitComponentInitLocker();
|
||||
|
||||
|
||||
#elif TARGET_OS_WIN32
|
||||
public:
|
||||
bool sNeedsUnlocking;
|
||||
@@ -207,12 +207,12 @@ public:
|
||||
private:
|
||||
static CAGuard sComponentOpenGuard;
|
||||
#endif
|
||||
|
||||
|
||||
private:
|
||||
ComponentBase::EInstanceType mPreviousNewInstanceType;
|
||||
};
|
||||
|
||||
/*! @class AudioComponentPlugInInstance */
|
||||
/*! @class AudioComponentPlugInInstance */
|
||||
struct AudioComponentPlugInInstance {
|
||||
AudioComponentPlugInInterface mPlugInInterface;
|
||||
void * (*mConstruct)(void *memory, AudioComponentInstance ci);
|
||||
@@ -222,7 +222,7 @@ struct AudioComponentPlugInInstance {
|
||||
// this member is just a placeholder. it is aligned to a 16byte boundary
|
||||
};
|
||||
|
||||
/*! @class APFactory */
|
||||
/*! @class APFactory */
|
||||
template <class APMethodLookup, class Implementor>
|
||||
class APFactory {
|
||||
public:
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
{
|
||||
return new(memory) Implementor(compInstance);
|
||||
}
|
||||
|
||||
|
||||
static void Destruct(void *memory)
|
||||
{
|
||||
((Implementor *)memory)->~Implementor();
|
||||
@@ -240,7 +240,7 @@ public:
|
||||
// The actual implementation object is not created until Open().
|
||||
static AudioComponentPlugInInterface *Factory(const AudioComponentDescription * /* inDesc */)
|
||||
{
|
||||
AudioComponentPlugInInstance *acpi =
|
||||
AudioComponentPlugInInstance *acpi =
|
||||
(AudioComponentPlugInInstance *)malloc( offsetof(AudioComponentPlugInInstance, mInstanceStorage) + sizeof(Implementor) );
|
||||
acpi->mPlugInInterface.Open = ComponentBase::AP_Open;
|
||||
acpi->mPlugInInterface.Close = ComponentBase::AP_Close;
|
||||
@@ -252,17 +252,17 @@ public:
|
||||
acpi->mPad[1] = NULL;
|
||||
return (AudioComponentPlugInInterface*)acpi;
|
||||
}
|
||||
|
||||
|
||||
// This is for runtime registration (not for plug-ins loaded from bundles).
|
||||
static AudioComponent Register(UInt32 type, UInt32 subtype, UInt32 manuf, CFStringRef name, UInt32 vers, UInt32 flags=0)
|
||||
{
|
||||
AudioComponentDescription desc = { type, subtype, manuf, flags, 0 };
|
||||
return AudioComponentRegister(&desc, name, vers, Factory);
|
||||
return AudioComponentRegister(&desc, name, vers, Factory);
|
||||
}
|
||||
};
|
||||
|
||||
#if !CA_USE_AUDIO_PLUGIN_ONLY
|
||||
/*! @class ComponentEntryPoint
|
||||
/*! @class ComponentEntryPoint
|
||||
* @discussion This is only used for a component manager version
|
||||
*/
|
||||
template <class Class>
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
static OSStatus Dispatch(ComponentParameters *params, Class *obj)
|
||||
{
|
||||
OSStatus result = noErr;
|
||||
|
||||
|
||||
try {
|
||||
if (params->what == kComponentOpenSelect) {
|
||||
// solve a host of initialization thread safety issues.
|
||||
@@ -283,16 +283,16 @@ public:
|
||||
Class *This = new Class((AudioComponentInstance)ci);
|
||||
This->PostConstructor(); // allows base class to do additional initialization
|
||||
// once the derived class is fully constructed
|
||||
|
||||
|
||||
CMgr_SetComponentInstanceStorage(ci, (Handle)This);
|
||||
} else
|
||||
result = Class::ComponentEntryDispatch(params, obj);
|
||||
}
|
||||
COMPONENT_CATCH
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*! @method Register */
|
||||
static Component Register(OSType compType, OSType subType, OSType manufacturer)
|
||||
{
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUCarbonViewBase.cpp
|
||||
Abstract: AUCarbonViewBase.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUCarbonViewBase.h"
|
||||
#include "AUCarbonViewControl.h"
|
||||
@@ -59,11 +59,11 @@ AUCarbonViewBase::AUCarbonViewBase(AudioUnitCarbonView inInstance, Float32 inNot
|
||||
mTimerUPP (NULL),
|
||||
mCarbonWindow(NULL),
|
||||
mCarbonPane(NULL),
|
||||
mXOffset(0),
|
||||
mXOffset(0),
|
||||
mYOffset(0)
|
||||
{
|
||||
AUEventListenerCreate (ParameterListener, this,
|
||||
CFRunLoopGetCurrent(), kCFRunLoopCommonModes,
|
||||
CFRunLoopGetCurrent(), kCFRunLoopCommonModes,
|
||||
inNotificationInterval, inNotificationInterval,
|
||||
&mParameterListener);
|
||||
}
|
||||
@@ -82,12 +82,12 @@ AUCarbonViewBase::~AUCarbonViewBase()
|
||||
|
||||
if (mTimerRef)
|
||||
::RemoveEventLoopTimer (mTimerRef);
|
||||
|
||||
|
||||
if (mTimerUPP)
|
||||
DisposeEventLoopTimerUPP (mTimerUPP);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void AUCarbonViewBase::AddControl(AUCarbonViewControl *control)
|
||||
{
|
||||
ControlList::iterator it = find(mControlList.begin(), mControlList.end(), control);
|
||||
@@ -126,7 +126,7 @@ void AUCarbonViewBase::ParameterListener(void * inCallbackRefCon,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef inWindow, ControlRef inParentControl, const Float32Point &inLocation, const Float32Point &inSize, ControlRef &outParentControl)
|
||||
{
|
||||
#if !__LP64__
|
||||
@@ -140,19 +140,19 @@ OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef i
|
||||
Rect area;
|
||||
area.left = short(inLocation.x); area.top = short(inLocation.y);
|
||||
area.right = short(area.left + inSize.x); area.bottom = short(area.top + inSize.y);
|
||||
OSStatus err = ::CreateUserPaneControl(inWindow, &area,
|
||||
OSStatus err = ::CreateUserPaneControl(inWindow, &area,
|
||||
kControlSupportsEmbedding,
|
||||
&mCarbonPane); // subclass can resize mCarbonPane to taste
|
||||
verify_noerr(err);
|
||||
if (err) return err;
|
||||
outParentControl = mCarbonPane;
|
||||
|
||||
|
||||
// register for mouse-down in our pane -- we want to clear focus
|
||||
EventTypeSpec paneEvents[] = {
|
||||
{ kEventClassControl, kEventControlClick }
|
||||
};
|
||||
WantEventTypes(GetControlEventTarget(mCarbonPane), GetEventTypeCount(paneEvents), paneEvents);
|
||||
|
||||
|
||||
if (IsCompositWindow()) {
|
||||
verify_noerr(::HIViewAddSubview(inParentControl, mCarbonPane));
|
||||
mXOffset = 0;
|
||||
@@ -164,7 +164,7 @@ OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef i
|
||||
mYOffset = inLocation.y;
|
||||
}
|
||||
mBottomRight.h = mBottomRight.v = 0;
|
||||
|
||||
|
||||
SizeControl(mCarbonPane, 0, 0);
|
||||
if (err = CreateUI(mXOffset, mYOffset))
|
||||
return err;
|
||||
@@ -187,12 +187,12 @@ OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef i
|
||||
{ kEventClassScrollable, kEventScrollableGetInfo },
|
||||
{ kEventClassScrollable, kEventScrollableScrollTo }
|
||||
};
|
||||
|
||||
|
||||
WantEventTypes(GetControlEventTarget(mCarbonPane), GetEventTypeCount(scrollEvents), scrollEvents);
|
||||
|
||||
|
||||
mCurrentScrollPoint.x = mCurrentScrollPoint.y = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
return err;
|
||||
#else
|
||||
return noErr;
|
||||
@@ -212,10 +212,10 @@ OSStatus AUCarbonViewBase::EmbedControl(ControlRef ctl)
|
||||
if (r.right > mBottomRight.h) mBottomRight.h = r.right;
|
||||
if (r.bottom > mBottomRight.v) mBottomRight.v = r.bottom;
|
||||
|
||||
if (IsCompositWindow())
|
||||
if (IsCompositWindow())
|
||||
return ::HIViewAddSubview(mCarbonPane, ctl);
|
||||
else
|
||||
return ::EmbedControl(ctl, mCarbonPane);
|
||||
else
|
||||
return ::EmbedControl(ctl, mCarbonPane);
|
||||
#else
|
||||
return noErr;
|
||||
#endif
|
||||
@@ -224,19 +224,19 @@ OSStatus AUCarbonViewBase::EmbedControl(ControlRef ctl)
|
||||
void AUCarbonViewBase::AddCarbonControl(AUCarbonViewControl::ControlType type, const CAAUParameter ¶m, ControlRef control)
|
||||
{
|
||||
verify_noerr(EmbedControl(control));
|
||||
|
||||
|
||||
AUCarbonViewControl *auvc = new AUCarbonViewControl(this, mParameterListener, type, param, control);
|
||||
auvc->Bind();
|
||||
AddControl(auvc);
|
||||
}
|
||||
|
||||
bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef event)
|
||||
{
|
||||
{
|
||||
#if !__LP64__
|
||||
UInt32 eclass = GetEventClass(event);
|
||||
UInt32 ekind = GetEventKind(event);
|
||||
ControlRef control;
|
||||
|
||||
|
||||
switch (eclass) {
|
||||
case kEventClassControl:
|
||||
{
|
||||
@@ -250,7 +250,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kEventClassScrollable:
|
||||
{
|
||||
switch (ekind) {
|
||||
@@ -262,7 +262,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
|
||||
*/
|
||||
HISize originalSize = { mBottomRight.h, mBottomRight.v };
|
||||
verify_noerr(SetEventParameter(event, kEventParamImageSize, typeHISize, sizeof(HISize), &originalSize));
|
||||
|
||||
|
||||
// [2/4]
|
||||
/* <-- kEventParamViewSize (out, typeHISize)
|
||||
* On exit, contains the amount of the scrollable view that is
|
||||
@@ -274,7 +274,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
|
||||
//HISize windowSize = { float(windowBounds.right - windowBounds.left),
|
||||
// float(windowBounds.bottom - windowBounds.top) };
|
||||
verify_noerr(SetEventParameter(event, kEventParamViewSize, typeHISize, sizeof(HISize), &(parentBounds.size)));
|
||||
|
||||
|
||||
// [3/4]
|
||||
/* <-- kEventParamLineSize (out, typeHISize)
|
||||
* On exit, contains the amount that should be scrolled in
|
||||
@@ -282,7 +282,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
|
||||
*/
|
||||
HISize scrollIncrementSize = { 16.0f, float(20) };
|
||||
verify_noerr(SetEventParameter(event, kEventParamLineSize, typeHISize, sizeof(HISize), &scrollIncrementSize));
|
||||
|
||||
|
||||
// [4/4]
|
||||
/* <-- kEventParamOrigin (out, typeHIPoint)
|
||||
* On exit, contains the scrollable viewÕs current origin (the
|
||||
@@ -294,17 +294,17 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
|
||||
verify_noerr(SetEventParameter(event, kEventParamOrigin, typeHIPoint, sizeof(HIPoint), &mCurrentScrollPoint));
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
case kEventScrollableScrollTo:
|
||||
{
|
||||
/*
|
||||
* kEventClassScrollable / kEventScrollableScrollTo
|
||||
*
|
||||
*
|
||||
* Summary:
|
||||
* Requests that an HIScrollViewÕs scrollable view should scroll to
|
||||
* a particular origin.
|
||||
*/
|
||||
|
||||
|
||||
/* --> kEventParamOrigin (in, typeHIPoint)
|
||||
* The new origin for the scrollable view. The origin
|
||||
* coordinates will vary from (0,0) to scrollable viewÕs image
|
||||
@@ -312,24 +312,24 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
|
||||
*/
|
||||
HIPoint pointToScrollTo;
|
||||
verify_noerr(GetEventParameter(event, kEventParamOrigin, typeHIPoint, NULL, sizeof(HIPoint), NULL, &pointToScrollTo));
|
||||
|
||||
|
||||
float xDelta = mCurrentScrollPoint.x - pointToScrollTo.x;
|
||||
float yDelta = mCurrentScrollPoint.y - pointToScrollTo.y;
|
||||
// move visible portion the appropriate amount
|
||||
verify_noerr(HIViewScrollRect(mCarbonPane, NULL, xDelta, yDelta));
|
||||
// set new content to be drawn
|
||||
verify_noerr(HIViewSetBoundsOrigin(mCarbonPane, pointToScrollTo.x, pointToScrollTo.y));
|
||||
|
||||
|
||||
mCurrentScrollPoint = pointToScrollTo;
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -352,7 +352,7 @@ void AUCarbonViewBase::TellListener (const CAAUParameter &auvp, AudioUnitCarbonV
|
||||
} else {
|
||||
auEvent.mEventType = kAudioUnitEvent_EndParameterChangeGesture;
|
||||
}
|
||||
AUEventListenerNotify(mParameterListener, this, &auEvent);
|
||||
AUEventListenerNotify(mParameterListener, this, &auEvent);
|
||||
}
|
||||
|
||||
|
||||
@@ -370,34 +370,34 @@ pascal void AUCarbonViewBase::TheTimerProc (EventLoopTimerRef inTimer, void *in
|
||||
This->RespondToEventTimer (inTimer);
|
||||
}
|
||||
|
||||
void AUCarbonViewBase::RespondToEventTimer (EventLoopTimerRef inTimer)
|
||||
void AUCarbonViewBase::RespondToEventTimer (EventLoopTimerRef inTimer)
|
||||
{}
|
||||
|
||||
/*
|
||||
/*
|
||||
THESE are reasonable values for these two times
|
||||
0.005 // delay
|
||||
0.005 // delay
|
||||
0.050 // interval
|
||||
*/
|
||||
|
||||
OSStatus AUCarbonViewBase::CreateEventLoopTimer (Float32 inDelay, Float32 inInterval)
|
||||
OSStatus AUCarbonViewBase::CreateEventLoopTimer (Float32 inDelay, Float32 inInterval)
|
||||
{
|
||||
if (mTimerUPP)
|
||||
return noErr;
|
||||
|
||||
|
||||
mTimerUPP = NewEventLoopTimerUPP(TheTimerProc);
|
||||
|
||||
|
||||
EventLoopRef mainEventLoop = GetMainEventLoop();
|
||||
|
||||
|
||||
//doesn't seem to like too small a value
|
||||
if (inDelay < 0.005)
|
||||
inDelay = 0.005;
|
||||
|
||||
|
||||
OSStatus timerResult = ::InstallEventLoopTimer(
|
||||
mainEventLoop,
|
||||
inDelay,
|
||||
inInterval,
|
||||
mTimerUPP,
|
||||
this,
|
||||
&mTimerRef);
|
||||
&mTimerRef);
|
||||
return timerResult;
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUCarbonViewBase.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUCarbonViewBase_h__
|
||||
#define __AUCarbonViewBase_h__
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
Float32 inNotificationInterval = kDefaultNotificationInterval /* in seconds */);
|
||||
/*! @dtor ~AUCarbonViewBase */
|
||||
virtual ~AUCarbonViewBase();
|
||||
|
||||
|
||||
// AUViewBase overrides
|
||||
/*! @method CreateCarbonView */
|
||||
virtual OSStatus CreateCarbonView (AudioUnit inAudioUnit, WindowRef inWindow, ControlRef inParentControl, const Float32Point &inLocation, const Float32Point &inSize, ControlRef &outParentControl);
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
|
||||
/*! @method HandleEvent */
|
||||
virtual bool HandleEvent (EventHandlerCallRef inHandlerRef, EventRef event);
|
||||
|
||||
|
||||
/*! @method GetEditAudioUnit */
|
||||
const AudioUnit GetEditAudioUnit () const { return mEditAudioUnit; }
|
||||
//
|
||||
@@ -84,8 +84,8 @@ public:
|
||||
|
||||
/*! @method AddCarbonControl */
|
||||
void AddCarbonControl (
|
||||
AUCarbonViewControl::ControlType type,
|
||||
const CAAUParameter & param,
|
||||
AUCarbonViewControl::ControlType type,
|
||||
const CAAUParameter & param,
|
||||
ControlRef control);
|
||||
|
||||
/*! @method GetCarbonWindow */
|
||||
@@ -94,27 +94,27 @@ public:
|
||||
ControlRef GetCarbonPane () { return mCarbonPane; }
|
||||
/*! @method EmbedControl */
|
||||
OSStatus EmbedControl (ControlRef ctl);
|
||||
|
||||
|
||||
/*! @method TellListener */
|
||||
void TellListener (const CAAUParameter &auvp, AudioUnitCarbonViewEventID event, void *evpar);
|
||||
|
||||
|
||||
// pass in true if wanting an update to the view and you're calling this from a thread
|
||||
// that is safe to do UI in.
|
||||
// If you don't know, pass in false!
|
||||
/*! @method Update */
|
||||
void Update (bool inUIThread);
|
||||
|
||||
|
||||
/*! @method GetXOffset */
|
||||
Float32 GetXOffset () { return mXOffset; }
|
||||
/*! @method GetYOffset */
|
||||
Float32 GetYOffset () { return mYOffset; }
|
||||
|
||||
|
||||
/*! @method ClearControls */
|
||||
void ClearControls ();
|
||||
|
||||
|
||||
/*! @method IsCompositWindow */
|
||||
bool IsCompositWindow () const { return mCompositWindow; }
|
||||
|
||||
|
||||
protected:
|
||||
#if !__LP64__
|
||||
/*! @method SetEventListener */
|
||||
@@ -131,15 +131,15 @@ protected:
|
||||
void RemoveControl (AUCarbonViewControl *control);
|
||||
|
||||
OSStatus CreateEventLoopTimer (Float32 inDelay, Float32 inInterval);
|
||||
|
||||
|
||||
/*! @method ParameterListener */
|
||||
static void ParameterListener (void * inCallbackRefCon,
|
||||
void * inObject,
|
||||
const AudioUnitEvent * inEvent,
|
||||
UInt64 inEventHostTime,
|
||||
Float32 inParameterValue);
|
||||
|
||||
static pascal void TheTimerProc ( EventLoopTimerRef inTimer,
|
||||
|
||||
static pascal void TheTimerProc ( EventLoopTimerRef inTimer,
|
||||
void * inUserData);
|
||||
|
||||
virtual void RespondToEventTimer (EventLoopTimerRef inTimer);
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUCarbonViewControl.cpp
|
||||
Abstract: AUCarbonViewControl.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUCarbonViewControl.h"
|
||||
#include "AUCarbonViewBase.h"
|
||||
@@ -74,11 +74,11 @@ void AUCarbonViewControl::Bind()
|
||||
mInControlInitialization = 1; // true
|
||||
AUListenerAddParameter(mListener, this, &mParam);
|
||||
// will cause an almost-immediate callback
|
||||
|
||||
|
||||
EventTypeSpec events[] = {
|
||||
{ kEventClassControl, kEventControlValueFieldChanged } // N.B. OS X only
|
||||
};
|
||||
|
||||
|
||||
WantEventTypes(GetControlEventTarget(mControl), GetEventTypeCount(events), events);
|
||||
|
||||
if (mType == kTypeContinuous || mType == kTypeText || mType == kTypeDiscrete) {
|
||||
@@ -88,18 +88,18 @@ void AUCarbonViewControl::Bind()
|
||||
{ kEventClassControl, kEventControlTrack }
|
||||
};
|
||||
WantEventTypes(GetControlEventTarget(mControl), GetEventTypeCount(events), events);
|
||||
}
|
||||
}
|
||||
|
||||
if (mType == kTypeText) {
|
||||
EventTypeSpec events[] = {
|
||||
{ kEventClassControl, kEventControlSetFocusPart }
|
||||
};
|
||||
WantEventTypes(GetControlEventTarget(mControl), GetEventTypeCount(events), events);
|
||||
WantEventTypes(GetControlEventTarget(mControl), GetEventTypeCount(events), events);
|
||||
ControlKeyFilterUPP proc = mParam.ValuesHaveStrings() ? StdKeyFilterCallback : NumericKeyFilterCallback;
|
||||
// this will fail for a static text field
|
||||
SetControlData(mControl, 0, kControlEditTextKeyFilterTag, sizeof(proc), &proc);
|
||||
}
|
||||
|
||||
|
||||
Update(true);
|
||||
mInControlInitialization = 0; // false
|
||||
#endif
|
||||
@@ -116,7 +116,7 @@ void AUCarbonViewControl::ParameterToControl(Float32 paramValue)
|
||||
case kTypeDiscrete:
|
||||
{
|
||||
long value = long(paramValue);
|
||||
|
||||
|
||||
// special case [1] -- menu parameters
|
||||
if (mParam.HasNamedParams()) {
|
||||
// if we're dealing with menus they behave differently!
|
||||
@@ -124,17 +124,17 @@ void AUCarbonViewControl::ParameterToControl(Float32 paramValue)
|
||||
// first menu item always reports a control value of 1
|
||||
ControlKind ctrlKind;
|
||||
if (GetControlKind(mControl, &ctrlKind) == noErr) {
|
||||
if ((ctrlKind.kind == kControlKindPopupArrow)
|
||||
|| (ctrlKind.kind == kControlKindPopupButton))
|
||||
if ((ctrlKind.kind == kControlKindPopupArrow)
|
||||
|| (ctrlKind.kind == kControlKindPopupButton))
|
||||
{
|
||||
value = value - long(mParam.ParamInfo().minValue) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// special case [2] -- Write-only boolean parameters
|
||||
AudioUnitParameterInfo AUPI = mParam.ParamInfo();
|
||||
|
||||
|
||||
bool isWriteOnlyBoolParameter = ( (AUPI.unit == kAudioUnitParameterUnit_Boolean) &&
|
||||
(AUPI.flags & kAudioUnitParameterFlag_IsWritable) &&
|
||||
!(AUPI.flags & kAudioUnitParameterFlag_IsReadable) );
|
||||
@@ -148,7 +148,7 @@ void AUCarbonViewControl::ParameterToControl(Float32 paramValue)
|
||||
CFStringRef cfstr = mParam.GetStringFromValueCopy(¶mValue);
|
||||
|
||||
if ( !(mParam.ParamInfo().flags & kAudioUnitParameterFlag_IsWritable) //READ ONLY PARAMS
|
||||
&& (mParam.ParamInfo().flags & kAudioUnitParameterFlag_IsReadable))
|
||||
&& (mParam.ParamInfo().flags & kAudioUnitParameterFlag_IsReadable))
|
||||
{
|
||||
if (mParam.GetParamTag()) {
|
||||
CFMutableStringRef str = CFStringCreateMutableCopy(NULL, 256, cfstr);
|
||||
@@ -184,7 +184,7 @@ void AUCarbonViewControl::ControlToParameter()
|
||||
case kTypeDiscrete:
|
||||
{
|
||||
long value = GetValue();
|
||||
|
||||
|
||||
// special case [1] -- Menus
|
||||
if (mParam.HasNamedParams()) {
|
||||
// if we're dealing with menus they behave differently!
|
||||
@@ -192,24 +192,24 @@ void AUCarbonViewControl::ControlToParameter()
|
||||
// first menu item always reports a control value of 1
|
||||
ControlKind ctrlKind;
|
||||
if (GetControlKind(mControl, &ctrlKind) == noErr) {
|
||||
if ((ctrlKind.kind == kControlKindPopupArrow)
|
||||
|| (ctrlKind.kind == kControlKindPopupButton))
|
||||
if ((ctrlKind.kind == kControlKindPopupArrow)
|
||||
|| (ctrlKind.kind == kControlKindPopupButton))
|
||||
{
|
||||
value = value + long(mParam.ParamInfo().minValue) - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// special case [2] -- Write-only boolean parameters
|
||||
AudioUnitParameterInfo AUPI = mParam.ParamInfo();
|
||||
|
||||
|
||||
bool isWriteOnlyBoolParameter = ( (AUPI.unit == kAudioUnitParameterUnit_Boolean) &&
|
||||
(AUPI.flags & kAudioUnitParameterFlag_IsWritable) &&
|
||||
!(AUPI.flags & kAudioUnitParameterFlag_IsReadable) );
|
||||
if (isWriteOnlyBoolParameter) {
|
||||
value = 1;
|
||||
}
|
||||
|
||||
|
||||
mParam.SetValue (mListener, this, value);
|
||||
}
|
||||
break;
|
||||
@@ -284,25 +284,25 @@ long AUCarbonViewControl::GetValue()
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Notes on event handling
|
||||
|
||||
/* Notes on event handling
|
||||
|
||||
Button (Click and release on button)
|
||||
kEventControlClick received
|
||||
kEventControlTrack received
|
||||
kEventControlValueFieldChanged received
|
||||
kEventControlHit received
|
||||
|
||||
|
||||
Button (Click and release outside of button bounds)
|
||||
kEventControlClick received
|
||||
kEventControlTrack received
|
||||
|
||||
|
||||
Slider (Click, drag, and release)
|
||||
kEventControlClick received
|
||||
kEventControlTrack received
|
||||
kEventControlValueFieldChanged received
|
||||
kEventControlValueFieldChanged received
|
||||
kEventControlHit received
|
||||
|
||||
|
||||
Slider (Click, release without changing value)
|
||||
kEventControlClick received
|
||||
kEventControlTrack received
|
||||
@@ -313,16 +313,16 @@ bool AUCarbonViewControl::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef
|
||||
UInt32 ekind = GetEventKind(event);
|
||||
ControlRef control;
|
||||
bool handled = true;
|
||||
|
||||
|
||||
switch (eclass) {
|
||||
case kEventClassControl:
|
||||
{
|
||||
AudioUnitParameterInfo AUPI = mParam.ParamInfo();
|
||||
|
||||
|
||||
bool isWriteOnlyBoolParameter = ( (AUPI.unit == kAudioUnitParameterUnit_Boolean) &&
|
||||
(AUPI.flags & kAudioUnitParameterFlag_IsWritable) &&
|
||||
!(AUPI.flags & kAudioUnitParameterFlag_IsReadable) );
|
||||
|
||||
|
||||
switch (ekind) {
|
||||
case kEventControlSetFocusPart: // tab
|
||||
handled = !handled; // fall through to next case
|
||||
@@ -331,7 +331,7 @@ bool AUCarbonViewControl::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef
|
||||
GetEventParameter(event, kEventParamDirectObject, typeControlRef, NULL, sizeof(ControlRef), NULL, &control);
|
||||
verify(control == mControl);
|
||||
ControlToParameter();
|
||||
return handled;
|
||||
return handled;
|
||||
case kEventControlClick:
|
||||
if (isWriteOnlyBoolParameter) {
|
||||
GetEventParameter(event, kEventParamDirectObject, typeControlRef, NULL, sizeof(ControlRef), NULL, &control);
|
||||
@@ -341,7 +341,7 @@ bool AUCarbonViewControl::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef
|
||||
if (mLastControl != NULL) {
|
||||
mLastControl->Update(false);
|
||||
}
|
||||
mLastControl = this;
|
||||
mLastControl = this;
|
||||
}
|
||||
mOwnerView->TellListener(mParam, kAudioUnitCarbonViewEvent_MouseDownInControl, NULL);
|
||||
break; // don't return true, continue normal processing
|
||||
@@ -349,17 +349,17 @@ bool AUCarbonViewControl::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef
|
||||
if (mLastControl != this) {
|
||||
if (mLastControl != NULL)
|
||||
mLastControl->Update(false);
|
||||
mLastControl = this;
|
||||
}
|
||||
mLastControl = this;
|
||||
}
|
||||
mOwnerView->TellListener(mParam, kAudioUnitCarbonViewEvent_MouseUpInControl, NULL);
|
||||
break; // don't return true, continue normal processing
|
||||
case kEventControlTrack:
|
||||
case kEventControlTrack:
|
||||
if (mLastControl != this) {
|
||||
if (mLastControl != NULL)
|
||||
mLastControl->Update(false);
|
||||
mLastControl = this;
|
||||
mLastControl = this;
|
||||
}
|
||||
|
||||
|
||||
CallNextEventHandler(inHandlerRef, event);
|
||||
ControlToParameter(); // new code
|
||||
mOwnerView->TellListener(mParam, kAudioUnitCarbonViewEvent_MouseUpInControl, NULL);
|
||||
@@ -379,8 +379,8 @@ pascal void AUCarbonViewControl::SliderTrackProc(ControlRef theControl, ControlP
|
||||
// AUCarbonViewControl *This = (AUCarbonViewControl *)GetControlReference(theControl);
|
||||
}
|
||||
|
||||
pascal ControlKeyFilterResult AUCarbonViewControl::StdKeyFilterCallback(ControlRef theControl,
|
||||
SInt16 *keyCode, SInt16 *charCode,
|
||||
pascal ControlKeyFilterResult AUCarbonViewControl::StdKeyFilterCallback(ControlRef theControl,
|
||||
SInt16 *keyCode, SInt16 *charCode,
|
||||
EventModifiers *modifiers)
|
||||
{
|
||||
#if !__LP64__
|
||||
@@ -397,8 +397,8 @@ pascal ControlKeyFilterResult AUCarbonViewControl::StdKeyFilterCallback(ControlR
|
||||
return kControlKeyFilterBlockKey;
|
||||
}
|
||||
|
||||
pascal ControlKeyFilterResult AUCarbonViewControl::NumericKeyFilterCallback(ControlRef theControl,
|
||||
SInt16 *keyCode, SInt16 *charCode,
|
||||
pascal ControlKeyFilterResult AUCarbonViewControl::NumericKeyFilterCallback(ControlRef theControl,
|
||||
SInt16 *keyCode, SInt16 *charCode,
|
||||
EventModifiers *modifiers)
|
||||
{
|
||||
#if !__LP64__
|
||||
@@ -420,43 +420,43 @@ Boolean AUCarbonViewControl::SizeControlToFit(ControlRef inControl, SInt16 *outW
|
||||
{
|
||||
#if !__LP64__
|
||||
if (inControl == 0) return false;
|
||||
|
||||
|
||||
Boolean bValue = false;
|
||||
// this only works on text controls -- returns an error for other controls, but doesn't do anything,
|
||||
// so the error is irrelevant
|
||||
SetControlData(inControl, kControlEntireControl, 'stim' /* kControlStaticTextIsMultilineTag */, sizeof(Boolean), &bValue);
|
||||
|
||||
|
||||
SInt16 baseLineOffset;
|
||||
Rect bestRect;
|
||||
OSErr err = GetBestControlRect(inControl, &bestRect, &baseLineOffset);
|
||||
OSErr err = GetBestControlRect(inControl, &bestRect, &baseLineOffset);
|
||||
if (err != noErr) return false;
|
||||
|
||||
|
||||
int width = (bestRect.right - bestRect.left) + 1;
|
||||
int height = (bestRect.bottom - bestRect.top) + 1;
|
||||
|
||||
|
||||
Rect boundsRect;
|
||||
GetControlBounds (inControl, &boundsRect);
|
||||
|
||||
|
||||
Rect newRect;
|
||||
newRect.top = boundsRect.top;
|
||||
newRect.bottom = newRect.top + height;
|
||||
newRect.left = boundsRect.left;
|
||||
newRect.right = newRect.left + width;
|
||||
|
||||
|
||||
SetControlBounds (inControl, &newRect);
|
||||
|
||||
|
||||
if (outWidth)
|
||||
*outWidth = width;
|
||||
|
||||
|
||||
if (outHeight)
|
||||
*outHeight = height;
|
||||
#endif
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma mark ___AUPropertyControl
|
||||
bool AUPropertyControl::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef event)
|
||||
{
|
||||
{
|
||||
UInt32 eclass = GetEventClass(event);
|
||||
UInt32 ekind = GetEventKind(event);
|
||||
switch (eclass) {
|
||||
@@ -477,14 +477,14 @@ void AUPropertyControl::RegisterEvents ()
|
||||
EventTypeSpec events[] = {
|
||||
{ kEventClassControl, kEventControlValueFieldChanged } // N.B. OS X only
|
||||
};
|
||||
|
||||
|
||||
WantEventTypes(GetControlEventTarget(mControl), GetEventTypeCount(events), events);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AUPropertyControl::EmbedControl (ControlRef theControl)
|
||||
{
|
||||
mView->EmbedControl (theControl);
|
||||
void AUPropertyControl::EmbedControl (ControlRef theControl)
|
||||
{
|
||||
mView->EmbedControl (theControl);
|
||||
}
|
||||
|
||||
WindowRef AUPropertyControl::GetCarbonWindow()
|
||||
@@ -498,11 +498,11 @@ static CFStringRef kStringFactoryPreset = kAUViewLocalizedStringKey_FactoryPrese
|
||||
static bool sAUVPresetLocalized = false;
|
||||
#endif
|
||||
|
||||
AUVPresets::AUVPresets (AUCarbonViewBase* inParentView,
|
||||
AUVPresets::AUVPresets (AUCarbonViewBase* inParentView,
|
||||
CFArrayRef& inPresets,
|
||||
Point inLocation,
|
||||
int nameWidth,
|
||||
int controlWidth,
|
||||
Point inLocation,
|
||||
int nameWidth,
|
||||
int controlWidth,
|
||||
ControlFontStyleRec & inFontStyle)
|
||||
: AUPropertyControl (inParentView),
|
||||
mPresets (inPresets),
|
||||
@@ -510,13 +510,13 @@ AUVPresets::AUVPresets (AUCarbonViewBase* inParentView,
|
||||
{
|
||||
#if !__LP64__
|
||||
Rect r;
|
||||
|
||||
|
||||
// ok we now have an array of factory presets
|
||||
// get their strings and display them
|
||||
|
||||
r.top = inLocation.v; r.bottom = r.top;
|
||||
r.left = inLocation.h; r.right = r.left;
|
||||
|
||||
|
||||
// localize as necessary
|
||||
if (!sAUVPresetLocalized) {
|
||||
CFBundleRef mainBundle = CFBundleGetBundleWithIdentifier(kLocalizedStringBundle_AUView);
|
||||
@@ -527,86 +527,86 @@ AUVPresets::AUVPresets (AUCarbonViewBase* inParentView,
|
||||
sAUVPresetLocalized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// create localized title string
|
||||
CFMutableStringRef factoryPresetsTitle = CFStringCreateMutable(NULL, 0);
|
||||
CFStringAppend(factoryPresetsTitle, kStringFactoryPreset);
|
||||
CFStringAppend(factoryPresetsTitle, kAUViewUnlocalizedString_TitleSeparator);
|
||||
|
||||
|
||||
ControlRef theControl;
|
||||
verify_noerr(CreateStaticTextControl(mView->GetCarbonWindow(), &r, factoryPresetsTitle, &inFontStyle, &theControl));
|
||||
SInt16 width = 0;
|
||||
AUCarbonViewControl::SizeControlToFit(theControl, &width, &mHeight);
|
||||
CFRelease(factoryPresetsTitle);
|
||||
EmbedControl(theControl);
|
||||
|
||||
|
||||
r.top -= 2;
|
||||
r.left += width + 10;
|
||||
r.right = r.left;
|
||||
r.bottom = r.top;
|
||||
|
||||
verify_noerr(CreatePopupButtonControl ( mView->GetCarbonWindow(), &r, NULL,
|
||||
|
||||
verify_noerr(CreatePopupButtonControl ( mView->GetCarbonWindow(), &r, NULL,
|
||||
-12345, // DON'T GET MENU FROM RESOURCE mMenuID,!!!
|
||||
FALSE, // variableWidth,
|
||||
0, // titleWidth,
|
||||
0, // titleJustification,
|
||||
0, // titleStyle,
|
||||
FALSE, // variableWidth,
|
||||
0, // titleWidth,
|
||||
0, // titleJustification,
|
||||
0, // titleStyle,
|
||||
&mControl));
|
||||
|
||||
|
||||
MenuRef menuRef;
|
||||
verify_noerr(CreateNewMenu(1, 0, &menuRef));
|
||||
|
||||
|
||||
int numPresets = CFArrayGetCount(mPresets);
|
||||
|
||||
|
||||
for (int i = 0; i < numPresets; ++i)
|
||||
{
|
||||
AUPreset* preset = (AUPreset*) CFArrayGetValueAtIndex (mPresets, i);
|
||||
verify_noerr(AppendMenuItemTextWithCFString (menuRef, preset->presetName, 0, 0, 0));
|
||||
}
|
||||
|
||||
|
||||
verify_noerr(SetControlData(mControl, 0, kControlPopupButtonMenuRefTag, sizeof(menuRef), &menuRef));
|
||||
verify_noerr (SetControlFontStyle (mControl, &inFontStyle));
|
||||
|
||||
|
||||
SetControl32BitMaximum (mControl, numPresets);
|
||||
|
||||
|
||||
// size popup
|
||||
SInt16 height = 0;
|
||||
|
||||
|
||||
AUCarbonViewControl::SizeControlToFit(mControl, &width, &height);
|
||||
|
||||
|
||||
if (height > mHeight) mHeight = height;
|
||||
if (mHeight < 0) mHeight = 0;
|
||||
|
||||
|
||||
// find which menu item is the Default preset
|
||||
UInt32 propertySize = sizeof(AUPreset);
|
||||
AUPreset defaultPreset;
|
||||
OSStatus result = AudioUnitGetProperty (mView->GetEditAudioUnit(),
|
||||
OSStatus result = AudioUnitGetProperty (mView->GetEditAudioUnit(),
|
||||
kAudioUnitProperty_PresentPreset,
|
||||
kAudioUnitScope_Global,
|
||||
0,
|
||||
&defaultPreset,
|
||||
kAudioUnitScope_Global,
|
||||
0,
|
||||
&defaultPreset,
|
||||
&propertySize);
|
||||
|
||||
|
||||
mPropertyID = kAudioUnitProperty_PresentPreset;
|
||||
#endif
|
||||
#endif
|
||||
#ifndef __LP64__
|
||||
if (result != noErr) { // if the PresentPreset property is not implemented, fall back to the CurrentPreset property
|
||||
OSStatus result = AudioUnitGetProperty (mView->GetEditAudioUnit(),
|
||||
OSStatus result = AudioUnitGetProperty (mView->GetEditAudioUnit(),
|
||||
kAudioUnitProperty_CurrentPreset,
|
||||
kAudioUnitScope_Global,
|
||||
0,
|
||||
&defaultPreset,
|
||||
kAudioUnitScope_Global,
|
||||
0,
|
||||
&defaultPreset,
|
||||
&propertySize);
|
||||
mPropertyID = kAudioUnitProperty_CurrentPreset;
|
||||
if (result == noErr)
|
||||
CFRetain (defaultPreset.presetName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if !__LP64__
|
||||
#if !__LP64__
|
||||
EmbedControl (mControl);
|
||||
|
||||
|
||||
HandlePropertyChange(defaultPreset);
|
||||
|
||||
|
||||
RegisterEvents();
|
||||
#endif
|
||||
}
|
||||
@@ -620,7 +620,7 @@ void AUVPresets::AddInterest (AUEventListenerRef inListener,
|
||||
e.mArgument.mProperty.mPropertyID = mPropertyID;
|
||||
e.mArgument.mProperty.mScope = kAudioUnitScope_Global;
|
||||
e.mArgument.mProperty.mElement = 0;
|
||||
|
||||
|
||||
AUEventListenerAddEventType(inListener, inObject, &e);
|
||||
}
|
||||
|
||||
@@ -644,14 +644,14 @@ void AUVPresets::HandleControlChange ()
|
||||
if (i > 0)
|
||||
{
|
||||
AUPreset* preset = (AUPreset*) CFArrayGetValueAtIndex (mPresets, i-1);
|
||||
|
||||
verify_noerr(AudioUnitSetProperty (mView->GetEditAudioUnit(),
|
||||
|
||||
verify_noerr(AudioUnitSetProperty (mView->GetEditAudioUnit(),
|
||||
mPropertyID, // either currentPreset or PresentPreset depending on which is supported
|
||||
kAudioUnitScope_Global,
|
||||
0,
|
||||
preset,
|
||||
kAudioUnitScope_Global,
|
||||
0,
|
||||
preset,
|
||||
sizeof(AUPreset)));
|
||||
|
||||
|
||||
// when we change a preset we can't expect the AU to update its state
|
||||
// as it isn't meant to know that its being viewed!
|
||||
// so we broadcast a notification to all listeners that all parameters on this AU have changed
|
||||
@@ -663,12 +663,12 @@ void AUVPresets::HandleControlChange ()
|
||||
#endif
|
||||
}
|
||||
|
||||
void AUVPresets::HandlePropertyChange(AUPreset &preset)
|
||||
void AUVPresets::HandlePropertyChange(AUPreset &preset)
|
||||
{
|
||||
#if !__LP64__
|
||||
// check to see if the preset is in our menu
|
||||
int numPresets = CFArrayGetCount(mPresets);
|
||||
if (preset.presetNumber < 0) {
|
||||
if (preset.presetNumber < 0) {
|
||||
SetControl32BitValue (mControl, 0); //controls are one-based
|
||||
} else {
|
||||
for (SInt32 i = 0; i < numPresets; ++i) {
|
||||
@@ -679,7 +679,7 @@ void AUVPresets::HandlePropertyChange(AUPreset &preset)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (preset.presetName)
|
||||
CFRelease (preset.presetName);
|
||||
#endif
|
||||
@@ -687,16 +687,16 @@ void AUVPresets::HandlePropertyChange(AUPreset &preset)
|
||||
|
||||
bool AUVPresets::HandlePropertyChange (const AudioUnitProperty &inProp)
|
||||
{
|
||||
if (inProp.mPropertyID == mPropertyID)
|
||||
if (inProp.mPropertyID == mPropertyID)
|
||||
{
|
||||
UInt32 theSize = sizeof(AUPreset);
|
||||
AUPreset currentPreset;
|
||||
|
||||
OSStatus result = AudioUnitGetProperty(inProp.mAudioUnit,
|
||||
inProp.mPropertyID,
|
||||
inProp.mScope,
|
||||
|
||||
OSStatus result = AudioUnitGetProperty(inProp.mAudioUnit,
|
||||
inProp.mPropertyID,
|
||||
inProp.mScope,
|
||||
inProp.mElement, ¤tPreset, &theSize);
|
||||
|
||||
|
||||
if (result == noErr) {
|
||||
#ifndef __LP64__
|
||||
if (inProp.mPropertyID == kAudioUnitProperty_CurrentPreset && currentPreset.presetName)
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUCarbonViewControl.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUCarbonViewControl_h__
|
||||
#define __AUCarbonViewControl_h__
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
kTypeDiscrete, // e.g. pop-up menu
|
||||
kTypeText
|
||||
};
|
||||
|
||||
|
||||
AUCarbonViewControl(AUCarbonViewBase *ownerView, AUParameterListenerRef listener, ControlType type, const CAAUParameter ¶m, ControlRef control);
|
||||
~AUCarbonViewControl();
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
virtual void ControlToParameter();
|
||||
/*! @method ParameterToControl */
|
||||
virtual void ParameterToControl(Float32 newValue);
|
||||
|
||||
|
||||
/*! @method SetValueFract */
|
||||
virtual void SetValueFract(double value);
|
||||
/*! @method GetValueFract */
|
||||
@@ -93,34 +93,34 @@ public:
|
||||
virtual void SetValue(long value);
|
||||
/*! @method GetValue */
|
||||
virtual long GetValue();
|
||||
|
||||
|
||||
/*! @method GetOwnerView */
|
||||
AUCarbonViewBase * GetOwnerView() {return mOwnerView;}
|
||||
|
||||
/*! @method Update */
|
||||
void Update (bool inUIThread)
|
||||
{
|
||||
void Update (bool inUIThread)
|
||||
{
|
||||
if (inUIThread)
|
||||
ParameterToControl (mParam.GetValue());
|
||||
else
|
||||
AUParameterListenerNotify (mListener, this, &mParam);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// CarbonEventHandler overrides
|
||||
/*! @method HandleEvent */
|
||||
virtual bool HandleEvent(EventHandlerCallRef inHandlerRef, EventRef event);
|
||||
|
||||
|
||||
/*! @method ControlRef */
|
||||
operator ControlRef() { return mControl; }
|
||||
|
||||
|
||||
/*! @method SizeControlToFit */
|
||||
static Boolean SizeControlToFit(ControlRef inControl, SInt16 *outWidth = NULL, SInt16 *outHeight = NULL);
|
||||
|
||||
|
||||
/*! @method SliderTrackProc */
|
||||
static pascal void SliderTrackProc(ControlRef theControl, ControlPartCode partCode);
|
||||
/*! @method NumericKeyFilterCallback */
|
||||
static pascal ControlKeyFilterResult NumericKeyFilterCallback(ControlRef theControl, SInt16 *keyCode, SInt16 *charCode,
|
||||
static pascal ControlKeyFilterResult NumericKeyFilterCallback(ControlRef theControl, SInt16 *keyCode, SInt16 *charCode,
|
||||
EventModifiers *modifiers);
|
||||
protected:
|
||||
/*! @method ParamInfo */
|
||||
@@ -137,12 +137,12 @@ protected:
|
||||
|
||||
/*! @var mControl */
|
||||
ControlRef mControl;
|
||||
|
||||
|
||||
/*! @method StdKeyFilterCallback */
|
||||
static pascal ControlKeyFilterResult StdKeyFilterCallback(ControlRef theControl, SInt16 *keyCode, SInt16 *charCode,
|
||||
static pascal ControlKeyFilterResult StdKeyFilterCallback(ControlRef theControl, SInt16 *keyCode, SInt16 *charCode,
|
||||
EventModifiers *modifiers);
|
||||
SInt16 mInControlInitialization;
|
||||
|
||||
|
||||
static AUCarbonViewControl* mLastControl;
|
||||
};
|
||||
|
||||
@@ -151,34 +151,34 @@ class AUPropertyControl : public CarbonEventHandler {
|
||||
public:
|
||||
/*! @ctor AUPropertyControl */
|
||||
AUPropertyControl (AUCarbonViewBase * inBase) : mControl(0), mView (inBase), mHeight(0) {}
|
||||
|
||||
|
||||
/*! @method HandleEvent */
|
||||
virtual bool HandleEvent(EventHandlerCallRef inHandlerRef, EventRef event);
|
||||
|
||||
/*! @method HandlePropertyChange */
|
||||
virtual bool HandlePropertyChange (const AudioUnitProperty &inProp) = 0;
|
||||
|
||||
|
||||
/*! @method AddInterest */
|
||||
virtual void AddInterest (AUEventListenerRef inListener,
|
||||
void * inObject) = 0;
|
||||
|
||||
|
||||
/*! @method RemoveInterest */
|
||||
virtual void RemoveInterest (AUEventListenerRef inListener,
|
||||
void * inObject) = 0;
|
||||
|
||||
|
||||
/*! @method GetHeight */
|
||||
int GetHeight() { return mHeight;}
|
||||
|
||||
|
||||
protected:
|
||||
/*! @method HandleControlChange */
|
||||
virtual void HandleControlChange () = 0;
|
||||
virtual void HandleControlChange () = 0;
|
||||
|
||||
/*! @method RegisterEvents */
|
||||
void RegisterEvents ();
|
||||
|
||||
/*! @method EmbedControl */
|
||||
void EmbedControl (ControlRef theControl);
|
||||
|
||||
|
||||
/*! @method GetCarbonWindow */
|
||||
WindowRef GetCarbonWindow();
|
||||
|
||||
@@ -194,30 +194,30 @@ protected:
|
||||
class AUVPresets : public AUPropertyControl {
|
||||
public:
|
||||
/*! @ctor HandleControlChange */
|
||||
AUVPresets (AUCarbonViewBase * inBase,
|
||||
AUVPresets (AUCarbonViewBase * inBase,
|
||||
CFArrayRef& inPresets,
|
||||
Point inLocation,
|
||||
int nameWidth,
|
||||
int controlWidth,
|
||||
Point inLocation,
|
||||
int nameWidth,
|
||||
int controlWidth,
|
||||
ControlFontStyleRec & inFontStyle);
|
||||
|
||||
virtual ~AUVPresets () { CFRelease (mPresets); }
|
||||
|
||||
/*! @method HandlePropertyChange */
|
||||
virtual bool HandlePropertyChange (const AudioUnitProperty &inProp);
|
||||
|
||||
|
||||
/*! @method AddInterest */
|
||||
virtual void AddInterest (AUEventListenerRef inListener,
|
||||
void * inObject);
|
||||
|
||||
|
||||
/*! @method RemoveInterest */
|
||||
virtual void RemoveInterest (AUEventListenerRef inListener,
|
||||
void * inObject);
|
||||
|
||||
protected:
|
||||
/*! @method HandleControlChange */
|
||||
virtual void HandleControlChange ();
|
||||
|
||||
virtual void HandleControlChange ();
|
||||
|
||||
/*! @var mPresets */
|
||||
CFArrayRef mPresets;
|
||||
/*! @var mView */
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUCarbonViewDispatch.cpp
|
||||
Abstract: AUCarbonViewDispatch.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUCarbonViewBase.h"
|
||||
|
||||
@@ -93,7 +93,7 @@ OSStatus AUCarbonViewBase::ComponentEntryDispatch(ComponentParameters *p, AUCar
|
||||
if (This == NULL) return paramErr;
|
||||
|
||||
OSStatus result = noErr;
|
||||
|
||||
|
||||
switch (p->what) {
|
||||
case kAudioUnitCarbonViewCreateSelect:
|
||||
{
|
||||
@@ -104,7 +104,7 @@ OSStatus AUCarbonViewBase::ComponentEntryDispatch(ComponentParameters *p, AUCar
|
||||
CheckNull(pb->inSize);
|
||||
CheckNull(pb->inLocation);
|
||||
CheckNull(pb->outControl);
|
||||
result = This->CreateCarbonView(pb->inAudioUnit, pb->inWindow, pb->inParentControl,
|
||||
result = This->CreateCarbonView(pb->inAudioUnit, pb->inWindow, pb->inParentControl,
|
||||
*pb->inLocation, *pb->inSize, *pb->outControl);
|
||||
}
|
||||
break;
|
||||
@@ -116,7 +116,7 @@ OSStatus AUCarbonViewBase::ComponentEntryDispatch(ComponentParameters *p, AUCar
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
default:
|
||||
result = ComponentBase::ComponentEntryDispatch(p, This);
|
||||
break;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUControlGroup.cpp
|
||||
Abstract: AUControlGroup.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include <Carbon/Carbon.h>
|
||||
#include "AUCarbonViewBase.h"
|
||||
@@ -59,10 +59,10 @@ static bool sLocalized = false;
|
||||
#endif
|
||||
|
||||
void AUControlGroup::CreateLabelledSlider(
|
||||
AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
Point labelSize,
|
||||
AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
Point labelSize,
|
||||
const ControlFontStyleRec & inFontStyle)
|
||||
{
|
||||
#if !__LP64__
|
||||
@@ -73,14 +73,14 @@ void AUControlGroup::CreateLabelledSlider(
|
||||
CFStringRef cfstr;
|
||||
int sliderValueMax, sliderValueMin, sliderValueDefault;
|
||||
AUCarbonViewControl::ControlType sliderType;
|
||||
|
||||
|
||||
bool horizontal = (width > height);
|
||||
|
||||
if (horizontal) {
|
||||
maxValRect.top = minValRect.top = area.top + (height - labelSize.v) / 2;
|
||||
minValRect.left = area.left;
|
||||
maxValRect.left = area.right - labelSize.h;
|
||||
|
||||
|
||||
minValRect.bottom = minValRect.top + labelSize.v;
|
||||
minValRect.right = minValRect.left + labelSize.h;
|
||||
maxValRect.bottom = maxValRect.top + labelSize.v;
|
||||
@@ -104,12 +104,12 @@ void AUControlGroup::CreateLabelledSlider(
|
||||
maxValRect.left = minValRect.left = area.left + (width - labelSize.h) / 2;
|
||||
maxValRect.top = area.top;
|
||||
minValRect.top = area.bottom - labelSize.v;
|
||||
|
||||
|
||||
minValRect.bottom = minValRect.top + labelSize.v;
|
||||
minValRect.right = minValRect.left + labelSize.h;
|
||||
maxValRect.bottom = maxValRect.top + labelSize.v;
|
||||
maxValRect.right = maxValRect.left + labelSize.h;
|
||||
|
||||
|
||||
sliderRect.left = area.left + (width - kSliderThinDimension) / 2;
|
||||
sliderRect.right = sliderRect.left + kSliderThinDimension + 4;
|
||||
sliderRect.top = maxValRect.bottom + kLabelAndSliderSpacing;
|
||||
@@ -117,7 +117,7 @@ void AUControlGroup::CreateLabelledSlider(
|
||||
|
||||
if (auvp.IsIndexedParam ()) {
|
||||
sliderValueMin = sliderValueDefault = int(auvp.ParamInfo().minValue);
|
||||
sliderValueMax = int(auvp.ParamInfo().maxValue);
|
||||
sliderValueMax = int(auvp.ParamInfo().maxValue);
|
||||
sliderType = AUCarbonViewControl::kTypeDiscrete;
|
||||
} else {
|
||||
sliderValueMin = sliderValueDefault = 0;
|
||||
@@ -134,7 +134,7 @@ void AUControlGroup::CreateLabelledSlider(
|
||||
verify_noerr(CreateStaticTextControl(auView->GetCarbonWindow(), &minValRect, cfstr, &fontStyle, &newControl));
|
||||
CFRelease(cfstr);
|
||||
verify_noerr(auView->EmbedControl(newControl));
|
||||
|
||||
|
||||
// maximum value label
|
||||
cfstr = auvp.GetStringFromValueCopy(&auvp.ParamInfo().maxValue);
|
||||
fontStyle.just = horizontal ? teFlushLeft : teCenter;
|
||||
@@ -142,7 +142,7 @@ void AUControlGroup::CreateLabelledSlider(
|
||||
CFRelease(cfstr);
|
||||
verify_noerr(auView->EmbedControl(newControl));
|
||||
}
|
||||
|
||||
|
||||
// slider
|
||||
verify_noerr(CreateSliderControl(auView->GetCarbonWindow(), &sliderRect, sliderValueDefault, sliderValueMin, sliderValueMax, kControlSliderDoesNotPoint, 0, true, AUCarbonViewControl::SliderTrackProc, &newControl));
|
||||
|
||||
@@ -154,10 +154,10 @@ void AUControlGroup::CreateLabelledSlider(
|
||||
}
|
||||
|
||||
void AUControlGroup::CreateLabelledSliderAndEditText(
|
||||
AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
Point labelSize,
|
||||
AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
Point labelSize,
|
||||
Point editTextSize,
|
||||
const ControlFontStyleRec & inFontStyle)
|
||||
{
|
||||
@@ -166,7 +166,7 @@ void AUControlGroup::CreateLabelledSliderAndEditText(
|
||||
Rect sliderArea, textArea;
|
||||
ControlRef newControl;
|
||||
int width = area.right - area.left, height = area.bottom - area.top;
|
||||
|
||||
|
||||
bool horizontal = (width > height);
|
||||
|
||||
sliderArea = area;
|
||||
@@ -188,55 +188,55 @@ void AUControlGroup::CreateLabelledSliderAndEditText(
|
||||
textArea.right = textArea.left + editTextSize.h;
|
||||
}
|
||||
CreateLabelledSlider(auView, auvp, sliderArea, labelSize, fontStyle);
|
||||
|
||||
verify_noerr(CreateEditUnicodeTextControl(auView->GetCarbonWindow(), &textArea, CFSTR(""), false,
|
||||
|
||||
verify_noerr(CreateEditUnicodeTextControl(auView->GetCarbonWindow(), &textArea, CFSTR(""), false,
|
||||
&fontStyle, &newControl));
|
||||
auView->AddCarbonControl(AUCarbonViewControl::kTypeText, auvp, newControl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AUControlGroup::CreatePopupMenu (AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
void AUControlGroup::CreatePopupMenu (AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
const ControlFontStyleRec & inFontStyle,
|
||||
const bool inSizeToFit)
|
||||
{
|
||||
#if !__LP64__
|
||||
ControlRef thePopUp;
|
||||
|
||||
verify_noerr(CreatePopupButtonControl (auView->GetCarbonWindow(), &area, NULL,
|
||||
|
||||
verify_noerr(CreatePopupButtonControl (auView->GetCarbonWindow(), &area, NULL,
|
||||
-12345, // DON'T GET MENU FROM RESOURCE mMenuID
|
||||
FALSE, // variableWidth,
|
||||
0, // titleWidth,
|
||||
0, // titleJustification,
|
||||
0, // titleStyle,
|
||||
FALSE, // variableWidth,
|
||||
0, // titleWidth,
|
||||
0, // titleJustification,
|
||||
0, // titleStyle,
|
||||
&thePopUp));
|
||||
|
||||
|
||||
ControlSize small = kControlSizeSmall;
|
||||
SetControlData(thePopUp, kControlEntireControl, kControlSizeTag, sizeof(ControlSize), &small);
|
||||
|
||||
|
||||
MenuRef menuRef;
|
||||
verify_noerr(CreateNewMenu( 1, 0, &menuRef));
|
||||
|
||||
|
||||
for (int i = 0; i < auvp.GetNumIndexedParams(); ++i) {
|
||||
verify_noerr(AppendMenuItemTextWithCFString (menuRef, auvp.GetParamName(i), kMenuItemAttrIgnoreMeta, 0, 0));
|
||||
}
|
||||
|
||||
|
||||
verify_noerr(SetControlData(thePopUp, 0, kControlPopupButtonMenuRefTag, sizeof(menuRef), &menuRef));
|
||||
SetControl32BitMaximum(thePopUp, auvp.GetNumIndexedParams());
|
||||
|
||||
verify_noerr (SetControlFontStyle (thePopUp, &inFontStyle));
|
||||
|
||||
|
||||
if (inSizeToFit) {
|
||||
AUCarbonViewControl::SizeControlToFit(thePopUp);
|
||||
}
|
||||
|
||||
|
||||
auView->AddCarbonControl(AUCarbonViewControl::kTypeDiscrete, auvp, thePopUp);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
|
||||
const Point & inLocation,
|
||||
void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
|
||||
const Point & inLocation,
|
||||
const SInt16 inRightOffset,
|
||||
const SInt16 inTotalWidth)
|
||||
{
|
||||
@@ -245,14 +245,14 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
|
||||
ComponentDescription desc;
|
||||
Handle h1 = NewHandleClear(4);
|
||||
OSStatus err = GetComponentInfo ((Component)auView->GetEditAudioUnit(), &desc, h1, 0, 0);
|
||||
|
||||
if (err == noErr) {
|
||||
|
||||
if (err == noErr) {
|
||||
// Get the manufacturer's name... look for the ':' character convention
|
||||
HLock(h1);
|
||||
char* ptr1 = *h1;
|
||||
int len = *ptr1++;
|
||||
char* displayStr = 0;
|
||||
|
||||
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (ptr1[i] == ':') { // found the name
|
||||
ptr1[i++] = 0;
|
||||
@@ -260,7 +260,7 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// localize as necessary:
|
||||
if (!sLocalized) {
|
||||
CFBundleRef mainBundle = CFBundleGetBundleWithIdentifier(kLocalizedStringBundle_AUView);
|
||||
@@ -271,7 +271,7 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
|
||||
sLocalized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// display strings
|
||||
ControlRef newControl;
|
||||
Rect r;
|
||||
@@ -279,7 +279,7 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
|
||||
ControlFontStyleRec fontStyle;
|
||||
fontStyle.flags = kControlUseFontMask | kControlUseJustMask;
|
||||
fontStyle.font = kControlFontSmallBoldSystemFont;
|
||||
|
||||
|
||||
// display manufacturer string
|
||||
if (displayStr) {
|
||||
CFMutableStringRef mfrstring = CFStringCreateMutable(NULL, 0);
|
||||
@@ -291,15 +291,15 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
|
||||
CFStringAppend(mfrstring, mfrname); // "Manufacturer: MFRName"
|
||||
CFRelease (mfrname);
|
||||
}
|
||||
|
||||
r.left = inLocation.h + inRightOffset;
|
||||
|
||||
r.left = inLocation.h + inRightOffset;
|
||||
r.right = inLocation.h + inTotalWidth - 28;
|
||||
fontStyle.just = teFlushRight;
|
||||
|
||||
|
||||
verify_noerr(CreateStaticTextControl(auView->GetCarbonWindow(), &r, mfrstring, &fontStyle, &newControl));
|
||||
verify_noerr(auView->EmbedControl(newControl));
|
||||
CFRelease (mfrstring);
|
||||
|
||||
|
||||
//move displayStr ptr past the manu, to the name
|
||||
// we move the characters down an index, because the handle doesn't have any room
|
||||
// at the end for the \0
|
||||
@@ -316,42 +316,42 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
|
||||
displayStr[j] = displayStr[i];
|
||||
++j; ++i;
|
||||
} while (i < len);
|
||||
|
||||
|
||||
displayStr[j] = 0;
|
||||
}
|
||||
|
||||
|
||||
// display AudioUnit string
|
||||
r.left = inLocation.h; r.right = r.left + inRightOffset;
|
||||
fontStyle.just = 0;
|
||||
|
||||
|
||||
CFMutableStringRef cfstr = CFStringCreateMutable(NULL, 0);
|
||||
CFStringAppend(cfstr, kAUViewLocalizedStringKey_AudioUnit); // "Audio Unit"
|
||||
CFStringAppend(cfstr, kAUViewUnlocalizedString_TitleSeparator);
|
||||
// "Audio Unit: "
|
||||
|
||||
|
||||
CFStringRef auname = CFStringCreateWithCString(NULL, displayStr, kCFStringEncodingUTF8);
|
||||
CFStringAppend(cfstr, auname); // "Audio Unit: AUName"
|
||||
CFRelease (auname);
|
||||
|
||||
|
||||
verify_noerr(CreateStaticTextControl(auView->GetCarbonWindow(), &r, cfstr, &fontStyle, &newControl));
|
||||
|
||||
|
||||
// size text control correctly
|
||||
Boolean bValue = false;
|
||||
SetControlData(newControl, kControlEntireControl, 'stim' /* kControlStaticTextIsMultilineTag */, sizeof(Boolean), &bValue);
|
||||
SInt16 baseLineOffset;
|
||||
Rect bestRect;
|
||||
err = GetBestControlRect(newControl, &bestRect, &baseLineOffset);
|
||||
err = GetBestControlRect(newControl, &bestRect, &baseLineOffset);
|
||||
if (err == noErr)
|
||||
{
|
||||
int width = (bestRect.right - bestRect.left) + 1;
|
||||
int height = (bestRect.bottom - bestRect.top) + 1;
|
||||
SizeControl (newControl, width, height);
|
||||
}
|
||||
|
||||
|
||||
verify_noerr(auView->EmbedControl(newControl));
|
||||
CFRelease (cfstr);
|
||||
}
|
||||
|
||||
|
||||
DisposeHandle (h1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUControlGroup.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUControlGroup_h__
|
||||
#define __AUControlGroup_h__
|
||||
@@ -57,31 +57,31 @@ class CAAUParameter;
|
||||
class AUControlGroup {
|
||||
public:
|
||||
/*! @method CreateLabelledSlider */
|
||||
static void CreateLabelledSlider( AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
Point labelSize,
|
||||
static void CreateLabelledSlider( AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
Point labelSize,
|
||||
const ControlFontStyleRec & fontStyle);
|
||||
|
||||
/*! @method CreateLabelledSliderAndEditText */
|
||||
static void CreateLabelledSliderAndEditText(
|
||||
AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
Point labelSize,
|
||||
AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
Point labelSize,
|
||||
Point editTextSize,
|
||||
const ControlFontStyleRec & fontStyle);
|
||||
|
||||
/*! @method CreatePopupMenu */
|
||||
static void CreatePopupMenu ( AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
static void CreatePopupMenu ( AUCarbonViewBase * auView,
|
||||
const CAAUParameter & auvp,
|
||||
const Rect & area,
|
||||
const ControlFontStyleRec & inFontStyle,
|
||||
const bool inSizeToFit = false);
|
||||
|
||||
/*! @method AddAUInfo */
|
||||
static void AddAUInfo ( AUCarbonViewBase * auView,
|
||||
const Point & inLocation,
|
||||
static void AddAUInfo ( AUCarbonViewBase * auView,
|
||||
const Point & inLocation,
|
||||
const SInt16 inRightOffset,
|
||||
const SInt16 inTotalWidth);
|
||||
};
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: CarbonEventHandler.cpp
|
||||
Abstract: CarbonEventHandler.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "CarbonEventHandler.h"
|
||||
|
||||
@@ -65,22 +65,22 @@ CarbonEventHandler::~CarbonEventHandler()
|
||||
int count = static_cast<int>(CFDictionaryGetCount(mHandlers));
|
||||
EventHandlerRef *theHandlers = (EventHandlerRef*) malloc(count * sizeof(EventHandlerRef));
|
||||
CFDictionaryGetKeysAndValues(mHandlers, NULL, (const void **)theHandlers);
|
||||
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
RemoveEventHandler(theHandlers[i]);
|
||||
CFDictionaryRemoveAllValues(mHandlers);
|
||||
CFRelease (mHandlers);
|
||||
free(theHandlers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CarbonEventHandler::WantEventTypes(EventTargetRef target, UInt32 inNumTypes, const EventTypeSpec *inList)
|
||||
{
|
||||
if (mHandlers == NULL)
|
||||
mHandlers = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
|
||||
|
||||
|
||||
EventHandlerRef handler;
|
||||
|
||||
|
||||
if (CFDictionaryGetValueIfPresent (mHandlers, target, (const void **)&handler)) // if there is already a handler for the target, add the type
|
||||
verify_noerr(AddEventTypesToHandler(handler, inNumTypes, inList));
|
||||
else {
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: CarbonEventHandler.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __CarbonEventHandler_h__
|
||||
#define __CarbonEventHandler_h__
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
CarbonEventHandler();
|
||||
/*! @dtor ~CarbonEventHandler */
|
||||
virtual ~CarbonEventHandler();
|
||||
|
||||
|
||||
/*! @method WantEventTypes */
|
||||
virtual void WantEventTypes(EventTargetRef target, UInt32 inNumTypes, const EventTypeSpec *inList);
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUInstrumentBase.cpp
|
||||
Abstract: AUInstrumentBase.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUInstrumentBase.h"
|
||||
#include "AUMIDIDefs.h"
|
||||
@@ -58,12 +58,12 @@
|
||||
const UInt32 kEventQueueSize = 1024;
|
||||
|
||||
AUInstrumentBase::AUInstrumentBase(
|
||||
AudioComponentInstance inInstance,
|
||||
AudioComponentInstance inInstance,
|
||||
UInt32 numInputs,
|
||||
UInt32 numOutputs,
|
||||
UInt32 numGroups,
|
||||
UInt32 numParts)
|
||||
: MusicDeviceBase(inInstance, numInputs, numOutputs, numGroups),
|
||||
: MusicDeviceBase(inInstance, numInputs, numOutputs, numGroups),
|
||||
mAbsoluteSampleFrame(0),
|
||||
mEventQueue(kEventQueueSize),
|
||||
mNumNotes(0),
|
||||
@@ -79,7 +79,7 @@ AUInstrumentBase::AUInstrumentBase(
|
||||
mFreeNotes.mState = kNoteState_Free;
|
||||
SetWantsRenderThreadID(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
AUInstrumentBase::~AUInstrumentBase()
|
||||
{
|
||||
@@ -100,12 +100,12 @@ AUElement * AUInstrumentBase::CreateElement(AudioUnitScope inScope, AudioUnitEle
|
||||
return MusicDeviceBase::CreateElement(inScope, element);
|
||||
}
|
||||
|
||||
void AUInstrumentBase::CreateExtendedElements()
|
||||
void AUInstrumentBase::CreateExtendedElements()
|
||||
{
|
||||
Parts().Initialize(this, kAudioUnitScope_Part, mInitNumPartEls);
|
||||
}
|
||||
|
||||
AUScope * AUInstrumentBase::GetScopeExtended (AudioUnitScope inScope)
|
||||
AUScope * AUInstrumentBase::GetScopeExtended (AudioUnitScope inScope)
|
||||
{
|
||||
if (inScope == kAudioUnitScope_Part)
|
||||
return &mPartScope;
|
||||
@@ -122,7 +122,7 @@ void AUInstrumentBase::SetNotes(UInt32 inNumNotes, UInt32 inMaxActiveNotes, Syn
|
||||
mMaxActiveNotes = inMaxActiveNotes;
|
||||
mNoteSize = inNoteDataSize;
|
||||
mNotes = inNotes;
|
||||
|
||||
|
||||
for (UInt32 i=0; i<mNumNotes; ++i)
|
||||
{
|
||||
SynthNote *note = GetNote(i);
|
||||
@@ -138,7 +138,7 @@ UInt32 AUInstrumentBase::CountActiveNotes()
|
||||
for (UInt32 i=0; i<mNumNotes; ++i)
|
||||
{
|
||||
SynthNote *note = GetNote(i);
|
||||
if (note->GetState() <= kNoteState_Released)
|
||||
if (note->GetState() <= kNoteState_Released)
|
||||
sum++;
|
||||
}
|
||||
return sum;
|
||||
@@ -165,16 +165,16 @@ OSStatus AUInstrumentBase::Initialize()
|
||||
TO DO:
|
||||
Currently ValidFormat will check and validate that the num channels is not being
|
||||
changed if the AU doesn't support the SupportedNumChannels property - which is correct
|
||||
|
||||
|
||||
What needs to happen here is that IFF the AU does support this property, (ie, the AU
|
||||
can be configured to have different num channels than its original configuration) then
|
||||
the state of the AU at Initialization needs to be validated.
|
||||
|
||||
|
||||
This is work still to be done - see AUEffectBase for the kind of logic that needs to be applied here
|
||||
*/
|
||||
|
||||
// override to call SetNotes
|
||||
|
||||
|
||||
mNoteIDCounter = 128; // reset this every time we initialise
|
||||
mAbsoluteSampleFrame = 0;
|
||||
return noErr;
|
||||
@@ -199,7 +199,7 @@ OSStatus AUInstrumentBase::Reset( AudioUnitScope inScope,
|
||||
for (UInt32 i=0; i<mNumNotes; ++i)
|
||||
{
|
||||
SynthNote *note = GetNote(i);
|
||||
if (note->IsSounding())
|
||||
if (note->IsSounding())
|
||||
note->Kill(0);
|
||||
note->ListRemove();
|
||||
mFreeNotes.AddNote(note);
|
||||
@@ -225,7 +225,7 @@ void AUInstrumentBase::PerformEvents(const AudioTimeStamp& inTimeStamp)
|
||||
#endif
|
||||
SynthEvent *event;
|
||||
SynthGroupElement *group;
|
||||
|
||||
|
||||
while ((event = mEventQueue.ReadItem()) != NULL)
|
||||
{
|
||||
#if DEBUG_PRINT_RENDER
|
||||
@@ -270,12 +270,12 @@ void AUInstrumentBase::PerformEvents(const AudioTimeStamp& inTimeStamp)
|
||||
group->ResetAllControllers(event->GetOffsetSampleFrame());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
mEventQueue.AdvanceReadPtr();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSStatus AUInstrumentBase::Render( AudioUnitRenderActionFlags & ioActionFlags,
|
||||
const AudioTimeStamp & inTimeStamp,
|
||||
UInt32 inNumberFrames)
|
||||
@@ -311,18 +311,18 @@ OSStatus AUInstrumentBase::Render( AudioUnitRenderActionFlags & ioActionFlag
|
||||
bool AUInstrumentBase::ValidFormat( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
const CAStreamBasicDescription & inNewFormat)
|
||||
{
|
||||
{
|
||||
// if the AU supports this, then we should just let this go through to the Init call
|
||||
if (SupportedNumChannels (NULL))
|
||||
if (SupportedNumChannels (NULL))
|
||||
return MusicDeviceBase::ValidFormat(inScope, inElement, inNewFormat);
|
||||
|
||||
bool isGood = MusicDeviceBase::ValidFormat (inScope, inElement, inNewFormat);
|
||||
if (!isGood) return false;
|
||||
|
||||
|
||||
// if we get to here, then the basic criteria is that the
|
||||
// num channels cannot change on an existing bus
|
||||
AUIOElement *el = GetIOElement (inScope, inElement);
|
||||
return (el->GetStreamFormat().NumberChannels() == inNewFormat.NumberChannels());
|
||||
return (el->GetStreamFormat().NumberChannels() == inNewFormat.NumberChannels());
|
||||
}
|
||||
|
||||
|
||||
@@ -333,8 +333,8 @@ bool AUInstrumentBase::StreamFormatWritable( AudioUnitScope scope,
|
||||
}
|
||||
|
||||
OSStatus AUInstrumentBase::RealTimeStartNote( SynthGroupElement *inGroup,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
const MusicDeviceNoteParams &inParams)
|
||||
{
|
||||
return noErr;
|
||||
@@ -358,10 +358,10 @@ SynthGroupElement * AUInstrumentBase::GetElForGroupID (MusicDeviceGroupID inGrou
|
||||
AUScope & groups = Groups();
|
||||
unsigned int numEls = groups.GetNumberOfElements();
|
||||
SynthGroupElement* unassignedEl = NULL;
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < numEls; ++i) {
|
||||
SynthGroupElement* el = reinterpret_cast<SynthGroupElement*>(groups.GetElement(i));
|
||||
if (el->GroupID() == inGroupID)
|
||||
if (el->GroupID() == inGroupID)
|
||||
return el;
|
||||
if (el->GroupID() == SynthGroupElement::kUnassignedGroup) {
|
||||
unassignedEl = el;
|
||||
@@ -376,14 +376,14 @@ SynthGroupElement * AUInstrumentBase::GetElForGroupID (MusicDeviceGroupID inGrou
|
||||
}
|
||||
|
||||
OSStatus AUInstrumentBase::RealTimeStopNote(
|
||||
MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame)
|
||||
{
|
||||
#if DEBUG_PRINT
|
||||
printf("AUInstrumentBase::RealTimeStopNote ch %d id %d\n", inGroupID, inNoteInstanceID);
|
||||
#endif
|
||||
|
||||
|
||||
SynthGroupElement *gp = (inGroupID == kMusicNoteEvent_Unused
|
||||
? GetElForNoteID (inNoteInstanceID)
|
||||
: GetElForGroupID(inGroupID));
|
||||
@@ -391,7 +391,7 @@ OSStatus AUInstrumentBase::RealTimeStopNote(
|
||||
{
|
||||
gp->NoteOff (inNoteInstanceID, inOffsetSampleFrame);
|
||||
}
|
||||
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ SynthGroupElement * AUInstrumentBase::GetElForNoteID (NoteInstanceID inNoteID)
|
||||
#endif
|
||||
AUScope & groups = Groups();
|
||||
unsigned int numEls = groups.GetNumberOfElements();
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < numEls; ++i) {
|
||||
SynthGroupElement* el = reinterpret_cast<SynthGroupElement*>(groups.GetElement(i));
|
||||
if (el->GetNote(inNoteID) != NULL) // searches for any note state
|
||||
@@ -411,27 +411,27 @@ SynthGroupElement * AUInstrumentBase::GetElForNoteID (NoteInstanceID inNoteID)
|
||||
throw static_cast<OSStatus>(kAudioUnitErr_InvalidElement);
|
||||
}
|
||||
|
||||
OSStatus AUInstrumentBase::StartNote( MusicDeviceInstrumentID inInstrument,
|
||||
MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID * outNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
OSStatus AUInstrumentBase::StartNote( MusicDeviceInstrumentID inInstrument,
|
||||
MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID * outNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
const MusicDeviceNoteParams &inParams)
|
||||
{
|
||||
OSStatus err = noErr;
|
||||
|
||||
NoteInstanceID noteID;
|
||||
|
||||
NoteInstanceID noteID;
|
||||
if (outNoteInstanceID) {
|
||||
noteID = NextNoteID();
|
||||
*outNoteInstanceID = noteID;
|
||||
} else
|
||||
noteID = (UInt32)inParams.mPitch;
|
||||
|
||||
|
||||
#if DEBUG_PRINT
|
||||
printf("AUInstrumentBase::StartNote ch %u, key %u, offset %u\n", inGroupID, (unsigned) inParams.mPitch, inOffsetSampleFrame);
|
||||
#endif
|
||||
|
||||
if (InRenderThread ())
|
||||
{
|
||||
{
|
||||
err = RealTimeStartNote(
|
||||
GetElForGroupID(inGroupID),
|
||||
noteID,
|
||||
@@ -450,14 +450,14 @@ OSStatus AUInstrumentBase::StartNote( MusicDeviceInstrumentID inInstrument,
|
||||
inOffsetSampleFrame,
|
||||
&inParams
|
||||
);
|
||||
|
||||
|
||||
mEventQueue.AdvanceWritePtr();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
OSStatus AUInstrumentBase::StopNote( MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
OSStatus AUInstrumentBase::StopNote( MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame)
|
||||
{
|
||||
#if DEBUG_PRINT
|
||||
@@ -466,7 +466,7 @@ OSStatus AUInstrumentBase::StopNote( MusicDeviceGroupID inGroupID,
|
||||
OSStatus err = noErr;
|
||||
|
||||
if (InRenderThread ())
|
||||
{
|
||||
{
|
||||
err = RealTimeStopNote(
|
||||
inGroupID,
|
||||
inNoteInstanceID,
|
||||
@@ -484,7 +484,7 @@ OSStatus AUInstrumentBase::StopNote( MusicDeviceGroupID inGroupID,
|
||||
inOffsetSampleFrame,
|
||||
NULL
|
||||
);
|
||||
|
||||
|
||||
mEventQueue.AdvanceWritePtr();
|
||||
}
|
||||
return err;
|
||||
@@ -492,13 +492,13 @@ OSStatus AUInstrumentBase::StopNote( MusicDeviceGroupID inGroupID,
|
||||
|
||||
OSStatus AUInstrumentBase::SendPedalEvent(MusicDeviceGroupID inGroupID, UInt32 inEventType, UInt32 inOffsetSampleFrame)
|
||||
{
|
||||
|
||||
|
||||
if (InRenderThread ())
|
||||
{
|
||||
SynthGroupElement *group = GetElForGroupID(inGroupID);
|
||||
if (!group)
|
||||
return kAudioUnitErr_InvalidElement;
|
||||
|
||||
|
||||
switch (inEventType)
|
||||
{
|
||||
case SynthEvent::kEventType_SustainOn :
|
||||
@@ -532,7 +532,7 @@ OSStatus AUInstrumentBase::SendPedalEvent(MusicDeviceGroupID inGroupID, UInt32 i
|
||||
if (!event) return -1; // queue full
|
||||
|
||||
event->Set(inEventType, inGroupID, 0, 0, NULL);
|
||||
|
||||
|
||||
mEventQueue.AdvanceWritePtr();
|
||||
}
|
||||
return noErr;
|
||||
@@ -576,7 +576,7 @@ OSStatus AUInstrumentBase::HandleControlChange( UInt8 inChannel,
|
||||
}
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
||||
OSStatus AUInstrumentBase::HandlePitchWheel( UInt8 inChannel,
|
||||
UInt8 inPitch1, // LSB
|
||||
UInt8 inPitch2, // MSB
|
||||
@@ -592,7 +592,7 @@ OSStatus AUInstrumentBase::HandlePitchWheel( UInt8 inChannel,
|
||||
return kAudioUnitErr_InvalidElement;
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSStatus AUInstrumentBase::HandleChannelPressure(UInt8 inChannel,
|
||||
UInt8 inValue,
|
||||
UInt32 inStartFrame)
|
||||
@@ -647,13 +647,13 @@ OSStatus AUInstrumentBase::HandleResetAllControllers( UInt8 inChannel)
|
||||
return SendPedalEvent (inChannel, SynthEvent::kEventType_ResetAllControllers, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSStatus AUInstrumentBase::HandleAllNotesOff( UInt8 inChannel)
|
||||
{
|
||||
return SendPedalEvent (inChannel, SynthEvent::kEventType_AllNotesOff, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSStatus AUInstrumentBase::HandleAllSoundOff( UInt8 inChannel)
|
||||
{
|
||||
return SendPedalEvent (inChannel, SynthEvent::kEventType_AllSoundOff, 0);
|
||||
@@ -670,7 +670,7 @@ SynthNote* AUInstrumentBase::GetAFreeNote(UInt32 inFrame)
|
||||
mFreeNotes.RemoveNote(note);
|
||||
return note;
|
||||
}
|
||||
|
||||
|
||||
return VoiceStealing(inFrame, true);
|
||||
}
|
||||
|
||||
@@ -724,13 +724,13 @@ SynthNote* AUInstrumentBase::VoiceStealing(UInt32 inFrame, bool inKillIt)
|
||||
#if DEBUG_PRINT_NOTE
|
||||
printf("no notes to steal????\n");
|
||||
#endif
|
||||
return NULL; // It should be impossible to get here. It means there were no notes to kill in any state.
|
||||
return NULL; // It should be impossible to get here. It means there were no notes to kill in any state.
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AUMonotimbralInstrumentBase::AUMonotimbralInstrumentBase(
|
||||
AudioComponentInstance inInstance,
|
||||
AudioComponentInstance inInstance,
|
||||
UInt32 numInputs,
|
||||
UInt32 numOutputs,
|
||||
UInt32 numGroups,
|
||||
@@ -739,28 +739,28 @@ AUMonotimbralInstrumentBase::AUMonotimbralInstrumentBase(
|
||||
{
|
||||
}
|
||||
|
||||
OSStatus AUMonotimbralInstrumentBase::RealTimeStartNote(
|
||||
SynthGroupElement *inGroup,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
OSStatus AUMonotimbralInstrumentBase::RealTimeStartNote(
|
||||
SynthGroupElement *inGroup,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
const MusicDeviceNoteParams &inParams)
|
||||
{
|
||||
#if DEBUG_PRINT_RENDER
|
||||
printf("AUMonotimbralInstrumentBase::RealTimeStartNote %d\n", inNoteInstanceID);
|
||||
#endif
|
||||
|
||||
if (NumActiveNotes() + 1 > MaxActiveNotes())
|
||||
if (NumActiveNotes() + 1 > MaxActiveNotes())
|
||||
{
|
||||
VoiceStealing(inOffsetSampleFrame, false);
|
||||
}
|
||||
SynthNote *note = GetAFreeNote(inOffsetSampleFrame);
|
||||
if (!note) return -1;
|
||||
|
||||
|
||||
SynthPartElement *part = GetPartElement (0); // Only one part for monotimbral
|
||||
|
||||
|
||||
IncNumActiveNotes();
|
||||
inGroup->NoteOn(note, part, inNoteInstanceID, inOffsetSampleFrame, inParams);
|
||||
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -774,8 +774,8 @@ OSStatus AUMultitimbralInstrumentBase::GetPropertyInfo(AudioUnitPropertyID inI
|
||||
Boolean & outWritable)
|
||||
{
|
||||
OSStatus result = noErr;
|
||||
|
||||
switch (inID)
|
||||
|
||||
switch (inID)
|
||||
{
|
||||
#if !TARGET_OS_IPHONE
|
||||
case kMusicDeviceProperty_PartGroup:
|
||||
@@ -797,7 +797,7 @@ OSStatus AUMultitimbralInstrumentBase::GetProperty( AudioUnitPropertyID inID,
|
||||
{
|
||||
OSStatus result = noErr;
|
||||
|
||||
switch (inID)
|
||||
switch (inID)
|
||||
{
|
||||
#if !TARGET_OS_IPHONE
|
||||
case kMusicDeviceProperty_PartGroup:
|
||||
@@ -809,7 +809,7 @@ OSStatus AUMultitimbralInstrumentBase::GetProperty( AudioUnitPropertyID inID,
|
||||
default:
|
||||
result = AUInstrumentBase::GetProperty (inID, inScope, inElement, outData);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -823,7 +823,7 @@ OSStatus AUMultitimbralInstrumentBase::SetProperty( AudioUnitPropertyID in
|
||||
{
|
||||
OSStatus result = noErr;
|
||||
|
||||
switch (inID)
|
||||
switch (inID)
|
||||
{
|
||||
#if !TARGET_OS_IPHONE
|
||||
case kMusicDeviceProperty_PartGroup:
|
||||
@@ -835,7 +835,7 @@ OSStatus AUMultitimbralInstrumentBase::SetProperty( AudioUnitPropertyID in
|
||||
default:
|
||||
result = MusicDeviceBase::SetProperty (inID, inScope, inElement, inData, inDataSize);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUInstrumentBase.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUInstrumentBase__
|
||||
#define __AUInstrumentBase__
|
||||
@@ -66,7 +66,7 @@ class AUInstrumentBase : public MusicDeviceBase
|
||||
{
|
||||
public:
|
||||
AUInstrumentBase(
|
||||
AudioComponentInstance inInstance,
|
||||
AudioComponentInstance inInstance,
|
||||
UInt32 numInputs,
|
||||
UInt32 numOutputs,
|
||||
UInt32 numGroups = 16,
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
virtual ~AUInstrumentBase();
|
||||
|
||||
virtual OSStatus Initialize();
|
||||
|
||||
|
||||
/*! @method Parts */
|
||||
AUScope & Parts() { return mPartScope; }
|
||||
|
||||
@@ -92,10 +92,10 @@ public:
|
||||
virtual void CreateExtendedElements();
|
||||
|
||||
virtual void Cleanup();
|
||||
|
||||
|
||||
virtual OSStatus Reset( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement);
|
||||
|
||||
|
||||
virtual bool ValidFormat( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
const CAStreamBasicDescription & inNewFormat);
|
||||
@@ -109,35 +109,35 @@ public:
|
||||
const AudioTimeStamp & inTimeStamp,
|
||||
UInt32 inNumberFrames);
|
||||
|
||||
virtual OSStatus StartNote( MusicDeviceInstrumentID inInstrument,
|
||||
MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID * outNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
virtual OSStatus StartNote( MusicDeviceInstrumentID inInstrument,
|
||||
MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID * outNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
const MusicDeviceNoteParams &inParams);
|
||||
|
||||
virtual OSStatus StopNote( MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
virtual OSStatus StopNote( MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame);
|
||||
|
||||
virtual OSStatus RealTimeStartNote( SynthGroupElement *inGroup,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
const MusicDeviceNoteParams &inParams);
|
||||
|
||||
virtual OSStatus RealTimeStopNote( MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
|
||||
virtual OSStatus RealTimeStopNote( MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame);
|
||||
|
||||
|
||||
virtual OSStatus HandleControlChange( UInt8 inChannel,
|
||||
UInt8 inController,
|
||||
UInt8 inValue,
|
||||
UInt32 inStartFrame);
|
||||
|
||||
|
||||
virtual OSStatus HandlePitchWheel( UInt8 inChannel,
|
||||
UInt8 inPitch1,
|
||||
UInt8 inPitch2,
|
||||
UInt32 inStartFrame);
|
||||
|
||||
|
||||
virtual OSStatus HandleChannelPressure( UInt8 inChannel,
|
||||
UInt8 inValue,
|
||||
UInt32 inStartFrame);
|
||||
@@ -151,31 +151,31 @@ public:
|
||||
UInt32 inStartFrame);
|
||||
|
||||
virtual OSStatus HandleResetAllControllers( UInt8 inChannel);
|
||||
|
||||
|
||||
virtual OSStatus HandleAllNotesOff( UInt8 inChannel);
|
||||
|
||||
|
||||
virtual OSStatus HandleAllSoundOff( UInt8 inChannel);
|
||||
|
||||
SynthNote* GetNote(UInt32 inIndex)
|
||||
{
|
||||
SynthNote* GetNote(UInt32 inIndex)
|
||||
{
|
||||
if (!mNotes)
|
||||
throw std::runtime_error("no notes");
|
||||
return (SynthNote*)((char*)mNotes + inIndex * mNoteSize);
|
||||
return (SynthNote*)((char*)mNotes + inIndex * mNoteSize);
|
||||
}
|
||||
|
||||
|
||||
SynthNote* GetAFreeNote(UInt32 inFrame);
|
||||
void AddFreeNote(SynthNote* inNote);
|
||||
|
||||
|
||||
friend class SynthGroupElement;
|
||||
protected:
|
||||
|
||||
UInt32 NextNoteID() { return OSAtomicIncrement32((int32_t *)&mNoteIDCounter); }
|
||||
|
||||
|
||||
// call SetNotes in your Initialize() method to give the base class your note structures and to set the maximum
|
||||
|
||||
|
||||
// call SetNotes in your Initialize() method to give the base class your note structures and to set the maximum
|
||||
// number of active notes. inNoteData should be an array of size inMaxActiveNotes.
|
||||
void SetNotes(UInt32 inNumNotes, UInt32 inMaxActiveNotes, SynthNote* inNotes, UInt32 inNoteSize);
|
||||
|
||||
|
||||
void PerformEvents( const AudioTimeStamp & inTimeStamp);
|
||||
OSStatus SendPedalEvent(MusicDeviceGroupID inGroupID, UInt32 inEventType, UInt32 inOffsetSampleFrame);
|
||||
virtual SynthNote* VoiceStealing(UInt32 inFrame, bool inKillIt);
|
||||
@@ -184,29 +184,29 @@ protected:
|
||||
void IncNumActiveNotes() { ++mNumActiveNotes; }
|
||||
void DecNumActiveNotes() { --mNumActiveNotes; }
|
||||
UInt32 CountActiveNotes();
|
||||
|
||||
|
||||
SynthPartElement * GetPartElement (AudioUnitElement inPartElement);
|
||||
|
||||
|
||||
// this call throws if there's no assigned element for the group ID
|
||||
virtual SynthGroupElement * GetElForGroupID (MusicDeviceGroupID inGroupID);
|
||||
virtual SynthGroupElement * GetElForNoteID (NoteInstanceID inNoteID);
|
||||
|
||||
SInt64 mAbsoluteSampleFrame;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
SInt32 mNoteIDCounter;
|
||||
|
||||
|
||||
SynthEventQueue mEventQueue;
|
||||
|
||||
|
||||
UInt32 mNumNotes;
|
||||
UInt32 mNumActiveNotes;
|
||||
UInt32 mMaxActiveNotes;
|
||||
SynthNote* mNotes;
|
||||
SynthNote* mNotes;
|
||||
SynthNoteList mFreeNotes;
|
||||
UInt32 mNoteSize;
|
||||
|
||||
|
||||
AUScope mPartScope;
|
||||
const UInt32 mInitNumPartEls;
|
||||
};
|
||||
@@ -217,15 +217,15 @@ class AUMonotimbralInstrumentBase : public AUInstrumentBase
|
||||
{
|
||||
public:
|
||||
AUMonotimbralInstrumentBase(
|
||||
AudioComponentInstance inInstance,
|
||||
AudioComponentInstance inInstance,
|
||||
UInt32 numInputs,
|
||||
UInt32 numOutputs,
|
||||
UInt32 numGroups = 16,
|
||||
UInt32 numParts = 1);
|
||||
|
||||
virtual OSStatus RealTimeStartNote( SynthGroupElement *inGroup,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
|
||||
virtual OSStatus RealTimeStartNote( SynthGroupElement *inGroup,
|
||||
NoteInstanceID inNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
const MusicDeviceNoteParams &inParams);
|
||||
};
|
||||
|
||||
@@ -236,12 +236,12 @@ class AUMultitimbralInstrumentBase : public AUInstrumentBase
|
||||
{
|
||||
public:
|
||||
AUMultitimbralInstrumentBase(
|
||||
AudioComponentInstance inInstance,
|
||||
AudioComponentInstance inInstance,
|
||||
UInt32 numInputs,
|
||||
UInt32 numOutputs,
|
||||
UInt32 numGroups,
|
||||
UInt32 numParts);
|
||||
|
||||
|
||||
virtual OSStatus GetPropertyInfo( AudioUnitPropertyID inID,
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: LockFreeFIFO.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include <libkern/OSAtomic.h>
|
||||
|
||||
@@ -58,22 +58,22 @@ public:
|
||||
mItems = new ITEM[inMaxSize];
|
||||
mMask = inMaxSize - 1;
|
||||
}
|
||||
|
||||
|
||||
~LockFreeFIFOWithFree()
|
||||
{
|
||||
delete [] mItems;
|
||||
}
|
||||
|
||||
|
||||
void Reset()
|
||||
|
||||
void Reset()
|
||||
{
|
||||
FreeItems();
|
||||
mReadIndex = 0;
|
||||
mWriteIndex = 0;
|
||||
mFreeIndex = 0;
|
||||
}
|
||||
|
||||
ITEM* WriteItem()
|
||||
|
||||
ITEM* WriteItem()
|
||||
{
|
||||
//printf("WriteItem %d %d\n", mReadIndex, mWriteIndex);
|
||||
FreeItems(); // free items on the write thread.
|
||||
@@ -81,8 +81,8 @@ public:
|
||||
if (nextWriteIndex == mFreeIndex) return NULL;
|
||||
return &mItems[mWriteIndex];
|
||||
}
|
||||
|
||||
ITEM* ReadItem()
|
||||
|
||||
ITEM* ReadItem()
|
||||
{
|
||||
//printf("ReadItem %d %d\n", mReadIndex, mWriteIndex);
|
||||
if (mReadIndex == mWriteIndex) return NULL;
|
||||
@@ -91,14 +91,14 @@ public:
|
||||
void AdvanceWritePtr() { OSAtomicCompareAndSwap32(mWriteIndex, (mWriteIndex + 1) & mMask, &mWriteIndex); }
|
||||
void AdvanceReadPtr() { OSAtomicCompareAndSwap32(mReadIndex, (mReadIndex + 1) & mMask, &mReadIndex); }
|
||||
private:
|
||||
ITEM* FreeItem()
|
||||
ITEM* FreeItem()
|
||||
{
|
||||
if (mFreeIndex == mReadIndex) return NULL;
|
||||
return &mItems[mFreeIndex];
|
||||
}
|
||||
void AdvanceFreePtr() { OSAtomicCompareAndSwap32(mFreeIndex, (mFreeIndex + 1) & mMask, &mFreeIndex); }
|
||||
|
||||
void FreeItems()
|
||||
|
||||
void FreeItems()
|
||||
{
|
||||
ITEM* item;
|
||||
while ((item = FreeItem()) != NULL)
|
||||
@@ -107,7 +107,7 @@ private:
|
||||
AdvanceFreePtr();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
volatile int32_t mReadIndex, mWriteIndex, mFreeIndex;
|
||||
int32_t mMask;
|
||||
ITEM *mItems;
|
||||
@@ -129,38 +129,38 @@ public:
|
||||
mItems = new ITEM[inMaxSize];
|
||||
mMask = inMaxSize - 1;
|
||||
}
|
||||
|
||||
|
||||
~LockFreeFIFO()
|
||||
{
|
||||
delete [] mItems;
|
||||
}
|
||||
|
||||
void Reset()
|
||||
|
||||
void Reset()
|
||||
{
|
||||
mReadIndex = 0;
|
||||
mWriteIndex = 0;
|
||||
}
|
||||
|
||||
ITEM* WriteItem()
|
||||
|
||||
ITEM* WriteItem()
|
||||
{
|
||||
int32_t nextWriteIndex = (mWriteIndex + 1) & mMask;
|
||||
if (nextWriteIndex == mReadIndex) return NULL;
|
||||
return &mItems[mWriteIndex];
|
||||
}
|
||||
|
||||
ITEM* ReadItem()
|
||||
|
||||
ITEM* ReadItem()
|
||||
{
|
||||
if (mReadIndex == mWriteIndex) return NULL;
|
||||
return &mItems[mReadIndex];
|
||||
}
|
||||
|
||||
|
||||
// the CompareAndSwap will always succeed. We use CompareAndSwap because it calls the PowerPC sync instruction,
|
||||
// plus any processor bug workarounds for various CPUs.
|
||||
void AdvanceWritePtr() { OSAtomicCompareAndSwap32(mWriteIndex, (mWriteIndex + 1) & mMask, &mWriteIndex); }
|
||||
void AdvanceReadPtr() { OSAtomicCompareAndSwap32(mReadIndex, (mReadIndex + 1) & mMask, &mReadIndex); }
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
volatile int32_t mReadIndex, mWriteIndex;
|
||||
int32_t mMask;
|
||||
ITEM *mItems;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: MIDIControlHandler.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __MIDICONTROLHANDLER_H__
|
||||
#define __MIDICONTROLHANDLER_H__
|
||||
@@ -62,11 +62,11 @@ public:
|
||||
virtual bool SetPolyPressure(UInt8 inKey, UInt8 inValue) = 0;
|
||||
virtual bool SetController(UInt8 inControllerNumber, UInt8 inValue) = 0;
|
||||
virtual bool SetSysex(void *inSysexMsg) = 0;
|
||||
|
||||
|
||||
virtual float GetPitchBend() const = 0;
|
||||
|
||||
/*! Default controller values. These represent MSB values unless indicated in the name */
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
kDefault_Midpoint = 0x40, //! Used for all center-null-point controllers
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
kDefault_ChannelPressure = 0,
|
||||
kDefault_ReverbSend = 40,
|
||||
kDefault_ChorusSend = 0,
|
||||
|
||||
|
||||
kDefault_RPN_LSB = 0x7f,
|
||||
kDefault_RPN_MSB = 0x7f,
|
||||
kDefault_PitchBendRange = 2,
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: SynthElement.cpp
|
||||
Abstract: SynthElement.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "SynthElement.h"
|
||||
#include "AUInstrumentBase.h"
|
||||
@@ -78,7 +78,7 @@ void MidiControls::Reset()
|
||||
}
|
||||
|
||||
|
||||
SynthElement::SynthElement(AUInstrumentBase *audioUnit, UInt32 inElement)
|
||||
SynthElement::SynthElement(AUInstrumentBase *audioUnit, UInt32 inElement)
|
||||
: AUElement(audioUnit), mIndex(inElement)
|
||||
{
|
||||
}
|
||||
@@ -87,7 +87,7 @@ SynthElement::~SynthElement()
|
||||
{
|
||||
}
|
||||
|
||||
SynthGroupElement::SynthGroupElement(AUInstrumentBase *audioUnit, UInt32 inElement, MIDIControlHandler *inHandler)
|
||||
SynthGroupElement::SynthGroupElement(AUInstrumentBase *audioUnit, UInt32 inElement, MIDIControlHandler *inHandler)
|
||||
: SynthElement(audioUnit, inElement),
|
||||
mCurrentAbsoluteFrame(-1),
|
||||
mMidiControlHandler(inHandler),
|
||||
@@ -109,7 +109,7 @@ void SynthGroupElement::SetGroupID (MusicDeviceGroupID inGroup)
|
||||
mGroupID = inGroup;
|
||||
}
|
||||
|
||||
void SynthGroupElement::Reset()
|
||||
void SynthGroupElement::Reset()
|
||||
{
|
||||
#if DEBUG_PRINT
|
||||
printf("SynthGroupElement::Reset\n");
|
||||
@@ -119,7 +119,7 @@ void SynthGroupElement::Reset()
|
||||
mNoteList[i].Empty();
|
||||
}
|
||||
|
||||
SynthPartElement::SynthPartElement(AUInstrumentBase *audioUnit, UInt32 inElement)
|
||||
SynthPartElement::SynthPartElement(AUInstrumentBase *audioUnit, UInt32 inElement)
|
||||
: SynthElement(audioUnit, inElement)
|
||||
{
|
||||
}
|
||||
@@ -132,7 +132,7 @@ SynthNote *SynthGroupElement::GetNote(NoteInstanceID inNoteID, bool unreleasedOn
|
||||
#if DEBUG_PRINT_RENDER
|
||||
printf("SynthGroupElement::GetNote %d, unreleased = %d\n", inNoteID, unreleasedOnly);
|
||||
#endif
|
||||
const UInt32 lastNoteState = unreleasedOnly ?
|
||||
const UInt32 lastNoteState = unreleasedOnly ?
|
||||
(mSostenutoIsOn ? kNoteState_Sostenutoed : kNoteState_Attacked)
|
||||
: kNoteState_Released;
|
||||
SynthNote *note = NULL;
|
||||
@@ -176,7 +176,7 @@ void SynthGroupElement::NoteOn(SynthNote *note,
|
||||
}
|
||||
|
||||
void SynthGroupElement::NoteOff(NoteInstanceID inNoteID, UInt32 inFrame)
|
||||
{
|
||||
{
|
||||
#if DEBUG_PRINT_NOTE
|
||||
printf("SynthGroupElement::NoteOff %d\n", inNoteID);
|
||||
#endif
|
||||
@@ -217,7 +217,7 @@ void SynthGroupElement::NoteEnded(SynthNote *inNote, UInt32 inFrame)
|
||||
SynthNoteList *list = &mNoteList[inNote->GetState()];
|
||||
list->RemoveNote(inNote);
|
||||
}
|
||||
|
||||
|
||||
GetAUInstrument()->AddFreeNote(inNote);
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ bool SynthGroupElement::ChannelMessage(UInt16 controllerID, UInt16 inValue)
|
||||
// Sustain and sostenuto are "pedal events", and are handled during render cycle
|
||||
if (controllerID <= kMidiController_RPN_MSB && controllerID != kMidiController_Sustain && controllerID != kMidiController_Sostenuto)
|
||||
handled = mMidiControlHandler->SetController(controllerID, UInt8(inValue));
|
||||
else
|
||||
else
|
||||
{
|
||||
switch (controllerID)
|
||||
{
|
||||
@@ -296,7 +296,7 @@ void SynthGroupElement::SostenutoOff(UInt32 inFrame)
|
||||
mMidiControlHandler->SetController(kMidiController_Sostenuto, 0);
|
||||
mSostenutoIsOn = false;
|
||||
mNoteList[kNoteState_Attacked].TransferAllFrom(&mNoteList[kNoteState_Sostenutoed], inFrame);
|
||||
if (mSustainIsOn)
|
||||
if (mSustainIsOn)
|
||||
mNoteList[kNoteState_ReleasedButSustained].TransferAllFrom(&mNoteList[kNoteState_ReleasedButSostenutoed], inFrame);
|
||||
else
|
||||
mNoteList[kNoteState_Released].TransferAllFrom(&mNoteList[kNoteState_ReleasedButSostenutoed], inFrame);
|
||||
@@ -323,7 +323,7 @@ void SynthGroupElement::SustainOff(UInt32 inFrame)
|
||||
if (mSustainIsOn) {
|
||||
mMidiControlHandler->SetController(kMidiController_Sustain, 0);
|
||||
mSustainIsOn = false;
|
||||
|
||||
|
||||
mNoteList[kNoteState_Released].TransferAllFrom(&mNoteList[kNoteState_ReleasedButSustained], inFrame);
|
||||
}
|
||||
}
|
||||
@@ -342,14 +342,14 @@ void SynthGroupElement::AllNotesOff(UInt32 inFrame)
|
||||
while (note)
|
||||
{
|
||||
SynthNote *nextNote = note->mNext;
|
||||
|
||||
|
||||
mNoteList[i].RemoveNote(note);
|
||||
note->Release(inFrame);
|
||||
mNoteList[newState].AddNote(note);
|
||||
|
||||
|
||||
note = nextNote;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SynthGroupElement::AllSoundOff(UInt32 inFrame)
|
||||
@@ -358,21 +358,21 @@ void SynthGroupElement::AllSoundOff(UInt32 inFrame)
|
||||
printf("SynthGroupElement::AllSoundOff\n");
|
||||
#endif
|
||||
SynthNote *note;
|
||||
|
||||
|
||||
for (UInt32 i=0 ; i<kNumberOfActiveNoteStates; ++i)
|
||||
{
|
||||
note = mNoteList[i].mHead;
|
||||
while (note)
|
||||
{
|
||||
SynthNote *nextNote = note->mNext;
|
||||
|
||||
|
||||
mNoteList[i].RemoveNote(note);
|
||||
note->FastRelease(inFrame);
|
||||
mNoteList[kNoteState_FastReleased].AddNote(note);
|
||||
GetAUInstrument()->DecNumActiveNotes();
|
||||
note = nextNote;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SynthGroupElement::ResetAllControllers(UInt32 inFrame)
|
||||
@@ -395,7 +395,7 @@ OSStatus SynthGroupElement::Render(SInt64 inAbsoluteSampleFrame, UInt32 inNumber
|
||||
{
|
||||
buffArray[outBus] = &GetAudioUnit()->GetOutput(outBus)->GetBufferList();
|
||||
}
|
||||
|
||||
|
||||
for (UInt32 i=0 ; i<kNumberOfSoundingNoteStates; ++i)
|
||||
{
|
||||
SynthNote *note = mNoteList[i].mHead;
|
||||
@@ -405,10 +405,10 @@ OSStatus SynthGroupElement::Render(SInt64 inAbsoluteSampleFrame, UInt32 inNumber
|
||||
printf("SynthGroupElement::Render: state %d, note %p\n", i, note);
|
||||
#endif
|
||||
SynthNote *nextNote = note->mNext;
|
||||
|
||||
|
||||
OSStatus err = note->Render(inAbsoluteSampleFrame, inNumberFrames, buffArray, numOutputs);
|
||||
if (err) return err;
|
||||
|
||||
|
||||
note = nextNote;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: SynthElement.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __SynthElement__
|
||||
#define __SynthElement__
|
||||
@@ -62,9 +62,9 @@ public:
|
||||
virtual ~SynthElement();
|
||||
|
||||
UInt32 GetIndex() const { return mIndex; }
|
||||
|
||||
|
||||
AUInstrumentBase* GetAUInstrument() { return (AUInstrumentBase*)GetAudioUnit(); }
|
||||
|
||||
|
||||
private:
|
||||
UInt32 mIndex;
|
||||
};
|
||||
@@ -98,11 +98,11 @@ public:
|
||||
|
||||
virtual float GetPitchBend() const { return mFPitchBend * mFPitchBendDepth; }
|
||||
|
||||
SInt16 GetHiResControl(UInt32 inIndex) const
|
||||
{
|
||||
SInt16 GetHiResControl(UInt32 inIndex) const
|
||||
{
|
||||
return ((mControls[inIndex] & 127) << 7) | (mControls[inIndex + 32] & 127);
|
||||
}
|
||||
|
||||
|
||||
float GetControl(UInt32 inIndex) const
|
||||
{
|
||||
if (inIndex < 32) {
|
||||
@@ -111,10 +111,10 @@ public:
|
||||
return (float)mControls[inIndex];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
UInt8 mControls[128];
|
||||
UInt8 mPolyPressure[128];
|
||||
UInt8 mMonoPressure;
|
||||
@@ -124,17 +124,17 @@ private:
|
||||
UInt16 mActiveNRPN;
|
||||
UInt16 mActiveRPValue;
|
||||
UInt16 mActiveNRPValue;
|
||||
|
||||
|
||||
UInt16 mPitchBendDepth;
|
||||
float mFPitchBendDepth;
|
||||
float mFPitchBend;
|
||||
|
||||
|
||||
void SetHiResControl(UInt32 inIndex, UInt8 inMSB, UInt8 inLSB)
|
||||
{
|
||||
{
|
||||
mControls[inIndex] = inMSB;
|
||||
mControls[inIndex + 32] = inLSB;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
enum {
|
||||
kUnassignedGroup = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
|
||||
SynthGroupElement(AUInstrumentBase *audioUnit, UInt32 inElement, MIDIControlHandler *inHandler);
|
||||
virtual ~SynthGroupElement();
|
||||
|
||||
@@ -157,27 +157,27 @@ public:
|
||||
|
||||
void NoteEnded(SynthNote *inNote, UInt32 inFrame);
|
||||
void NoteFastReleased(SynthNote *inNote);
|
||||
|
||||
|
||||
virtual bool ChannelMessage(UInt16 controlID, UInt16 controlValue);
|
||||
virtual void AllNotesOff(UInt32 inFrame);
|
||||
virtual void AllSoundOff(UInt32 inFrame);
|
||||
void ResetAllControllers(UInt32 inFrame);
|
||||
|
||||
|
||||
SynthNote * GetNote(NoteInstanceID inNoteID, bool unreleasedOnly=false, UInt32 *outNoteState=NULL);
|
||||
|
||||
|
||||
void Reset();
|
||||
|
||||
|
||||
virtual OSStatus Render(SInt64 inAbsoluteSampleFrame, UInt32 inNumberFrames, AUScope &outputs);
|
||||
|
||||
|
||||
float GetPitchBend() const { return mMidiControlHandler->GetPitchBend(); }
|
||||
SInt64 GetCurrentAbsoluteFrame() const { return mCurrentAbsoluteFrame; }
|
||||
|
||||
|
||||
MusicDeviceGroupID GroupID () const { return mGroupID; }
|
||||
virtual void SetGroupID (MusicDeviceGroupID inGroup);
|
||||
|
||||
MIDIControlHandler * GetMIDIControlHandler() const { return mMidiControlHandler; }
|
||||
|
||||
protected:
|
||||
|
||||
protected:
|
||||
SInt64 mCurrentAbsoluteFrame;
|
||||
SynthNoteList mNoteList[kNumberOfSoundingNoteStates];
|
||||
MIDIControlHandler *mMidiControlHandler;
|
||||
@@ -186,7 +186,7 @@ private:
|
||||
friend class AUInstrumentBase;
|
||||
friend class AUMonotimbralInstrumentBase;
|
||||
friend class AUMultitimbralInstrumentBase;
|
||||
|
||||
|
||||
bool mSustainIsOn;
|
||||
bool mSostenutoIsOn;
|
||||
UInt32 mOutputBus;
|
||||
@@ -213,15 +213,15 @@ public:
|
||||
|
||||
UInt32 GetGroupIndex() const { return mGroupIndex; }
|
||||
bool InRange(Float32 inNote, Float32 inVelocity);
|
||||
|
||||
|
||||
UInt32 GetMaxPolyphony() const { return mMaxPolyphony; }
|
||||
void SetMaxPolyphony(UInt32 inMaxPolyphony) { mMaxPolyphony = inMaxPolyphony; }
|
||||
|
||||
|
||||
private:
|
||||
UInt32 mGroupIndex;
|
||||
UInt32 mPatchIndex;
|
||||
UInt32 mMaxPolyphony;
|
||||
SynthKeyZone mKeyZone;
|
||||
SynthKeyZone mKeyZone;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: SynthEvent.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
/* You can either fill in code here or remove this and create or add new files. */
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
SynthEvent() {}
|
||||
~SynthEvent() {}
|
||||
|
||||
void Set(
|
||||
void Set(
|
||||
UInt32 inEventType,
|
||||
MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID inNoteID,
|
||||
@@ -88,20 +88,20 @@ public:
|
||||
mGroupID = inGroupID;
|
||||
mNoteID = inNoteID;
|
||||
mOffsetSampleFrame = inOffsetSampleFrame;
|
||||
|
||||
|
||||
if (inNoteParams)
|
||||
{
|
||||
UInt32 paramSize = offsetof(MusicDeviceNoteParams, mControls) + (inNoteParams->argCount-2)*sizeof(NoteParamsControlValue);
|
||||
mNoteParams = inNoteParams->argCount > 3
|
||||
? (MusicDeviceNoteParams*)malloc(paramSize)
|
||||
UInt32 paramSize = offsetof(MusicDeviceNoteParams, mControls) + (inNoteParams->argCount-2)*sizeof(NoteParamsControlValue);
|
||||
mNoteParams = inNoteParams->argCount > 3
|
||||
? (MusicDeviceNoteParams*)malloc(paramSize)
|
||||
: &mSmallNoteParams;
|
||||
memcpy(mNoteParams, inNoteParams, paramSize);
|
||||
}
|
||||
else
|
||||
else
|
||||
mNoteParams = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Free()
|
||||
{
|
||||
if (mNoteParams)
|
||||
@@ -111,27 +111,27 @@ public:
|
||||
mNoteParams = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UInt32 GetEventType() const { return mEventType; }
|
||||
MusicDeviceGroupID GetGroupID() const { return mGroupID; }
|
||||
NoteInstanceID GetNoteID() const { return mNoteID; }
|
||||
UInt32 GetOffsetSampleFrame() const { return mOffsetSampleFrame; }
|
||||
|
||||
|
||||
MusicDeviceNoteParams* GetParams() const { return mNoteParams; }
|
||||
|
||||
UInt32 GetArgCount() const { return mNoteParams->argCount; }
|
||||
UInt32 NumberParameters() const { return mNoteParams->argCount - 2; }
|
||||
|
||||
|
||||
Float32 GetNote() const { return mNoteParams->mPitch; }
|
||||
Float32 GetVelocity() const { return mNoteParams->mVelocity; }
|
||||
|
||||
NoteParamsControlValue GetParameter(UInt32 inIndex) const
|
||||
|
||||
NoteParamsControlValue GetParameter(UInt32 inIndex) const
|
||||
{
|
||||
if (inIndex >= NumberParameters())
|
||||
if (inIndex >= NumberParameters())
|
||||
throw std::runtime_error("index out of range");
|
||||
return mNoteParams->mControls[inIndex];
|
||||
return mNoteParams->mControls[inIndex];
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
UInt32 mEventType;
|
||||
MusicDeviceGroupID mGroupID;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: SynthNote.cpp
|
||||
Abstract: SynthNote.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "SynthNote.h"
|
||||
#include "SynthElement.h"
|
||||
@@ -51,9 +51,9 @@
|
||||
bool SynthNote::AttackNote(
|
||||
SynthPartElement * inPart,
|
||||
SynthGroupElement * inGroup,
|
||||
NoteInstanceID inNoteID,
|
||||
UInt64 inAbsoluteSampleFrame,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
NoteInstanceID inNoteID,
|
||||
UInt64 inAbsoluteSampleFrame,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
const MusicDeviceNoteParams &inParams)
|
||||
{
|
||||
#if DEBUG_PRINT
|
||||
@@ -70,8 +70,8 @@ bool SynthNote::AttackNote(
|
||||
|
||||
mPitch = inParams.mPitch;
|
||||
mVelocity = inParams.mVelocity;
|
||||
|
||||
|
||||
|
||||
|
||||
return Attack(inParams);
|
||||
}
|
||||
|
||||
@@ -116,25 +116,25 @@ double SynthNote::SampleRate()
|
||||
return GetAudioUnit()->GetOutput(0)->GetStreamFormat().mSampleRate;
|
||||
}
|
||||
|
||||
AUInstrumentBase* SynthNote::GetAudioUnit() const
|
||||
{
|
||||
return (AUInstrumentBase*)mGroup->GetAudioUnit();
|
||||
AUInstrumentBase* SynthNote::GetAudioUnit() const
|
||||
{
|
||||
return (AUInstrumentBase*)mGroup->GetAudioUnit();
|
||||
}
|
||||
|
||||
Float32 SynthNote::GetGlobalParameter(AudioUnitParameterID inParamID) const
|
||||
Float32 SynthNote::GetGlobalParameter(AudioUnitParameterID inParamID) const
|
||||
{
|
||||
return mGroup->GetAudioUnit()->Globals()->GetParameter(inParamID);
|
||||
}
|
||||
|
||||
void SynthNote::NoteEnded(UInt32 inFrame)
|
||||
{
|
||||
void SynthNote::NoteEnded(UInt32 inFrame)
|
||||
{
|
||||
mGroup->NoteEnded(this, inFrame);
|
||||
mNoteID = 0xFFFFFFFF;
|
||||
mNoteID = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
float SynthNote::GetPitchBend() const
|
||||
{
|
||||
return mGroup->GetPitchBend();
|
||||
float SynthNote::GetPitchBend() const
|
||||
{
|
||||
return mGroup->GetPitchBend();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: SynthNote.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __SynthNote__
|
||||
#define __SynthNote__
|
||||
@@ -84,7 +84,7 @@ enum SynthNoteState {
|
||||
end of note any state free
|
||||
soft voice stealing any state fast released
|
||||
hard voice stealing any state free
|
||||
|
||||
|
||||
soft voice stealing happens when there is a note on event and NumActiveNotes > MaxActiveNotes
|
||||
hard voice stealing happens when there is a note on event and NumActiveNotes == NumNotes (no free notes)
|
||||
voice stealing removes the quietest note in the highest numbered state that has sounding notes.
|
||||
@@ -108,20 +108,20 @@ struct SynthNote
|
||||
mVelocity(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual ~SynthNote() {}
|
||||
|
||||
|
||||
virtual void Reset();
|
||||
//! Returns true if active note resulted from this call, otherwise false
|
||||
virtual bool AttackNote(
|
||||
SynthPartElement * inPart,
|
||||
SynthGroupElement * inGroup,
|
||||
NoteInstanceID inNoteID,
|
||||
UInt64 inAbsoluteSampleFrame,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
NoteInstanceID inNoteID,
|
||||
UInt64 inAbsoluteSampleFrame,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
const MusicDeviceNoteParams &inParams
|
||||
);
|
||||
|
||||
|
||||
virtual OSStatus Render(UInt64 inAbsoluteSampleFrame, UInt32 inNumFrames, AudioBufferList** inBufferList, UInt32 inOutBusCount) = 0;
|
||||
//! Returns true if active note resulted from this call, otherwise false
|
||||
virtual bool Attack(const MusicDeviceNoteParams &inParams) = 0;
|
||||
@@ -134,7 +134,7 @@ struct SynthNote
|
||||
|
||||
SynthGroupElement* GetGroup() const { return mGroup; }
|
||||
SynthPartElement* GetPart() const { return mPart; }
|
||||
|
||||
|
||||
AUInstrumentBase* GetAudioUnit() const;
|
||||
|
||||
Float32 GetGlobalParameter(AudioUnitParameterID inParamID) const;
|
||||
@@ -143,7 +143,7 @@ struct SynthNote
|
||||
SynthNoteState GetState() const { return mState; }
|
||||
UInt8 GetMidiKey() const { return (UInt8) mPitch; }
|
||||
UInt8 GetMidiVelocity() const { return (UInt8) mVelocity; }
|
||||
|
||||
|
||||
Boolean IsSounding() const { return mState < kNumberOfSoundingNoteStates; }
|
||||
Boolean IsActive() const { return mState < kNumberOfActiveNoteStates; }
|
||||
UInt64 GetAbsoluteStartFrame() const { return mAbsoluteStartFrame; }
|
||||
@@ -155,7 +155,7 @@ struct SynthNote
|
||||
|
||||
float GetPitchBend() const;
|
||||
double TuningA() const;
|
||||
|
||||
|
||||
Float32 GetPitch() const { return mPitch; } // returns raw pitch from MusicDeviceNoteParams
|
||||
virtual double Frequency(); // returns the frequency of note + pitch bend.
|
||||
virtual double SampleRate();
|
||||
@@ -163,7 +163,7 @@ struct SynthNote
|
||||
// linked list pointers
|
||||
SynthNote *mPrev;
|
||||
SynthNote *mNext;
|
||||
|
||||
|
||||
friend class SynthGroupElement;
|
||||
friend struct SynthNoteList;
|
||||
protected:
|
||||
@@ -171,14 +171,14 @@ protected:
|
||||
private:
|
||||
SynthPartElement* mPart;
|
||||
SynthGroupElement* mGroup;
|
||||
|
||||
|
||||
NoteInstanceID mNoteID;
|
||||
SynthNoteState mState;
|
||||
UInt64 mAbsoluteStartFrame;
|
||||
SInt32 mRelativeStartFrame;
|
||||
SInt32 mRelativeReleaseFrame;
|
||||
SInt32 mRelativeKillFrame;
|
||||
|
||||
|
||||
Float32 mPitch;
|
||||
Float32 mVelocity;
|
||||
};
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: SynthNoteList.cpp
|
||||
Abstract: SynthNoteList.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "SynthNoteList.h"
|
||||
#include <stdexcept>
|
||||
@@ -52,23 +52,23 @@ void SynthNoteList::SanityCheck() const
|
||||
if (mState >= kNoteState_Unset) {
|
||||
throw std::runtime_error("SanityCheck: mState is bad");
|
||||
}
|
||||
|
||||
|
||||
if (mHead == NULL) {
|
||||
if (mTail != NULL)
|
||||
if (mTail != NULL)
|
||||
throw std::runtime_error("SanityCheck: mHead is NULL but not mTail");
|
||||
return;
|
||||
}
|
||||
if (mTail == NULL) {
|
||||
throw std::runtime_error("SanityCheck: mTail is NULL but not mHead");
|
||||
}
|
||||
|
||||
|
||||
if (mHead->mPrev) {
|
||||
throw std::runtime_error("SanityCheck: mHead has a mPrev");
|
||||
}
|
||||
if (mTail->mNext) {
|
||||
throw std::runtime_error("SanityCheck: mTail has a mNext");
|
||||
}
|
||||
|
||||
|
||||
SynthNote *note = mHead;
|
||||
while (note)
|
||||
{
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: SynthNoteList.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __SynthNoteList__
|
||||
#define __SynthNoteList__
|
||||
@@ -61,26 +61,26 @@
|
||||
struct SynthNoteList
|
||||
{
|
||||
SynthNoteList() : mState(kNoteState_Unset), mHead(0), mTail(0) {}
|
||||
|
||||
|
||||
bool NotEmpty() const { return mHead != NULL; }
|
||||
bool IsEmpty() const { return mHead == NULL; }
|
||||
void Empty() {
|
||||
void Empty() {
|
||||
#if USE_SANITY_CHECK
|
||||
SanityCheck();
|
||||
#endif
|
||||
mHead = mTail = NULL;
|
||||
mHead = mTail = NULL;
|
||||
}
|
||||
|
||||
|
||||
UInt32 Length() const {
|
||||
#if USE_SANITY_CHECK
|
||||
SanityCheck();
|
||||
#endif
|
||||
UInt32 length = 0;
|
||||
for (SynthNote* note = mHead; note; note = note->mNext)
|
||||
for (SynthNote* note = mHead; note; note = note->mNext)
|
||||
length++;
|
||||
return length;
|
||||
};
|
||||
|
||||
|
||||
void AddNote(SynthNote *inNote)
|
||||
{
|
||||
#if DEBUG_PRINT
|
||||
@@ -92,14 +92,14 @@ struct SynthNoteList
|
||||
inNote->SetState(mState);
|
||||
inNote->mNext = mHead;
|
||||
inNote->mPrev = NULL;
|
||||
|
||||
|
||||
if (mHead) { mHead->mPrev = inNote; mHead = inNote; }
|
||||
else mHead = mTail = inNote;
|
||||
#if USE_SANITY_CHECK
|
||||
SanityCheck();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void RemoveNote(SynthNote *inNote)
|
||||
{
|
||||
#if DEBUG_PRINT
|
||||
@@ -113,7 +113,7 @@ struct SynthNoteList
|
||||
|
||||
if (inNote->mNext) inNote->mNext->mPrev = inNote->mPrev;
|
||||
else mTail = inNote->mPrev;
|
||||
|
||||
|
||||
inNote->mPrev = 0;
|
||||
inNote->mNext = 0;
|
||||
#if USE_SANITY_CHECK
|
||||
@@ -131,7 +131,7 @@ struct SynthNoteList
|
||||
inNoteList->SanityCheck();
|
||||
#endif
|
||||
if (!inNoteList->mTail) return;
|
||||
|
||||
|
||||
if (mState == kNoteState_Released)
|
||||
{
|
||||
for (SynthNote* note = inNoteList->mHead; note; note = note->mNext)
|
||||
@@ -150,14 +150,14 @@ struct SynthNoteList
|
||||
note->SetState(mState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inNoteList->mTail->mNext = mHead;
|
||||
|
||||
|
||||
if (mHead) mHead->mPrev = inNoteList->mTail;
|
||||
else mTail = inNoteList->mTail;
|
||||
|
||||
|
||||
mHead = inNoteList->mHead;
|
||||
|
||||
|
||||
inNoteList->mHead = NULL;
|
||||
inNoteList->mTail = NULL;
|
||||
#if USE_SANITY_CHECK
|
||||
@@ -165,7 +165,7 @@ struct SynthNoteList
|
||||
inNoteList->SanityCheck();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
SynthNote* FindOldestNote()
|
||||
{
|
||||
#if DEBUG_PRINT
|
||||
@@ -186,7 +186,7 @@ struct SynthNoteList
|
||||
}
|
||||
return oldestNote;
|
||||
}
|
||||
|
||||
|
||||
SynthNote* FindMostQuietNote()
|
||||
{
|
||||
#if DEBUG_PRINT
|
||||
@@ -219,9 +219,9 @@ struct SynthNoteList
|
||||
#endif
|
||||
return mostQuietNote;
|
||||
}
|
||||
|
||||
|
||||
void SanityCheck() const;
|
||||
|
||||
|
||||
SynthNoteState mState;
|
||||
SynthNote * mHead;
|
||||
SynthNote * mTail;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUViewLocalizedStringKeys.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUViewLocalizedStringKeys_h__
|
||||
#define __AUViewLocalizedStringKeys_h__
|
||||
@@ -53,27 +53,27 @@
|
||||
|
||||
// UNLOCALIZED STRINGS:
|
||||
#define kAUViewUnlocalizedString_TitleSeparator CFSTR(": ")
|
||||
|
||||
|
||||
// Generic View:
|
||||
#define kAUViewLocalizedStringKey_AudioUnit CFSTR("Audio Unit")
|
||||
#define kAUViewLocalizedStringKey_Manufacturer CFSTR("Manufacturer")
|
||||
|
||||
|
||||
#define kAUViewLocalizedStringKey_FactoryPreset CFSTR("Factory Preset")
|
||||
|
||||
|
||||
#define kAUViewLocalizedStringKey_Properties CFSTR("Properties")
|
||||
#define kAUViewLocalizedStringKey_Parameters CFSTR("Parameters")
|
||||
|
||||
|
||||
#define kAUViewLocalizedStringKey_Standard CFSTR("Standard")
|
||||
#define kAUViewLocalizedStringKey_Expert CFSTR("Expert")
|
||||
|
||||
|
||||
// AULoadCPU:
|
||||
#define kAUViewLocalizedStringKey_RestrictCPULoad CFSTR("Restrict CPU Load")
|
||||
#define kAUViewLocalizedStringKey_PercentSymbol CFSTR("%")
|
||||
#define kAUViewLocalizedStringKey_NotApplicable CFSTR("n/a")
|
||||
|
||||
|
||||
// AUDiskStreamingCheckbox:
|
||||
#define kAUViewLocalizedStringKey_StreamFromDisk CFSTR("Stream From Disk")
|
||||
|
||||
|
||||
// AURenderQualityPopup:
|
||||
#define kAUViewLocalizedStringKey_RenderQuality CFSTR("Render Quality")
|
||||
#define kAUViewLocalizedStringKey_Maximum CFSTR("Maximum")
|
||||
@@ -84,5 +84,5 @@
|
||||
|
||||
// AUChannelLayoutPopUp:
|
||||
#define kAUViewLocalizedStringKey_AudioChannelLayout CFSTR("Audio Channel Layout")
|
||||
|
||||
|
||||
#endif //__AUViewLocalizedStringKeys_h__
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUEffectBase.cpp
|
||||
Abstract: AUEffectBase.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,15 +40,15 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUEffectBase.h"
|
||||
|
||||
/*
|
||||
/*
|
||||
This class does not deal as well as it should with N-M effects...
|
||||
|
||||
|
||||
The problem areas are (if the channels don't match):
|
||||
ProcessInPlace if the channels don't match - there will be problems if InputChan != OutputChan
|
||||
Bypass - its just passing the buffers through when not processing them
|
||||
@@ -84,7 +84,7 @@ void AUEffectBase::Cleanup()
|
||||
{
|
||||
for (KernelList::iterator it = mKernelList.begin(); it != mKernelList.end(); ++it)
|
||||
delete *it;
|
||||
|
||||
|
||||
mKernelList.clear();
|
||||
mMainOutput = NULL;
|
||||
mMainInput = NULL;
|
||||
@@ -113,7 +113,7 @@ OSStatus AUEffectBase::Initialize()
|
||||
if ((configNumInputs < 0) && (configNumOutputs < 0))
|
||||
{
|
||||
// unit accepts any number of channels on input and output
|
||||
if (((configNumInputs == -1) && (configNumOutputs == -2))
|
||||
if (((configNumInputs == -1) && (configNumOutputs == -2))
|
||||
|| ((configNumInputs == -2) && (configNumOutputs == -1)))
|
||||
{
|
||||
foundMatch = true;
|
||||
@@ -129,7 +129,7 @@ OSStatus AUEffectBase::Initialize()
|
||||
}
|
||||
else
|
||||
{
|
||||
// the -1 case on either scope is saying that the unit doesn't care about the
|
||||
// the -1 case on either scope is saying that the unit doesn't care about the
|
||||
// number of channels on that scope
|
||||
bool inputMatch = (auNumInputs == configNumInputs) || (configNumInputs == -1);
|
||||
bool outputMatch = (auNumOutputs == configNumOutputs) || (configNumOutputs == -1);
|
||||
@@ -152,14 +152,14 @@ OSStatus AUEffectBase::Initialize()
|
||||
}
|
||||
|
||||
MaintainKernels();
|
||||
|
||||
|
||||
mMainOutput = GetOutput(0);
|
||||
mMainInput = GetInput(0);
|
||||
|
||||
|
||||
const CAStreamBasicDescription& format = GetStreamFormat(kAudioUnitScope_Output, 0);
|
||||
format.IdentifyCommonPCMFormat(mCommonPCMFormat, NULL);
|
||||
mBytesPerFrame = format.mBytesPerFrame;
|
||||
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ OSStatus AUEffectBase::Reset( AudioUnitScope inScope,
|
||||
if (kernel != NULL)
|
||||
kernel->Reset();
|
||||
}
|
||||
|
||||
|
||||
return AUBase::Reset(inScope, inElement);
|
||||
}
|
||||
|
||||
@@ -228,10 +228,10 @@ OSStatus AUEffectBase::SetProperty( AudioUnitPropertyID inID,
|
||||
{
|
||||
if (inDataSize < sizeof(UInt32))
|
||||
return kAudioUnitErr_InvalidPropertyValue;
|
||||
|
||||
|
||||
bool tempNewSetting = *((UInt32*)inData) != 0;
|
||||
// we're changing the state of bypass
|
||||
if (tempNewSetting != IsBypassEffect())
|
||||
if (tempNewSetting != IsBypassEffect())
|
||||
{
|
||||
if (!tempNewSetting && IsBypassEffect() && IsInitialized()) // turning bypass off and we're initialized
|
||||
Reset(0, 0);
|
||||
@@ -246,16 +246,16 @@ OSStatus AUEffectBase::SetProperty( AudioUnitPropertyID inID,
|
||||
}
|
||||
return AUBase::SetProperty (inID, inScope, inElement, inData, inDataSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AUEffectBase::MaintainKernels()
|
||||
{
|
||||
#if TARGET_OS_IPHONE
|
||||
UInt32 nKernels = mOnlyOneKernel ? 1 : GetNumberOfChannels();
|
||||
#else
|
||||
#else
|
||||
UInt32 nKernels = GetNumberOfChannels();
|
||||
#endif
|
||||
|
||||
|
||||
if (mKernelList.size() < nKernels) {
|
||||
mKernelList.reserve(nKernels);
|
||||
for (UInt32 i = (UInt32)mKernelList.size(); i < nKernels; ++i)
|
||||
@@ -267,7 +267,7 @@ void AUEffectBase::MaintainKernels()
|
||||
mKernelList.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(unsigned int i = 0; i < nKernels; i++ )
|
||||
{
|
||||
if(mKernelList[i]) {
|
||||
@@ -289,7 +289,7 @@ OSStatus AUEffectBase::ChangeStreamFormat( AudioUnitScope inScope,
|
||||
{
|
||||
OSStatus result = AUBase::ChangeStreamFormat(inScope, inElement, inPrevFormat, inNewFormat);
|
||||
if (result == noErr)
|
||||
{
|
||||
{
|
||||
// for the moment this only dependency we know about
|
||||
// where a parameter's range may change is with the sample rate
|
||||
// and effects are only publishing parameters in the global scope!
|
||||
@@ -314,11 +314,11 @@ OSStatus AUEffectBase::ProcessScheduledSlice( void *inUserData,
|
||||
UInt32 inTotalBufferFrames )
|
||||
{
|
||||
ScheduledProcessParams &sliceParams = *((ScheduledProcessParams*)inUserData);
|
||||
|
||||
|
||||
AudioUnitRenderActionFlags &actionFlags = *sliceParams.actionFlags;
|
||||
AudioBufferList &inputBufferList = *sliceParams.inputBufferList;
|
||||
AudioBufferList &outputBufferList = *sliceParams.outputBufferList;
|
||||
|
||||
|
||||
UInt32 channelSize = inSliceFramesToProcess * mBytesPerFrame;
|
||||
// fix the size of the buffer we're operating on before we render this slice of time
|
||||
for(unsigned int i = 0; i < inputBufferList.mNumberBuffers; i++ ) {
|
||||
@@ -333,15 +333,15 @@ OSStatus AUEffectBase::ProcessScheduledSlice( void *inUserData,
|
||||
|
||||
// we just partially processed the buffers, so increment the data pointers to the next part of the buffer to process
|
||||
for(unsigned int i = 0; i < inputBufferList.mNumberBuffers; i++ ) {
|
||||
inputBufferList.mBuffers[i].mData =
|
||||
inputBufferList.mBuffers[i].mData =
|
||||
(char *)inputBufferList.mBuffers[i].mData + inputBufferList.mBuffers[i].mNumberChannels * channelSize;
|
||||
}
|
||||
|
||||
|
||||
for(unsigned int i = 0; i < outputBufferList.mNumberBuffers; i++ ) {
|
||||
outputBufferList.mBuffers[i].mData =
|
||||
outputBufferList.mBuffers[i].mData =
|
||||
(char *)outputBufferList.mBuffers[i].mData + outputBufferList.mBuffers[i].mNumberChannels * channelSize;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ OSStatus AUEffectBase::Render( AudioUnitRenderActionFlags &ioActionFlags,
|
||||
OSStatus result = noErr;
|
||||
|
||||
result = mMainInput->PullInput(ioActionFlags, inTimeStamp, 0 /* element */, nFrames);
|
||||
|
||||
|
||||
if (result == noErr)
|
||||
{
|
||||
if(ProcessesInPlace() && mMainOutput->WillAllocateBuffer())
|
||||
@@ -369,7 +369,7 @@ OSStatus AUEffectBase::Render( AudioUnitRenderActionFlags &ioActionFlags,
|
||||
if (ShouldBypassEffect())
|
||||
{
|
||||
// leave silence bit alone
|
||||
|
||||
|
||||
if(!ProcessesInPlace() )
|
||||
{
|
||||
mMainInput->CopyBufferContentsTo (mMainOutput->GetBufferList());
|
||||
@@ -385,22 +385,22 @@ OSStatus AUEffectBase::Render( AudioUnitRenderActionFlags &ioActionFlags,
|
||||
else
|
||||
{
|
||||
// deal with scheduled parameters...
|
||||
|
||||
|
||||
AudioBufferList &inputBufferList = mMainInput->GetBufferList();
|
||||
AudioBufferList &outputBufferList = mMainOutput->GetBufferList();
|
||||
|
||||
|
||||
ScheduledProcessParams processParams;
|
||||
processParams.actionFlags = &ioActionFlags;
|
||||
processParams.inputBufferList = &inputBufferList;
|
||||
processParams.outputBufferList = &outputBufferList;
|
||||
|
||||
|
||||
// divide up the buffer into slices according to scheduled params then
|
||||
// do the DSP for each slice (ProcessScheduledSlice() called for each slice)
|
||||
result = ProcessForScheduledParams( mParamList,
|
||||
nFrames,
|
||||
&processParams );
|
||||
|
||||
|
||||
|
||||
|
||||
// fixup the buffer pointers to how they were before we started
|
||||
UInt32 channelSize = nFrames * mBytesPerFrame;
|
||||
for(unsigned int i = 0; i < inputBufferList.mNumberBuffers; i++ ) {
|
||||
@@ -408,7 +408,7 @@ OSStatus AUEffectBase::Render( AudioUnitRenderActionFlags &ioActionFlags,
|
||||
inputBufferList.mBuffers[i].mData = (char *)inputBufferList.mBuffers[i].mData - size;
|
||||
inputBufferList.mBuffers[i].mDataByteSize = size;
|
||||
}
|
||||
|
||||
|
||||
for(unsigned int i = 0; i < outputBufferList.mNumberBuffers; i++ ) {
|
||||
UInt32 size = outputBufferList.mBuffers[i].mNumberChannels * channelSize;
|
||||
outputBufferList.mBuffers[i].mData = (char *)outputBufferList.mBuffers[i].mData - size;
|
||||
@@ -416,13 +416,13 @@ OSStatus AUEffectBase::Render( AudioUnitRenderActionFlags &ioActionFlags,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( (ioActionFlags & kAudioUnitRenderAction_OutputIsSilence) && !ProcessesInPlace() )
|
||||
{
|
||||
AUBufferList::ZeroBuffer(mMainOutput->GetBufferList() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ OSStatus AUEffectBase::ProcessBufferLists(
|
||||
{
|
||||
if (ShouldBypassEffect())
|
||||
return noErr;
|
||||
|
||||
|
||||
// interleaved (or mono)
|
||||
switch (mCommonPCMFormat) {
|
||||
case CAStreamBasicDescription::kPCMFormatFloat32 :
|
||||
@@ -450,7 +450,7 @@ OSStatus AUEffectBase::ProcessBufferLists(
|
||||
default :
|
||||
throw CAException(kAudio_UnimplementedError);
|
||||
}
|
||||
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUEffectBase.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUEffectBase_h__
|
||||
#define __AUEffectBase_h__
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
bool inProcessesInPlace = true );
|
||||
/*! @dtor ~AUEffectBase */
|
||||
~AUEffectBase();
|
||||
|
||||
|
||||
/*! @method Initialize */
|
||||
virtual OSStatus Initialize();
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
UInt32 inNumberFrames);
|
||||
|
||||
// our virtual methods
|
||||
|
||||
|
||||
// If your unit processes N to N channels, and there are no interactions between channels,
|
||||
// it can override NewKernel to create a mono processing object per channel. Otherwise,
|
||||
// don't override NewKernel, and instead, override ProcessBufferLists.
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
// convenience format accessors (use output 0's format)
|
||||
/*! @method GetSampleRate */
|
||||
Float64 GetSampleRate();
|
||||
|
||||
|
||||
/*! @method GetNumberOfChannels */
|
||||
UInt32 GetNumberOfChannels();
|
||||
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
{
|
||||
Globals()->SetParameter(paramID, value);
|
||||
}
|
||||
|
||||
|
||||
/*! @method GetParameter */
|
||||
using AUBase::GetParameter;
|
||||
AudioUnitParameterValue GetParameter( AudioUnitParameterID paramID )
|
||||
@@ -151,13 +151,13 @@ public:
|
||||
|
||||
/*! @method CanScheduleParameters */
|
||||
virtual bool CanScheduleParameters() const { return true; }
|
||||
|
||||
|
||||
/*! @method IsBypassEffect */
|
||||
// This is used for the property value - to reflect to the UI if an effect is bypassed
|
||||
bool IsBypassEffect () { return mBypassEffect; }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
/*! @method MaintainKernels */
|
||||
void MaintainKernels();
|
||||
|
||||
@@ -165,17 +165,17 @@ protected:
|
||||
// This is used in the render call to see if an effect is bypassed
|
||||
// It can return a different status than IsBypassEffect (though it MUST take that into account)
|
||||
virtual bool ShouldBypassEffect () { return IsBypassEffect(); }
|
||||
|
||||
|
||||
public:
|
||||
/*! @method SetBypassEffect */
|
||||
virtual void SetBypassEffect (bool inFlag) { mBypassEffect = inFlag; }
|
||||
|
||||
|
||||
/*! @method SetParamHasSampleRateDependency */
|
||||
void SetParamHasSampleRateDependency (bool inFlag)
|
||||
{
|
||||
mParamSRDep = inFlag;
|
||||
void SetParamHasSampleRateDependency (bool inFlag)
|
||||
{
|
||||
mParamSRDep = inFlag;
|
||||
}
|
||||
|
||||
|
||||
/*! @method GetParamHasSampleRateDependency */
|
||||
bool GetParamHasSampleRateDependency () const { return mParamSRDep; }
|
||||
|
||||
@@ -194,12 +194,12 @@ public:
|
||||
|
||||
bool ProcessesInPlace() const {return mProcessesInPlace;};
|
||||
void SetProcessesInPlace(bool inProcessesInPlace) {mProcessesInPlace = inProcessesInPlace;};
|
||||
|
||||
typedef std::vector<AUKernelBase *> KernelList;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
typedef std::vector<AUKernelBase *> KernelList;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
/*! @var mKernelList */
|
||||
KernelList mKernelList;
|
||||
|
||||
@@ -209,13 +209,13 @@ protected:
|
||||
bool IsInputSilent (AudioUnitRenderActionFlags inActionFlags, UInt32 inFramesToProcess)
|
||||
{
|
||||
bool inputSilent = (inActionFlags & kAudioUnitRenderAction_OutputIsSilence) != 0;
|
||||
|
||||
|
||||
// take latency and tail time into account when propagating the silent bit
|
||||
UInt32 silentTimeoutFrames = UInt32(GetSampleRate() * (GetLatency() + GetTailTime()));
|
||||
mSilentTimeout.Process (inFramesToProcess, silentTimeoutFrames, inputSilent);
|
||||
return inputSilent;
|
||||
}
|
||||
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
void SetOnlyOneKernel(bool inUseOnlyOneKernel) { mOnlyOneKernel = inUseOnlyOneKernel; } // set in ctor of subclass that wants it.
|
||||
#endif
|
||||
@@ -228,26 +228,26 @@ protected:
|
||||
UInt32 inFramesToProcess );
|
||||
|
||||
CAStreamBasicDescription::CommonPCMFormat GetCommonPCMFormat() const { return mCommonPCMFormat; }
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/*! @var mBypassEffect */
|
||||
bool mBypassEffect;
|
||||
/*! @var mParamSRDep */
|
||||
bool mParamSRDep;
|
||||
|
||||
|
||||
/*! @var mProcessesInplace */
|
||||
bool mProcessesInPlace;
|
||||
|
||||
|
||||
/*! @var mSilentTimeout */
|
||||
AUSilentTimeout mSilentTimeout;
|
||||
|
||||
/*! @var mMainOutput */
|
||||
AUOutputElement * mMainOutput;
|
||||
|
||||
|
||||
/*! @var mMainInput */
|
||||
AUInputElement * mMainInput;
|
||||
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
/*! @var mOnlyOneKernel */
|
||||
bool mOnlyOneKernel;
|
||||
@@ -299,16 +299,16 @@ public:
|
||||
{
|
||||
return mAudioUnit->GetSampleRate();
|
||||
}
|
||||
|
||||
|
||||
/*! @method GetParameter */
|
||||
AudioUnitParameterValue GetParameter (AudioUnitParameterID paramID)
|
||||
AudioUnitParameterValue GetParameter (AudioUnitParameterID paramID)
|
||||
{
|
||||
return mAudioUnit->GetParameter(paramID);
|
||||
}
|
||||
|
||||
|
||||
void SetChannelNum (UInt32 inChan) { mChannelNum = inChan; }
|
||||
UInt32 GetChannelNum () { return mChannelNum; }
|
||||
|
||||
|
||||
protected:
|
||||
/*! @var mAudioUnit */
|
||||
AUEffectBase * mAudioUnit;
|
||||
@@ -332,41 +332,41 @@ void AUEffectBase::ProcessBufferListsT(
|
||||
if (inBuffer.mNumberBuffers == 1) {
|
||||
if (inBuffer.mBuffers[0].mNumberChannels == 0)
|
||||
throw CAException(kAudio_ParamError);
|
||||
|
||||
|
||||
for (UInt32 channel = 0; channel < mKernelList.size(); ++channel) {
|
||||
AUKernelBase *kernel = mKernelList[channel];
|
||||
|
||||
|
||||
if (kernel == NULL) continue;
|
||||
ioSilence = silentInput;
|
||||
|
||||
|
||||
// process each interleaved channel individually
|
||||
kernel->Process(
|
||||
(const T *)inBuffer.mBuffers[0].mData + channel,
|
||||
(const T *)inBuffer.mBuffers[0].mData + channel,
|
||||
(T *)outBuffer.mBuffers[0].mData + channel,
|
||||
inFramesToProcess,
|
||||
inBuffer.mBuffers[0].mNumberChannels,
|
||||
ioSilence);
|
||||
|
||||
|
||||
if (!ioSilence)
|
||||
ioActionFlags &= ~kAudioUnitRenderAction_OutputIsSilence;
|
||||
}
|
||||
} else {
|
||||
for (UInt32 channel = 0; channel < mKernelList.size(); ++channel) {
|
||||
AUKernelBase *kernel = mKernelList[channel];
|
||||
|
||||
|
||||
if (kernel == NULL) continue;
|
||||
|
||||
|
||||
ioSilence = silentInput;
|
||||
const AudioBuffer *srcBuffer = &inBuffer.mBuffers[channel];
|
||||
AudioBuffer *destBuffer = &outBuffer.mBuffers[channel];
|
||||
|
||||
|
||||
kernel->Process(
|
||||
(const T *)srcBuffer->mData,
|
||||
(T *)destBuffer->mData,
|
||||
(const T *)srcBuffer->mData,
|
||||
(T *)destBuffer->mData,
|
||||
inFramesToProcess,
|
||||
1,
|
||||
ioSilence);
|
||||
|
||||
|
||||
if (!ioSilence)
|
||||
ioActionFlags &= ~kAudioUnitRenderAction_OutputIsSilence;
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUMIDIBase.cpp
|
||||
Abstract: AUMIDIBase.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUMIDIBase.h"
|
||||
#include <CoreMIDI/CoreMIDI.h>
|
||||
@@ -64,18 +64,18 @@ enum
|
||||
kMidiController_AllNotesOff = 123
|
||||
};
|
||||
|
||||
AUMIDIBase::AUMIDIBase(AUBase* inBase)
|
||||
: mAUBaseInstance (*inBase)
|
||||
AUMIDIBase::AUMIDIBase(AUBase* inBase)
|
||||
: mAUBaseInstance (*inBase)
|
||||
{
|
||||
#if CA_AUTO_MIDI_MAP
|
||||
mMapManager = new CAAUMIDIMapManager();
|
||||
#endif
|
||||
}
|
||||
|
||||
AUMIDIBase::~AUMIDIBase()
|
||||
AUMIDIBase::~AUMIDIBase()
|
||||
{
|
||||
#if CA_AUTO_MIDI_MAP
|
||||
if (mMapManager)
|
||||
if (mMapManager)
|
||||
delete mMapManager;
|
||||
#endif
|
||||
}
|
||||
@@ -88,7 +88,7 @@ OSStatus AUMIDIBase::DelegateGetPropertyInfo(AudioUnitPropertyID inID,
|
||||
Boolean & outWritable)
|
||||
{
|
||||
OSStatus result = noErr;
|
||||
|
||||
|
||||
switch (inID) {
|
||||
#if !TARGET_OS_IPHONE
|
||||
case kMusicDeviceProperty_MIDIXMLNames:
|
||||
@@ -100,8 +100,8 @@ OSStatus AUMIDIBase::DelegateGetPropertyInfo(AudioUnitPropertyID inID,
|
||||
} else
|
||||
result = kAudioUnitErr_InvalidProperty;
|
||||
break;
|
||||
#endif
|
||||
#if CA_AUTO_MIDI_MAP
|
||||
#endif
|
||||
#if CA_AUTO_MIDI_MAP
|
||||
case kAudioUnitProperty_AllParameterMIDIMappings:
|
||||
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
|
||||
ca_require(inElement == 0, InvalidElement);
|
||||
@@ -109,15 +109,15 @@ OSStatus AUMIDIBase::DelegateGetPropertyInfo(AudioUnitPropertyID inID,
|
||||
outDataSize = sizeof (AUParameterMIDIMapping)*mMapManager->NumMaps();
|
||||
result = noErr;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioUnitProperty_HotMapParameterMIDIMapping:
|
||||
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
|
||||
ca_require(inElement == 0, InvalidElement);
|
||||
outWritable = true;
|
||||
outDataSize = sizeof (AUParameterMIDIMapping);
|
||||
outDataSize = sizeof (AUParameterMIDIMapping);
|
||||
result = noErr;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioUnitProperty_AddParameterMIDIMapping:
|
||||
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
|
||||
ca_require(inElement == 0, InvalidElement);
|
||||
@@ -125,12 +125,12 @@ OSStatus AUMIDIBase::DelegateGetPropertyInfo(AudioUnitPropertyID inID,
|
||||
outDataSize = sizeof (AUParameterMIDIMapping);
|
||||
result = noErr;
|
||||
break;
|
||||
|
||||
|
||||
case kAudioUnitProperty_RemoveParameterMIDIMapping:
|
||||
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
|
||||
ca_require(inElement == 0, InvalidElement);
|
||||
outWritable = true;
|
||||
outDataSize = sizeof (AUParameterMIDIMapping);
|
||||
outDataSize = sizeof (AUParameterMIDIMapping);
|
||||
result = noErr;
|
||||
break;
|
||||
#endif
|
||||
@@ -155,7 +155,7 @@ OSStatus AUMIDIBase::DelegateGetProperty( AudioUnitPropertyID inID,
|
||||
void * outData)
|
||||
{
|
||||
OSStatus result;
|
||||
|
||||
|
||||
switch (inID) {
|
||||
#if !TARGET_OS_IPHONE
|
||||
case kMusicDeviceProperty_MIDIXMLNames:
|
||||
@@ -163,7 +163,7 @@ OSStatus AUMIDIBase::DelegateGetProperty( AudioUnitPropertyID inID,
|
||||
ca_require(inElement == 0, InvalidElement);
|
||||
result = GetXMLNames((CFURLRef *)outData);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#if CA_AUTO_MIDI_MAP
|
||||
case kAudioUnitProperty_AllParameterMIDIMappings:{
|
||||
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
|
||||
@@ -175,7 +175,7 @@ OSStatus AUMIDIBase::DelegateGetProperty( AudioUnitPropertyID inID,
|
||||
result = noErr;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case kAudioUnitProperty_HotMapParameterMIDIMapping:{
|
||||
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
|
||||
ca_require(inElement == 0, InvalidElement);
|
||||
@@ -185,7 +185,7 @@ OSStatus AUMIDIBase::DelegateGetProperty( AudioUnitPropertyID inID,
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
default:
|
||||
result = kAudioUnitErr_InvalidProperty;
|
||||
break;
|
||||
@@ -207,7 +207,7 @@ OSStatus AUMIDIBase::DelegateSetProperty( AudioUnitPropertyID inID,
|
||||
UInt32 inDataSize)
|
||||
{
|
||||
OSStatus result;
|
||||
|
||||
|
||||
switch (inID) {
|
||||
#if CA_AUTO_MIDI_MAP
|
||||
case kAudioUnitProperty_AddParameterMIDIMapping:{
|
||||
@@ -215,11 +215,11 @@ OSStatus AUMIDIBase::DelegateSetProperty( AudioUnitPropertyID inID,
|
||||
ca_require(inElement == 0, InvalidElement);
|
||||
AUParameterMIDIMapping * maps = (AUParameterMIDIMapping*)inData;
|
||||
mMapManager->SortedInsertToParamaterMaps (maps, (inDataSize / sizeof(AUParameterMIDIMapping)), mAUBaseInstance);
|
||||
mAUBaseInstance.PropertyChanged (kAudioUnitProperty_AllParameterMIDIMappings, kAudioUnitScope_Global, 0);
|
||||
mAUBaseInstance.PropertyChanged (kAudioUnitProperty_AllParameterMIDIMappings, kAudioUnitScope_Global, 0);
|
||||
result = noErr;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case kAudioUnitProperty_RemoveParameterMIDIMapping:{
|
||||
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
|
||||
ca_require(inElement == 0, InvalidElement);
|
||||
@@ -227,16 +227,16 @@ OSStatus AUMIDIBase::DelegateSetProperty( AudioUnitPropertyID inID,
|
||||
bool didChange;
|
||||
mMapManager->SortedRemoveFromParameterMaps(maps, (inDataSize / sizeof(AUParameterMIDIMapping)), didChange);
|
||||
if (didChange)
|
||||
mAUBaseInstance.PropertyChanged (kAudioUnitProperty_AllParameterMIDIMappings, kAudioUnitScope_Global, 0);
|
||||
mAUBaseInstance.PropertyChanged (kAudioUnitProperty_AllParameterMIDIMappings, kAudioUnitScope_Global, 0);
|
||||
result = noErr;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case kAudioUnitProperty_HotMapParameterMIDIMapping:{
|
||||
ca_require(inScope == kAudioUnitScope_Global, InvalidScope);
|
||||
ca_require(inElement == 0, InvalidElement);
|
||||
AUParameterMIDIMapping & map = *((AUParameterMIDIMapping*)inData);
|
||||
mMapManager->SetHotMapping (map);
|
||||
mMapManager->SetHotMapping (map);
|
||||
result = noErr;
|
||||
break;
|
||||
}
|
||||
@@ -249,7 +249,7 @@ OSStatus AUMIDIBase::DelegateSetProperty( AudioUnitPropertyID inID,
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
default:
|
||||
result = kAudioUnitErr_InvalidProperty;
|
||||
break;
|
||||
@@ -319,10 +319,10 @@ inline const Byte * NextMIDIEvent(const Byte *event, const Byte *end)
|
||||
OSStatus AUMIDIBase::HandleMIDIPacketList(const MIDIPacketList *pktlist)
|
||||
{
|
||||
if (!mAUBaseInstance.IsInitialized()) return kAudioUnitErr_Uninitialized;
|
||||
|
||||
|
||||
int nPackets = pktlist->numPackets;
|
||||
const MIDIPacket *pkt = pktlist->packet;
|
||||
|
||||
|
||||
while (nPackets-- > 0) {
|
||||
const Byte *event = pkt->data, *packetEnd = event + pkt->length;
|
||||
long startFrame = (long)pkt->timeStamp;
|
||||
@@ -347,20 +347,20 @@ OSStatus AUMIDIBase::HandleMIDIPacketList(const MIDIPacketList *pktlist)
|
||||
OSStatus AUMIDIBase::HandleMidiEvent(UInt8 status, UInt8 channel, UInt8 data1, UInt8 data2, UInt32 inStartFrame)
|
||||
{
|
||||
if (!mAUBaseInstance.IsInitialized()) return kAudioUnitErr_Uninitialized;
|
||||
|
||||
#if CA_AUTO_MIDI_MAP
|
||||
// you potentially have a choice to make here - if a param mapping matches, do you still want to process the
|
||||
|
||||
#if CA_AUTO_MIDI_MAP
|
||||
// you potentially have a choice to make here - if a param mapping matches, do you still want to process the
|
||||
// MIDI event or not. The default behaviour is to continue on with the MIDI event.
|
||||
if (mMapManager->HandleHotMapping (status, channel, data1, mAUBaseInstance)) {
|
||||
mAUBaseInstance.PropertyChanged (kAudioUnitProperty_HotMapParameterMIDIMapping, kAudioUnitScope_Global, 0);
|
||||
}
|
||||
else {
|
||||
mMapManager->FindParameterMapEventMatch(status, channel, data1, data2, inStartFrame, mAUBaseInstance);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
OSStatus result = noErr;
|
||||
|
||||
|
||||
switch(status)
|
||||
{
|
||||
case kMidiMessage_NoteOn:
|
||||
@@ -374,16 +374,16 @@ OSStatus AUMIDIBase::HandleMidiEvent(UInt8 status, UInt8 channel, UInt8 data1,
|
||||
result = HandleNoteOff(channel, data1, data2, inStartFrame);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kMidiMessage_NoteOff:
|
||||
result = HandleNoteOff(channel, data1, data2, inStartFrame);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
result = HandleNonNoteEvent (status, channel, data1, data2, inStartFrame);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -396,15 +396,15 @@ OSStatus AUMIDIBase::HandleNonNoteEvent (UInt8 status, UInt8 channel, UInt8 data
|
||||
case kMidiMessage_PitchWheel:
|
||||
result = HandlePitchWheel(channel, data1, data2, inStartFrame);
|
||||
break;
|
||||
|
||||
|
||||
case kMidiMessage_ProgramChange:
|
||||
result = HandleProgramChange(channel, data1);
|
||||
break;
|
||||
|
||||
|
||||
case kMidiMessage_ChannelPressure:
|
||||
result = HandleChannelPressure(channel, data1, inStartFrame);
|
||||
break;
|
||||
|
||||
|
||||
case kMidiMessage_ControlChange:
|
||||
{
|
||||
switch (data1) {
|
||||
@@ -419,7 +419,7 @@ OSStatus AUMIDIBase::HandleNonNoteEvent (UInt8 status, UInt8 channel, UInt8 data
|
||||
case kMidiController_AllSoundOff:
|
||||
result = HandleAllSoundOff(channel);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
result = HandleControlChange(channel, data1, data2, inStartFrame);
|
||||
break;
|
||||
@@ -433,7 +433,7 @@ OSStatus AUMIDIBase::HandleNonNoteEvent (UInt8 status, UInt8 channel, UInt8 data
|
||||
return result;
|
||||
}
|
||||
|
||||
OSStatus AUMIDIBase::SysEx (const UInt8 * inData,
|
||||
OSStatus AUMIDIBase::SysEx (const UInt8 * inData,
|
||||
UInt32 inLength)
|
||||
{
|
||||
if (!mAUBaseInstance.IsInitialized()) return kAudioUnitErr_Uninitialized;
|
||||
@@ -466,7 +466,7 @@ OSStatus AUMIDIBase::ComponentEntryDispatch( ComponentParameters * params,
|
||||
if (This == NULL) return kAudio_ParamError;
|
||||
|
||||
OSStatus result;
|
||||
|
||||
|
||||
switch (params->what) {
|
||||
case kMusicDeviceMIDIEventSelect:
|
||||
{
|
||||
@@ -489,7 +489,7 @@ OSStatus AUMIDIBase::ComponentEntryDispatch( ComponentParameters * params,
|
||||
result = badComponentSelector;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUMIDIBase.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUMIDIBase_h__
|
||||
#define __AUMIDIBase_h__
|
||||
@@ -66,24 +66,24 @@ public:
|
||||
AUMIDIBase(AUBase* inBase);
|
||||
/*! @dtor ~AUMIDIBase */
|
||||
virtual ~AUMIDIBase();
|
||||
|
||||
|
||||
/*! @method MIDIEvent */
|
||||
virtual OSStatus MIDIEvent( UInt32 inStatus,
|
||||
UInt32 inData1,
|
||||
UInt32 inData2,
|
||||
virtual OSStatus MIDIEvent( UInt32 inStatus,
|
||||
UInt32 inData1,
|
||||
UInt32 inData2,
|
||||
UInt32 inOffsetSampleFrame)
|
||||
{
|
||||
UInt32 strippedStatus = inStatus & 0xf0;
|
||||
UInt32 channel = inStatus & 0x0f;
|
||||
|
||||
|
||||
return HandleMidiEvent(strippedStatus, channel, inData1, inData2, inOffsetSampleFrame);
|
||||
}
|
||||
|
||||
|
||||
/*! @method HandleMIDIPacketList */
|
||||
OSStatus HandleMIDIPacketList(const MIDIPacketList *pktlist);
|
||||
|
||||
|
||||
/*! @method SysEx */
|
||||
virtual OSStatus SysEx( const UInt8 * inData,
|
||||
virtual OSStatus SysEx( const UInt8 * inData,
|
||||
UInt32 inLength);
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
void * outData);
|
||||
|
||||
|
||||
/*! @method DelegateSetProperty */
|
||||
virtual OSStatus DelegateSetProperty( AudioUnitPropertyID inID,
|
||||
AudioUnitScope inScope,
|
||||
@@ -118,15 +118,15 @@ protected:
|
||||
UInt32 inStartFrame);
|
||||
|
||||
/*! @method HandleNonNoteEvent */
|
||||
virtual OSStatus HandleNonNoteEvent ( UInt8 status,
|
||||
UInt8 channel,
|
||||
UInt8 data1,
|
||||
UInt8 data2,
|
||||
virtual OSStatus HandleNonNoteEvent ( UInt8 status,
|
||||
UInt8 channel,
|
||||
UInt8 data1,
|
||||
UInt8 data2,
|
||||
UInt32 inStartFrame);
|
||||
|
||||
#if TARGET_API_MAC_OSX
|
||||
/*! @method GetXMLNames */
|
||||
virtual OSStatus GetXMLNames(CFURLRef *outNameDocument)
|
||||
virtual OSStatus GetXMLNames(CFURLRef *outNameDocument)
|
||||
{ return kAudioUnitErr_InvalidProperty; } // if not overridden, it's unsupported
|
||||
#endif
|
||||
|
||||
@@ -136,25 +136,25 @@ protected:
|
||||
UInt8 inNoteNumber,
|
||||
UInt8 inVelocity,
|
||||
UInt32 inStartFrame) { return noErr; }
|
||||
|
||||
|
||||
/*! @method HandleNoteOff */
|
||||
virtual OSStatus HandleNoteOff( UInt8 inChannel,
|
||||
UInt8 inNoteNumber,
|
||||
UInt8 inVelocity,
|
||||
UInt32 inStartFrame) { return noErr; }
|
||||
|
||||
|
||||
/*! @method HandleControlChange */
|
||||
virtual OSStatus HandleControlChange( UInt8 inChannel,
|
||||
UInt8 inController,
|
||||
UInt8 inValue,
|
||||
UInt32 inStartFrame) { return noErr; }
|
||||
|
||||
|
||||
/*! @method HandlePitchWheel */
|
||||
virtual OSStatus HandlePitchWheel( UInt8 inChannel,
|
||||
UInt8 inPitch1,
|
||||
UInt8 inPitch2,
|
||||
UInt32 inStartFrame) { return noErr; }
|
||||
|
||||
|
||||
/*! @method HandleChannelPressure */
|
||||
virtual OSStatus HandleChannelPressure( UInt8 inChannel,
|
||||
UInt8 inValue,
|
||||
@@ -172,15 +172,15 @@ protected:
|
||||
|
||||
/*! @method HandleResetAllControllers */
|
||||
virtual OSStatus HandleResetAllControllers(UInt8 inChannel) { return noErr; }
|
||||
|
||||
|
||||
/*! @method HandleAllNotesOff */
|
||||
virtual OSStatus HandleAllNotesOff( UInt8 inChannel) { return noErr; }
|
||||
|
||||
|
||||
/*! @method HandleAllSoundOff */
|
||||
virtual OSStatus HandleAllSoundOff( UInt8 inChannel) { return noErr; }
|
||||
|
||||
|
||||
//System messages
|
||||
//System messages
|
||||
/*! @method HandleSysEx */
|
||||
virtual OSStatus HandleSysEx( const UInt8 * inData,
|
||||
UInt32 inLength ) { return noErr; }
|
||||
@@ -188,19 +188,19 @@ protected:
|
||||
#if CA_AUTO_MIDI_MAP
|
||||
/* map manager */
|
||||
CAAUMIDIMapManager *GetMIDIMapManager() {return mMapManager;};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/*! @var mAUBaseInstance */
|
||||
AUBase & mAUBaseInstance;
|
||||
|
||||
|
||||
#if CA_AUTO_MIDI_MAP
|
||||
/* map manager */
|
||||
CAAUMIDIMapManager * mMapManager;
|
||||
#endif
|
||||
|
||||
|
||||
public:
|
||||
#if !CA_USE_AUDIO_PLUGIN_ONLY
|
||||
// component dispatcher
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUMIDIEffectBase.cpp
|
||||
Abstract: AUMIDIEffectBase.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUMIDIEffectBase.h"
|
||||
|
||||
@@ -61,7 +61,7 @@ static OSStatus AUMIDIEffectBaseMIDIEvent(void * inComponentStorage,
|
||||
UInt32 inOffsetSampleFrame);
|
||||
|
||||
AUMIDIEffectBase::AUMIDIEffectBase( AudioComponentInstance inInstance,
|
||||
bool inProcessesInPlace )
|
||||
bool inProcessesInPlace )
|
||||
: AUEffectBase(inInstance, inProcessesInPlace),
|
||||
AUMIDIBase(this)
|
||||
{
|
||||
@@ -74,12 +74,12 @@ OSStatus AUMIDIEffectBase::GetPropertyInfo(AudioUnitPropertyID inID,
|
||||
Boolean & outWritable)
|
||||
{
|
||||
OSStatus result;
|
||||
|
||||
|
||||
result = AUEffectBase::GetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable);
|
||||
|
||||
|
||||
if (result == kAudioUnitErr_InvalidProperty)
|
||||
result = AUMIDIBase::DelegateGetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -99,12 +99,12 @@ OSStatus AUMIDIEffectBase::GetProperty( AudioUnitPropertyID inID,
|
||||
return kAudioUnitErr_InvalidElement;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
result = AUEffectBase::GetProperty (inID, inScope, inElement, outData);
|
||||
|
||||
|
||||
if (result == kAudioUnitErr_InvalidProperty)
|
||||
result = AUMIDIBase::DelegateGetProperty (inID, inScope, inElement, outData);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -116,10 +116,10 @@ OSStatus AUMIDIEffectBase::SetProperty( AudioUnitPropertyID inID,
|
||||
{
|
||||
|
||||
OSStatus result = AUEffectBase::SetProperty (inID, inScope, inElement, inData, inDataSize);
|
||||
|
||||
|
||||
if (result == kAudioUnitErr_InvalidProperty)
|
||||
result = AUMIDIBase::DelegateSetProperty (inID, inScope, inElement, inData, inDataSize);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ OSStatus AUMIDIEffectBase::ComponentEntryDispatch(ComponentParameters * para
|
||||
if (This == NULL) return paramErr;
|
||||
|
||||
OSStatus result;
|
||||
|
||||
|
||||
switch (params->what) {
|
||||
case kMusicDeviceMIDIEventSelect:
|
||||
case kMusicDeviceSysExSelect:
|
||||
@@ -141,7 +141,7 @@ OSStatus AUMIDIEffectBase::ComponentEntryDispatch(ComponentParameters * para
|
||||
result = AUEffectBase::ComponentEntryDispatch(params, This);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUMIDIEffectBase.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUMIDIEffectBase_h__
|
||||
#define __AUMIDIEffectBase_h__
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
{
|
||||
return AUMIDIBase::MIDIEvent (inStatus, inData1, inData2, inOffsetSampleFrame);
|
||||
}
|
||||
|
||||
|
||||
/*! @method SysEx */
|
||||
virtual OSStatus SysEx(const UInt8 * inData,
|
||||
UInt32 inLength)
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUOutputBase.cpp
|
||||
Abstract: AUOutputBase.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#if !CA_USE_AUDIO_PLUGIN_ONLY
|
||||
#include "AUOutputBase.h"
|
||||
@@ -52,7 +52,7 @@ OSStatus AUOutputBase::ComponentEntryDispatch(ComponentParameters *params, AUOu
|
||||
if (This == NULL) return paramErr;
|
||||
|
||||
OSStatus result;
|
||||
|
||||
|
||||
switch (params->what) {
|
||||
case kAudioOutputUnitStartSelect:
|
||||
{
|
||||
@@ -70,7 +70,7 @@ OSStatus AUOutputBase::ComponentEntryDispatch(ComponentParameters *params, AUOu
|
||||
result = badComponentSelector;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUOutputBase.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUOutputBase_h__
|
||||
#define __AUOutputBase_h__
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
// additional component entry points
|
||||
/*! @method Start */
|
||||
virtual OSStatus Start() = 0;
|
||||
|
||||
|
||||
/*! @method Stop */
|
||||
virtual OSStatus Stop() = 0;
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUPannerBase.cpp
|
||||
Abstract: AUPannerBase.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUPannerBase.h"
|
||||
#include "CABundleLocker.h"
|
||||
@@ -51,13 +51,13 @@
|
||||
|
||||
static bool sLocalized = false;
|
||||
|
||||
static CFStringRef kPanner_Azimuth_Name = CFSTR("azimuth");
|
||||
static CFStringRef kPanner_Elevation_Name = CFSTR("elevation");
|
||||
static CFStringRef kPanner_Azimuth_Name = CFSTR("azimuth");
|
||||
static CFStringRef kPanner_Elevation_Name = CFSTR("elevation");
|
||||
static CFStringRef kPanner_Distance_Name = CFSTR("distance");
|
||||
|
||||
static CFStringRef kPanner_CoordScale_Name = CFSTR("coordinate scale");
|
||||
static CFStringRef kPanner_RefDistance_Name = CFSTR("reference distance");
|
||||
static CFStringRef kPanner_Gain_Name = CFSTR("gain");
|
||||
static CFStringRef kPanner_CoordScale_Name = CFSTR("coordinate scale");
|
||||
static CFStringRef kPanner_RefDistance_Name = CFSTR("reference distance");
|
||||
static CFStringRef kPanner_Gain_Name = CFSTR("gain");
|
||||
|
||||
static Float32 kPannerParamDefault_Azimuth = 0.;
|
||||
static Float32 kPannerParamDefault_Elevation = 0.;
|
||||
@@ -75,30 +75,30 @@ AUPannerBase::AUPannerBase(AudioComponentInstance inAudioUnit)
|
||||
{
|
||||
CABundleLocker lock;
|
||||
if (!sLocalized)
|
||||
{
|
||||
{
|
||||
CFBundleRef bundle = CFBundleGetBundleWithIdentifier( CFSTR("com.apple.audio.units.Components") );
|
||||
if (bundle != NULL)
|
||||
{
|
||||
kPanner_Azimuth_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Azimuth_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
|
||||
kPanner_Elevation_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Elevation_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
|
||||
kPanner_Distance_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Distance_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
|
||||
|
||||
|
||||
kPanner_CoordScale_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_CoordScale_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
|
||||
kPanner_RefDistance_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_RefDistance_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
|
||||
kPanner_Gain_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Gain_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
|
||||
|
||||
}
|
||||
|
||||
|
||||
sLocalized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CreateElements();
|
||||
|
||||
|
||||
SetParameter(kPannerParam_Azimuth, kPannerParamDefault_Azimuth);
|
||||
SetParameter(kPannerParam_Elevation, kPannerParamDefault_Elevation);
|
||||
SetParameter(kPannerParam_Distance, kPannerParamDefault_Distance);
|
||||
|
||||
|
||||
SetParameter(kPannerParam_CoordScale, kPannerParamDefault_CoordScale);
|
||||
SetParameter(kPannerParam_RefDistance, kPannerParamDefault_RefDistance);
|
||||
SetParameter(kPannerParam_Gain, kPannerParamDefault_Gain);
|
||||
@@ -135,13 +135,13 @@ void AUPannerBase::AllocBypassMatrix()
|
||||
static AudioChannelLayoutTag DefaultTagForNumberOfChannels(UInt32 inNumberChannels)
|
||||
{
|
||||
switch (inNumberChannels) {
|
||||
case 1: return kAudioChannelLayoutTag_Mono;
|
||||
case 2: return kAudioChannelLayoutTag_Stereo;
|
||||
case 4: return kAudioChannelLayoutTag_Quadraphonic;
|
||||
case 5: return kAudioChannelLayoutTag_AudioUnit_5_0;
|
||||
case 6: return kAudioChannelLayoutTag_AudioUnit_6_0;
|
||||
case 7: return kAudioChannelLayoutTag_AudioUnit_7_0;
|
||||
case 8: return kAudioChannelLayoutTag_AudioUnit_8;
|
||||
case 1: return kAudioChannelLayoutTag_Mono;
|
||||
case 2: return kAudioChannelLayoutTag_Stereo;
|
||||
case 4: return kAudioChannelLayoutTag_Quadraphonic;
|
||||
case 5: return kAudioChannelLayoutTag_AudioUnit_5_0;
|
||||
case 6: return kAudioChannelLayoutTag_AudioUnit_6_0;
|
||||
case 7: return kAudioChannelLayoutTag_AudioUnit_7_0;
|
||||
case 8: return kAudioChannelLayoutTag_AudioUnit_8;
|
||||
|
||||
default: return 0xFFFF0000 | inNumberChannels;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ static AudioChannelLayoutTag DefaultTagForNumberOfChannels(UInt32 inNumberChanne
|
||||
OSStatus AUPannerBase::SetDefaultChannelLayoutsIfNone()
|
||||
{
|
||||
OSStatus err = noErr;
|
||||
|
||||
|
||||
// if layout has not been set, then guess layout from number of channels
|
||||
UInt32 inChannels = GetNumberOfInputChannels();
|
||||
AudioChannelLayout inputLayoutSubstitute;
|
||||
@@ -168,7 +168,7 @@ OSStatus AUPannerBase::SetDefaultChannelLayoutsIfNone()
|
||||
err = SetAudioChannelLayout(kAudioUnitScope_Input, 0, &GetInputLayout());
|
||||
if (err) return err;
|
||||
}
|
||||
|
||||
|
||||
// if layout has not been set, then guess layout from number of channels
|
||||
UInt32 outChannels = GetNumberOfOutputChannels();
|
||||
AudioChannelLayout outputLayoutSubstitute;
|
||||
@@ -183,29 +183,29 @@ OSStatus AUPannerBase::SetDefaultChannelLayoutsIfNone()
|
||||
err = SetAudioChannelLayout(kAudioUnitScope_Output, 0, &GetOutputLayout());
|
||||
if (err) return err;
|
||||
}
|
||||
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
OSStatus AUPannerBase::UpdateBypassMatrix()
|
||||
{
|
||||
OSStatus err = SetDefaultChannelLayoutsIfNone();
|
||||
if (err) return err;
|
||||
|
||||
|
||||
UInt32 inChannels = GetNumberOfInputChannels();
|
||||
UInt32 outChannels = GetNumberOfOutputChannels();
|
||||
|
||||
UInt32 outChannels = GetNumberOfOutputChannels();
|
||||
|
||||
const AudioChannelLayout* inoutACL[2];
|
||||
|
||||
|
||||
inoutACL[0] = &GetInputLayout();
|
||||
inoutACL[1] = &GetOutputLayout();
|
||||
|
||||
mBypassMatrix.alloc(inChannels * outChannels, true);
|
||||
|
||||
|
||||
UInt32 propSize = inChannels * outChannels * sizeof(Float32);
|
||||
|
||||
|
||||
err = AudioFormatGetProperty(kAudioFormatProperty_MatrixMixMap, sizeof(inoutACL), inoutACL, &propSize, mBypassMatrix());
|
||||
if (err) {
|
||||
// if there is an error, use a diagonal matrix.
|
||||
@@ -225,7 +225,7 @@ OSStatus AUPannerBase::UpdateBypassMatrix()
|
||||
/*! @method Cleanup */
|
||||
void AUPannerBase::Cleanup()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -249,9 +249,9 @@ OSStatus AUPannerBase::GetParameterInfo( AudioUnitScope inScope,
|
||||
|
||||
outParameterInfo.flags = kAudioUnitParameterFlag_IsWritable
|
||||
+ kAudioUnitParameterFlag_IsReadable;
|
||||
|
||||
|
||||
if (inScope == kAudioUnitScope_Global) {
|
||||
|
||||
|
||||
switch(inParameterID)
|
||||
{
|
||||
case kPannerParam_Azimuth:
|
||||
@@ -279,7 +279,7 @@ OSStatus AUPannerBase::GetParameterInfo( AudioUnitScope inScope,
|
||||
outParameterInfo.flags += kAudioUnitParameterFlag_IsHighResolution;
|
||||
//outParameterInfo.flags += kAudioUnitParameterFlag_DisplayLogarithmic;
|
||||
break;
|
||||
|
||||
|
||||
case kPannerParam_CoordScale:
|
||||
AUBase::FillInParameterName (outParameterInfo, kPanner_CoordScale_Name, false);
|
||||
outParameterInfo.unit = kAudioUnitParameterUnit_Meters;
|
||||
@@ -313,9 +313,9 @@ OSStatus AUPannerBase::GetParameterInfo( AudioUnitScope inScope,
|
||||
} else {
|
||||
result = kAudioUnitErr_InvalidParameter;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
//
|
||||
@@ -324,15 +324,15 @@ OSStatus AUPannerBase::GetParameter( AudioUnitParameterID inParamID,
|
||||
AudioUnitElement inElement,
|
||||
Float32 & outValue)
|
||||
{
|
||||
if (inScope != kAudioUnitScope_Global)
|
||||
if (inScope != kAudioUnitScope_Global)
|
||||
return kAudioUnitErr_InvalidScope;
|
||||
|
||||
|
||||
outValue = Globals()->GetParameter(inParamID);
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
//
|
||||
OSStatus AUPannerBase::SetParameter( AudioUnitParameterID inParamID,
|
||||
@@ -341,11 +341,11 @@ OSStatus AUPannerBase::SetParameter( AudioUnitParameterID inParamID,
|
||||
Float32 inValue,
|
||||
UInt32 inBufferOffsetInFrames)
|
||||
{
|
||||
if (inScope != kAudioUnitScope_Global)
|
||||
if (inScope != kAudioUnitScope_Global)
|
||||
return kAudioUnitErr_InvalidScope;
|
||||
|
||||
Globals()->SetParameter(inParamID, inValue);
|
||||
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ OSStatus AUPannerBase::GetPropertyInfo (AudioUnitPropertyID inID,
|
||||
case kAudioUnitProperty_BypassEffect:
|
||||
if (inScope != kAudioUnitScope_Global)
|
||||
return kAudioUnitErr_InvalidScope;
|
||||
|
||||
|
||||
outWritable = true;
|
||||
outDataSize = sizeof (UInt32);
|
||||
break;
|
||||
@@ -384,7 +384,7 @@ OSStatus AUPannerBase::GetProperty (AudioUnitPropertyID inID,
|
||||
void * outData)
|
||||
{
|
||||
OSStatus err = noErr;
|
||||
switch (inID)
|
||||
switch (inID)
|
||||
{
|
||||
case kAudioUnitProperty_BypassEffect:
|
||||
if (inScope != kAudioUnitScope_Global)
|
||||
@@ -407,14 +407,14 @@ OSStatus AUPannerBase::SetProperty(AudioUnitPropertyID inID,
|
||||
const void * inData,
|
||||
UInt32 inDataSize)
|
||||
{
|
||||
switch (inID)
|
||||
switch (inID)
|
||||
{
|
||||
case kAudioUnitProperty_BypassEffect:
|
||||
if (inDataSize < sizeof(UInt32))
|
||||
return kAudioUnitErr_InvalidPropertyValue;
|
||||
bool tempNewSetting = *((UInt32*)inData) != 0;
|
||||
// we're changing the state of bypass
|
||||
if (tempNewSetting != IsBypassEffect())
|
||||
if (tempNewSetting != IsBypassEffect())
|
||||
{
|
||||
if (!tempNewSetting && IsBypassEffect() && IsInitialized()) // turning bypass off and we're initialized
|
||||
Reset(0, 0);
|
||||
@@ -444,15 +444,15 @@ OSStatus AUPannerBase::ChangeStreamFormat (
|
||||
const CAStreamBasicDescription & inPrevFormat,
|
||||
const CAStreamBasicDescription & inNewFormat)
|
||||
{
|
||||
if (inScope == kAudioUnitScope_Input && !InputChannelConfigIsSupported(inNewFormat.NumberChannels()))
|
||||
if (inScope == kAudioUnitScope_Input && !InputChannelConfigIsSupported(inNewFormat.NumberChannels()))
|
||||
return kAudioUnitErr_FormatNotSupported;
|
||||
|
||||
if (inScope == kAudioUnitScope_Output && !OutputChannelConfigIsSupported(inNewFormat.NumberChannels()))
|
||||
|
||||
if (inScope == kAudioUnitScope_Output && !OutputChannelConfigIsSupported(inNewFormat.NumberChannels()))
|
||||
return kAudioUnitErr_FormatNotSupported;
|
||||
|
||||
|
||||
if (inNewFormat.NumberChannels() != inPrevFormat.NumberChannels())
|
||||
RemoveAudioChannelLayout(inScope, inElement);
|
||||
|
||||
|
||||
return AUBase::ChangeStreamFormat(inScope, inElement, inPrevFormat, inNewFormat);
|
||||
}
|
||||
|
||||
@@ -463,9 +463,9 @@ OSStatus AUPannerBase::Render(AudioUnitRenderActionFlags & ioActionFlags,
|
||||
const AudioTimeStamp & inTimeStamp,
|
||||
UInt32 inNumberFrames)
|
||||
{
|
||||
if (IsBypassEffect())
|
||||
if (IsBypassEffect())
|
||||
return BypassRender(ioActionFlags, inTimeStamp, inNumberFrames);
|
||||
else
|
||||
else
|
||||
return PannerRender(ioActionFlags, inTimeStamp, inNumberFrames);
|
||||
}
|
||||
|
||||
@@ -483,16 +483,16 @@ OSStatus AUPannerBase::BypassRender(AudioUnitRenderActionFlags & ioActionFlags
|
||||
|
||||
AudioBufferList& outputBufferList = GetOutput(0)->GetBufferList();
|
||||
AUBufferList::ZeroBuffer(outputBufferList);
|
||||
|
||||
if (!isSilent)
|
||||
|
||||
if (!isSilent)
|
||||
{
|
||||
UInt32 inChannels = GetNumberOfInputChannels();
|
||||
UInt32 outChannels = GetNumberOfOutputChannels();
|
||||
Float32* bypass = mBypassMatrix();
|
||||
for (UInt32 outChan = 0; outChan < outChannels; ++outChan)
|
||||
{
|
||||
float* outData = GetOutput(0)->GetChannelData(outChan);
|
||||
|
||||
float* outData = GetOutput(0)->GetChannelData(outChan);
|
||||
|
||||
for (UInt32 inChan = 0; inChan < inChannels; ++inChan)
|
||||
{
|
||||
float* inData = GetInput(0)->GetChannelData(inChan);
|
||||
@@ -510,13 +510,13 @@ UInt32 AUPannerBase::GetAudioChannelLayout( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
AudioChannelLayout * outLayoutPtr,
|
||||
Boolean & outWritable)
|
||||
{
|
||||
{
|
||||
SetDefaultChannelLayoutsIfNone();
|
||||
|
||||
|
||||
outWritable = true;
|
||||
|
||||
|
||||
CAAudioChannelLayout* caacl = NULL;
|
||||
switch (inScope)
|
||||
switch (inScope)
|
||||
{
|
||||
case kAudioUnitScope_Input:
|
||||
caacl = &mInputLayout;
|
||||
@@ -527,14 +527,14 @@ UInt32 AUPannerBase::GetAudioChannelLayout( AudioUnitScope inScope,
|
||||
default:
|
||||
COMPONENT_THROW(kAudioUnitErr_InvalidScope);
|
||||
}
|
||||
|
||||
|
||||
if (inElement != 0)
|
||||
COMPONENT_THROW(kAudioUnitErr_InvalidElement);
|
||||
|
||||
|
||||
UInt32 size = caacl->IsValid() ? caacl->Size() : 0;
|
||||
if (size > 0 && outLayoutPtr)
|
||||
memcpy(outLayoutPtr, &caacl->Layout(), size);
|
||||
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ OSStatus AUPannerBase::RemoveAudioChannelLayout( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement)
|
||||
{
|
||||
CAAudioChannelLayout* caacl = NULL;
|
||||
switch (inScope)
|
||||
switch (inScope)
|
||||
{
|
||||
case kAudioUnitScope_Input:
|
||||
caacl = &mInputLayout;
|
||||
@@ -555,17 +555,17 @@ OSStatus AUPannerBase::RemoveAudioChannelLayout( AudioUnitScope inScope,
|
||||
default:
|
||||
return kAudioUnitErr_InvalidScope;
|
||||
}
|
||||
|
||||
|
||||
if (inElement != 0)
|
||||
return kAudioUnitErr_InvalidElement;
|
||||
|
||||
|
||||
*caacl = NULL;
|
||||
return noErr;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
//
|
||||
OSStatus AUPannerBase::SetAudioChannelLayout( AudioUnitScope inScope,
|
||||
OSStatus AUPannerBase::SetAudioChannelLayout( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
const AudioChannelLayout * inLayout)
|
||||
{
|
||||
@@ -574,10 +574,10 @@ OSStatus AUPannerBase::SetAudioChannelLayout( AudioUnitScope inScope,
|
||||
|
||||
if (!ChannelLayoutTagIsSupported(inScope, inElement, inLayout->mChannelLayoutTag))
|
||||
return kAudioUnitErr_FormatNotSupported;
|
||||
|
||||
|
||||
CAAudioChannelLayout* caacl = NULL;
|
||||
UInt32 currentChannels;
|
||||
switch (inScope)
|
||||
switch (inScope)
|
||||
{
|
||||
case kAudioUnitScope_Input:
|
||||
caacl = &mInputLayout;
|
||||
@@ -590,28 +590,28 @@ OSStatus AUPannerBase::SetAudioChannelLayout( AudioUnitScope inScope,
|
||||
default:
|
||||
return kAudioUnitErr_InvalidScope;
|
||||
}
|
||||
|
||||
|
||||
if (inElement != 0)
|
||||
return kAudioUnitErr_InvalidElement;
|
||||
|
||||
UInt32 numChannelsInLayout = CAAudioChannelLayout::NumberChannels(*inLayout);
|
||||
if (currentChannels != numChannelsInLayout)
|
||||
return kAudioUnitErr_InvalidPropertyValue;
|
||||
|
||||
|
||||
*caacl = inLayout;
|
||||
if (IsInitialized())
|
||||
UpdateBypassMatrix();
|
||||
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
//
|
||||
UInt32 AUPannerBase::GetChannelLayoutTags( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
AudioUnitElement inElement,
|
||||
AudioChannelLayoutTag* outTags)
|
||||
{
|
||||
switch (inScope)
|
||||
switch (inScope)
|
||||
{
|
||||
case kAudioUnitScope_Input:
|
||||
if (outTags) {
|
||||
@@ -687,20 +687,20 @@ bool AUPannerBase::OutputChannelConfigIsSupported(UInt32 inNumberChannels)
|
||||
|
||||
//_____________________________________________________________________________
|
||||
//
|
||||
bool AUPannerBase::ChannelLayoutTagIsSupported( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
bool AUPannerBase::ChannelLayoutTagIsSupported( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
AudioChannelLayoutTag inTag)
|
||||
{
|
||||
UInt32 numTags = GetChannelLayoutTags(inScope, inElement, NULL);
|
||||
CAAutoFree<AudioChannelLayoutTag> tags(numTags);
|
||||
GetChannelLayoutTags(inScope, inElement, tags());
|
||||
|
||||
|
||||
for (UInt32 i = 0; i < numTags; ++i)
|
||||
{
|
||||
if (tags[i] == inTag)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUPannerBase.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUPannerBase_h__
|
||||
#define __AUPannerBase_h__
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
AUPannerBase(AudioComponentInstance inAudioUnit);
|
||||
/*! @dtor ~AUPannerBase */
|
||||
virtual ~AUPannerBase();
|
||||
|
||||
|
||||
/*! @method Initialize */
|
||||
virtual OSStatus Initialize();
|
||||
|
||||
@@ -114,14 +114,14 @@ public:
|
||||
const CAStreamBasicDescription & inPrevFormat,
|
||||
const CAStreamBasicDescription & inNewFormat);
|
||||
|
||||
|
||||
|
||||
/*! @method IsBypassEffect */
|
||||
// This is used for the property value - to reflect to the UI if an effect is bypassed
|
||||
bool IsBypassEffect () { return mBypassEffect; }
|
||||
|
||||
|
||||
/*! @method SetBypassEffect */
|
||||
virtual void SetBypassEffect (bool inFlag) { mBypassEffect = inFlag; }
|
||||
|
||||
|
||||
|
||||
/*! @method Render */
|
||||
virtual OSStatus Render(AudioUnitRenderActionFlags & ioActionFlags,
|
||||
@@ -146,17 +146,17 @@ public:
|
||||
Boolean & outWritable);
|
||||
|
||||
/*! @method SetAudioChannelLayout */
|
||||
virtual OSStatus SetAudioChannelLayout( AudioUnitScope inScope,
|
||||
virtual OSStatus SetAudioChannelLayout( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
const AudioChannelLayout * inLayout);
|
||||
|
||||
/*! @method RemoveAudioChannelLayout */
|
||||
virtual OSStatus RemoveAudioChannelLayout( AudioUnitScope inScope,
|
||||
virtual OSStatus RemoveAudioChannelLayout( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement);
|
||||
|
||||
/*! @method GetChannelLayoutTags */
|
||||
virtual UInt32 GetChannelLayoutTags( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
AudioUnitElement inElement,
|
||||
AudioChannelLayoutTag* outTags);
|
||||
|
||||
/*! @method GetNumberOfInputChannels */
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
Float32 & outValue);
|
||||
|
||||
|
||||
/*! @method SetParameter */
|
||||
virtual OSStatus SetParameter( AudioUnitParameterID inParamID,
|
||||
AudioUnitScope inScope,
|
||||
@@ -185,7 +185,7 @@ public:
|
||||
OSStatus err = SetParameter(inParamID, kAudioUnitScope_Global, 0, inValue, 0);
|
||||
if (err) throw err;
|
||||
}
|
||||
|
||||
|
||||
/*! @method GetParameter */
|
||||
Float32 GetParameter( UInt32 inParamID )
|
||||
{
|
||||
@@ -219,8 +219,8 @@ public:
|
||||
/*! @method GetCoordScale */
|
||||
Float32 GetCoordScale() { return GetParameter(kPannerParam_CoordScale); }
|
||||
/*! @method GetRefDistance */
|
||||
Float32 GetRefDistance() { return GetParameter(kPannerParam_RefDistance); }
|
||||
|
||||
Float32 GetRefDistance() { return GetParameter(kPannerParam_RefDistance); }
|
||||
|
||||
/*! @method SetGain */
|
||||
void SetGain(Float32 inValue) { SetParameter(kPannerParam_Gain, inValue); }
|
||||
/*! @method SetAzimuth */
|
||||
@@ -233,7 +233,7 @@ public:
|
||||
void SetCoordScale(Float32 inValue) { SetParameter(kPannerParam_CoordScale, inValue); }
|
||||
/*! @method SetRefDistance */
|
||||
void SetRefDistance(Float32 inValue) { SetParameter(kPannerParam_RefDistance, inValue); }
|
||||
|
||||
|
||||
protected:
|
||||
/*! @method ShouldBypassEffect */
|
||||
// This is used in the render call to see if an effect is bypassed
|
||||
@@ -248,17 +248,17 @@ protected:
|
||||
|
||||
/*! @method SetDefaultChannelLayoutsIfNone */
|
||||
OSStatus SetDefaultChannelLayoutsIfNone();
|
||||
|
||||
|
||||
/*! @method ChannelLayoutTagIsSupported */
|
||||
bool ChannelLayoutTagIsSupported( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
bool ChannelLayoutTagIsSupported( AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
AudioChannelLayoutTag inTag);
|
||||
|
||||
|
||||
const AudioChannelLayout& GetInputLayout() const { return mInputLayout.Layout(); }
|
||||
const AudioChannelLayout& GetOutputLayout() const { return mOutputLayout.Layout(); }
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
/*! @var UpdateBypassMatrix */
|
||||
bool mBypassEffect;
|
||||
/*! @var mBypassMatrix */
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: MusicDeviceBase.cpp
|
||||
Abstract: MusicDeviceBase.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "MusicDeviceBase.h"
|
||||
|
||||
@@ -90,10 +90,10 @@ static OSStatus MusicDeviceBaseStopNote(void * inComponentStorage,
|
||||
|
||||
#endif
|
||||
|
||||
MusicDeviceBase::MusicDeviceBase(AudioComponentInstance inInstance,
|
||||
MusicDeviceBase::MusicDeviceBase(AudioComponentInstance inInstance,
|
||||
UInt32 numInputs,
|
||||
UInt32 numOutputs,
|
||||
UInt32 numGroups)
|
||||
UInt32 numGroups)
|
||||
: AUBase(inInstance, numInputs, numOutputs, numGroups),
|
||||
AUMIDIBase(this)
|
||||
{
|
||||
@@ -106,8 +106,8 @@ OSStatus MusicDeviceBase::GetPropertyInfo(AudioUnitPropertyID inID,
|
||||
Boolean & outWritable)
|
||||
{
|
||||
OSStatus result;
|
||||
|
||||
switch (inID)
|
||||
|
||||
switch (inID)
|
||||
{
|
||||
#if !TARGET_OS_IPHONE
|
||||
case kMusicDeviceProperty_InstrumentCount:
|
||||
@@ -119,7 +119,7 @@ OSStatus MusicDeviceBase::GetPropertyInfo(AudioUnitPropertyID inID,
|
||||
#endif
|
||||
default:
|
||||
result = AUBase::GetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable);
|
||||
|
||||
|
||||
if (result == kAudioUnitErr_InvalidProperty)
|
||||
result = AUMIDIBase::DelegateGetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable);
|
||||
break;
|
||||
@@ -134,7 +134,7 @@ OSStatus MusicDeviceBase::GetProperty( AudioUnitPropertyID inID,
|
||||
{
|
||||
OSStatus result;
|
||||
|
||||
switch (inID)
|
||||
switch (inID)
|
||||
{
|
||||
#if !CA_USE_AUDIO_PLUGIN_ONLY
|
||||
case kAudioUnitProperty_FastDispatch:
|
||||
@@ -146,7 +146,7 @@ OSStatus MusicDeviceBase::GetProperty( AudioUnitPropertyID inID,
|
||||
else if (inElement == kMusicDeviceStartNoteSelect) {
|
||||
*(TEMP_MusicDeviceStartNoteProc *)outData = MusicDeviceBaseStartNote;
|
||||
return noErr;
|
||||
}
|
||||
}
|
||||
else if (inElement == kMusicDeviceStopNoteSelect) {
|
||||
*(TEMP_MusicDeviceStopNoteProc *)outData = MusicDeviceBaseStopNote;
|
||||
return noErr;
|
||||
@@ -161,11 +161,11 @@ OSStatus MusicDeviceBase::GetProperty( AudioUnitPropertyID inID,
|
||||
#endif
|
||||
default:
|
||||
result = AUBase::GetProperty (inID, inScope, inElement, outData);
|
||||
|
||||
|
||||
if (result == kAudioUnitErr_InvalidProperty)
|
||||
result = AUMIDIBase::DelegateGetProperty (inID, inScope, inElement, outData);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -179,10 +179,10 @@ OSStatus MusicDeviceBase::SetProperty( AudioUnitPropertyID inID,
|
||||
{
|
||||
|
||||
OSStatus result = AUBase::SetProperty (inID, inScope, inElement, inData, inDataSize);
|
||||
|
||||
|
||||
if (result == kAudioUnitErr_InvalidProperty)
|
||||
result = AUMIDIBase::DelegateSetProperty (inID, inScope, inElement, inData, inDataSize);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ OSStatus MusicDeviceBase::HandleNoteOn( UInt8 inChannel,
|
||||
params.mVelocity = inVelocity;
|
||||
return StartNote (kMusicNoteEvent_UseGroupInstrument, inChannel, NULL, inStartFrame, params);
|
||||
}
|
||||
|
||||
|
||||
OSStatus MusicDeviceBase::HandleNoteOff( UInt8 inChannel,
|
||||
UInt8 inNoteNumber,
|
||||
UInt8 inVelocity,
|
||||
@@ -214,17 +214,17 @@ OSStatus MusicDeviceBase::HandleNoteOff( UInt8 inChannel,
|
||||
return StopNote (inChannel, inNoteNumber, inStartFrame);
|
||||
}
|
||||
|
||||
OSStatus
|
||||
MusicDeviceBase::HandleStartNoteMessage (MusicDeviceInstrumentID inInstrument,
|
||||
MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID * outNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
OSStatus
|
||||
MusicDeviceBase::HandleStartNoteMessage (MusicDeviceInstrumentID inInstrument,
|
||||
MusicDeviceGroupID inGroupID,
|
||||
NoteInstanceID * outNoteInstanceID,
|
||||
UInt32 inOffsetSampleFrame,
|
||||
const MusicDeviceNoteParams * inParams)
|
||||
{
|
||||
if (inParams == NULL || outNoteInstanceID == NULL) return kAudio_ParamError;
|
||||
|
||||
if (!IsInitialized()) return kAudioUnitErr_Uninitialized;
|
||||
|
||||
|
||||
return StartNote (inInstrument, inGroupID, outNoteInstanceID, inOffsetSampleFrame, *inParams);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ OSStatus MusicDeviceBase::ComponentEntryDispatch( ComponentParameters * param
|
||||
if (This == NULL) return kAudio_ParamError;
|
||||
|
||||
OSStatus result;
|
||||
|
||||
|
||||
switch (params->what) {
|
||||
case kMusicDeviceMIDIEventSelect:
|
||||
case kMusicDeviceSysExSelect:
|
||||
@@ -294,7 +294,7 @@ OSStatus MusicDeviceBase::ComponentEntryDispatch( ComponentParameters * param
|
||||
result = AUBase::ComponentEntryDispatch(params, This);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: MusicDeviceBase.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __MusicDeviceBase_h__
|
||||
#define __MusicDeviceBase_h__
|
||||
@@ -57,23 +57,23 @@
|
||||
class MusicDeviceBase : public AUBase, public AUMIDIBase {
|
||||
public:
|
||||
/*! @ctor MusicDeviceBase */
|
||||
MusicDeviceBase( AudioComponentInstance inInstance,
|
||||
MusicDeviceBase( AudioComponentInstance inInstance,
|
||||
UInt32 numInputs,
|
||||
UInt32 numOutputs,
|
||||
UInt32 numGroups = 0);
|
||||
|
||||
|
||||
virtual OSStatus MIDIEvent( UInt32 inStatus,
|
||||
UInt32 inData1,
|
||||
UInt32 inData2,
|
||||
virtual OSStatus MIDIEvent( UInt32 inStatus,
|
||||
UInt32 inData1,
|
||||
UInt32 inData2,
|
||||
UInt32 inOffsetSampleFrame)
|
||||
{
|
||||
return AUMIDIBase::MIDIEvent (inStatus, inData1, inData2, inOffsetSampleFrame);
|
||||
}
|
||||
|
||||
/*! @method SysEx */
|
||||
virtual OSStatus SysEx( const UInt8 * inData,
|
||||
UInt32 inLength)
|
||||
virtual OSStatus SysEx( const UInt8 * inData,
|
||||
UInt32 inLength)
|
||||
{
|
||||
return AUMIDIBase::SysEx (inData, inLength);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitElement inElement,
|
||||
void * outData);
|
||||
|
||||
|
||||
/*! @method SetProperty */
|
||||
virtual OSStatus SetProperty( AudioUnitPropertyID inID,
|
||||
AudioUnitScope inScope,
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
UInt8 inNoteNumber,
|
||||
UInt8 inVelocity,
|
||||
UInt32 inStartFrame);
|
||||
|
||||
|
||||
/*! @method HandleNoteOff */
|
||||
virtual OSStatus HandleNoteOff( UInt8 inChannel,
|
||||
UInt8 inNoteNumber,
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUBaseHelper.cpp
|
||||
Abstract: AUBaseHelper.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUBaseHelper.h"
|
||||
|
||||
@@ -53,18 +53,18 @@
|
||||
#endif
|
||||
|
||||
OSStatus GetFileRefPath (CFDictionaryRef parent, CFStringRef frKey, CFStringRef * fPath)
|
||||
{
|
||||
{
|
||||
static CFStringRef kFRString = CFSTR (kAUPresetExternalFileRefs);
|
||||
|
||||
|
||||
const void* frVal = CFDictionaryGetValue(parent, kFRString);
|
||||
if (!frVal) return kAudioUnitErr_InvalidPropertyValue;
|
||||
|
||||
const void* frString = CFDictionaryGetValue ((CFDictionaryRef)frVal, frKey);
|
||||
if (!frString) return kAudioUnitErr_InvalidPropertyValue;
|
||||
|
||||
|
||||
if (fPath)
|
||||
*fPath = (CFStringRef)frString;
|
||||
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ CFMutableDictionaryRef CreateFileRefDict (CFStringRef fKey, CFStringRef fPath, C
|
||||
fileRefDict = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
|
||||
CFDictionarySetValue (fileRefDict, fKey, fPath);
|
||||
|
||||
|
||||
return fileRefDict;
|
||||
}
|
||||
|
||||
@@ -113,11 +113,11 @@ void PrintAUParamEvent (AudioUnitParameterEvent& event, FILE* f)
|
||||
fprintf (f, "\tEvent Type:%s,", (isRamp ? "ramp" : "immediate"));
|
||||
if (isRamp)
|
||||
fprintf (f, "start=%ld,dur=%ld,startValue=%f,endValue=%f\n",
|
||||
(long)event.eventValues.ramp.startBufferOffset, (long)event.eventValues.ramp.durationInFrames,
|
||||
(long)event.eventValues.ramp.startBufferOffset, (long)event.eventValues.ramp.durationInFrames,
|
||||
event.eventValues.ramp.startValue, event.eventValues.ramp.endValue);
|
||||
else
|
||||
fprintf (f, "start=%ld,value=%f\n",
|
||||
(long)event.eventValues.immediate.bufferOffset,
|
||||
fprintf (f, "start=%ld,value=%f\n",
|
||||
(long)event.eventValues.immediate.bufferOffset,
|
||||
event.eventValues.immediate.value);
|
||||
fprintf (f, "- - - - - - - - - - - - - - - -\n");
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUBaseHelper.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUBaseHelper_h__
|
||||
#define __AUBaseHelper_h__
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUBuffer.cpp
|
||||
Abstract: AUBuffer.h
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#include "AUBuffer.h"
|
||||
#include <stdlib.h>
|
||||
@@ -58,10 +58,10 @@ AUBufferList::~AUBufferList()
|
||||
static UInt32 SafeMultiplyAddUInt32(UInt32 a, UInt32 b, UInt32 c)
|
||||
{
|
||||
if (a == 0 || b == 0) return c; // prevent zero divide
|
||||
|
||||
|
||||
if (a > (0xFFFFFFFF - c) / b)
|
||||
throw std::bad_alloc();
|
||||
|
||||
|
||||
return a * b + c;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ AudioBufferList & AUBufferList::PrepareBuffer(const CAStreamBasicDescription &fo
|
||||
if (nStreams > mAllocatedStreams)
|
||||
COMPONENT_THROW(kAudioUnitErr_FormatNotSupported);
|
||||
}
|
||||
|
||||
|
||||
AudioBufferList *abl = mPtrs;
|
||||
abl->mNumberBuffers = nStreams;
|
||||
AudioBuffer *buf = abl->mBuffers;
|
||||
@@ -187,7 +187,7 @@ void AUBufferList::UseExternalBuffer(const CAStreamBasicDescription &format, co
|
||||
Byte *oldMemory = mMemory;
|
||||
mMemory = buf.buffer;
|
||||
mAllocatedBytes = alignedSize;
|
||||
// from Allocate(): nBytes = nStreams * nFrames * format.mBytesPerFrame;
|
||||
// from Allocate(): nBytes = nStreams * nFrames * format.mBytesPerFrame;
|
||||
// thus: nFrames = nBytes / (nStreams * format.mBytesPerFrame)
|
||||
mAllocatedFrames = mAllocatedBytes / (format.NumberChannelStreams() * format.mBytesPerFrame);
|
||||
mExternalMemory = true;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
File: AUBuffer.h
|
||||
Abstract: Part of CoreAudio Utility Classes
|
||||
Version: 1.1
|
||||
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
@@ -25,13 +25,13 @@
|
||||
implied, are granted by Apple herein, including but not limited to any
|
||||
patent rights that may be infringed by your derivative works or by other
|
||||
works in which the Apple Software may be incorporated.
|
||||
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -40,9 +40,9 @@
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Copyright (C) 2014 Apple Inc. All Rights Reserved.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef __AUBuffer_h__
|
||||
#define __AUBuffer_h__
|
||||
@@ -75,7 +75,7 @@ class AUBufferList {
|
||||
};
|
||||
public:
|
||||
/*! @ctor AUBufferList */
|
||||
AUBufferList() : mPtrState(kPtrsInvalid), mExternalMemory(false), mPtrs(NULL), mMemory(NULL),
|
||||
AUBufferList() : mPtrState(kPtrsInvalid), mExternalMemory(false), mPtrs(NULL), mMemory(NULL),
|
||||
mAllocatedStreams(0), mAllocatedFrames(0), mAllocatedBytes(0) { }
|
||||
/*! @dtor ~AUBufferList */
|
||||
~AUBufferList();
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
memcpy(mPtrs, &abl, (char *)&abl.mBuffers[abl.mNumberBuffers] - (char *)&abl);
|
||||
return *mPtrs;
|
||||
}
|
||||
|
||||
|
||||
/*! @method SetBuffer */
|
||||
void SetBuffer(UInt32 index, const AudioBuffer &ab) {
|
||||
if (mPtrState == kPtrsInvalid || index >= mPtrs->mNumberBuffers)
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
COMPONENT_THROW(-1);
|
||||
memcpy(&abl, mPtrs, (char *)&abl.mBuffers[abl.mNumberBuffers] - (char *)&abl);
|
||||
}
|
||||
|
||||
|
||||
/*! @method CopyBufferContentsTo */
|
||||
void CopyBufferContentsTo(AudioBufferList &abl) const {
|
||||
if (mPtrState == kPtrsInvalid)
|
||||
@@ -134,12 +134,12 @@ public:
|
||||
destbuf->mDataByteSize = srcbuf->mDataByteSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*! @method Allocate */
|
||||
void Allocate(const CAStreamBasicDescription &format, UInt32 nFrames);
|
||||
/*! @method Deallocate */
|
||||
void Deallocate();
|
||||
|
||||
|
||||
/*! @method UseExternalBuffer */
|
||||
void UseExternalBuffer(const CAStreamBasicDescription &format, const AudioUnitExternalBuffer &buf);
|
||||
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
|
||||
/*! @method GetAllocatedFrames */
|
||||
UInt32 GetAllocatedFrames() const { return mAllocatedFrames; }
|
||||
|
||||
|
||||
private:
|
||||
/*! @ctor AUBufferList */
|
||||
AUBufferList(AUBufferList &) { } // prohibit copy constructor
|
||||
@@ -184,34 +184,34 @@ private:
|
||||
template <class T>
|
||||
class TAUBuffer {
|
||||
public:
|
||||
enum {
|
||||
enum {
|
||||
kAlignInterval = 0x10,
|
||||
kAlignMask = kAlignInterval - 1
|
||||
};
|
||||
|
||||
|
||||
/*! @ctor TAUBuffer.0 */
|
||||
TAUBuffer() : mMemObject(NULL), mAlignedBuffer(NULL), mBufferSizeBytes(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*! @ctor TAUBuffer.1 */
|
||||
TAUBuffer(UInt32 numElems, UInt32 numChannels) : mMemObject(NULL), mAlignedBuffer(NULL),
|
||||
mBufferSizeBytes(0)
|
||||
{
|
||||
Allocate(numElems, numChannels);
|
||||
}
|
||||
|
||||
|
||||
/*! @dtor ~TAUBuffer */
|
||||
~TAUBuffer()
|
||||
{
|
||||
Deallocate();
|
||||
}
|
||||
|
||||
|
||||
/*! @method Allocate */
|
||||
void Allocate(UInt32 numElems) // can also re-allocate
|
||||
{
|
||||
UInt32 reqSize = numElems * sizeof(T);
|
||||
|
||||
|
||||
if (mMemObject != NULL && reqSize == mBufferSizeBytes)
|
||||
return; // already allocated
|
||||
|
||||
@@ -230,28 +230,28 @@ public:
|
||||
{
|
||||
if (mMemObject == NULL) return; // so this method has no effect if we're using
|
||||
// an external buffer
|
||||
|
||||
|
||||
free(mMemObject);
|
||||
mMemObject = NULL;
|
||||
mAlignedBuffer = NULL;
|
||||
mBufferSizeBytes = 0;
|
||||
}
|
||||
|
||||
|
||||
/*! @method AllocateClear */
|
||||
void AllocateClear(UInt32 numElems) // can also re-allocate
|
||||
{
|
||||
Allocate(numElems);
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
/*! @method Clear */
|
||||
void Clear()
|
||||
{
|
||||
memset(mAlignedBuffer, 0, mBufferSizeBytes);
|
||||
}
|
||||
|
||||
|
||||
// accessors
|
||||
|
||||
|
||||
/*! @method operator T *()@ */
|
||||
operator T *() { return mAlignedBuffer; }
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user