1 #include "adeviceprefs.h"
2 #include "adrivermenu.h"
3 #include "audioconfig.h"
4 #include "audiodevice.inc"
5 #include "audiooutprefs.h"
8 #include "edlsession.h"
10 #include "preferences.h"
14 #define _(String) gettext(String)
15 #define gettext_noop(String) String
16 #define N_(String) gettext_noop (String)
19 AudioOutPrefs::AudioOutPrefs(MWindow *mwindow, PreferencesWindow *pwindow)
20 : PreferencesDialog(mwindow, pwindow)
28 AudioOutPrefs::~AudioOutPrefs()
31 mwindow->defaults->update("PLAYBACK_HEAD", (int)current_head);
36 int AudioOutPrefs::create_objects()
40 BC_PopupTextBox *popup;
42 //printf("AudioOutPrefs::create_objects 1\n");
43 current_head = mwindow->defaults->get("PLAYBACK_HEAD", 0);
44 strategies.append(new BC_ListBoxItem(_("Local Host")));
45 strategies.append(new BC_ListBoxItem(_("Multihead")));
46 strategies.append(new BC_ListBoxItem(_("Blond Symphony")));
48 // add_subwindow(new BC_Title(x, y, _("Playback"), LARGEFONT, BLACK));
50 // add_subwindow(new BC_Title(x, y, _("Strategy:")));
51 // popup = new PlaybackStrategy(this, x + 70, y);
52 // popup->create_objects();
54 // y += popup->get_h() + 30;
56 // Global playback options
58 // All strategies use these
59 add_subwindow(new BC_Title(x, y, _("Audio Out"), LARGEFONT, BLACK));
61 add_subwindow(new BC_Title(x, y, _("Samples to read from disk at a time:"), MEDIUMFONT, BLACK));
62 sprintf(string, "%d", pwindow->thread->edl->session->audio_read_length);
63 add_subwindow(new PlaybackReadLength(x + 275, y, pwindow, this, string));
65 add_subwindow(new BC_Title(x, y, _("Samples to send to console at a time:"), MEDIUMFONT, BLACK));
66 sprintf(string, "%d", pwindow->thread->edl->session->audio_module_fragment);
67 add_subwindow(new PlaybackModuleFragment(x + 275, y, pwindow, this, string));
69 add_subwindow(new PlaybackDisableNoEdits(pwindow, pwindow->thread->edl->session->test_playback_edits, y));
71 add_subwindow(new PlaybackViewFollows(pwindow, pwindow->thread->edl->session->view_follows_playback, y));
73 add_subwindow(new PlaybackSoftwareTimer(pwindow, pwindow->thread->edl->session->playback_software_position, y));
75 add_subwindow(new PlaybackRealTime(pwindow, pwindow->thread->edl->session->real_time_playback, y));
77 add_subwindow(new BC_Title(x, y, _("Audio Driver:")));
78 audio_device = new ADevicePrefs(x + 100,
82 current_config()->aconfig,
85 audio_device->initialize();
87 // Strategic playback options created here
88 set_strategy(pwindow->thread->edl->session->playback_strategy);
90 // add_subwindow(new BC_Title(x, y, _("Playback driver:"), MEDIUMFONT, BLACK));
91 // add_subwindow(new AudioDriverMenu(x, y + 20, out_device, &(pwindow->thread->preferences->aconfig->audio_out_driver), 0, 1));
97 char* AudioOutPrefs::strategy_to_string(int strategy)
101 case PLAYBACK_LOCALHOST:
102 return _("Local Host");
104 case PLAYBACK_MULTIHEAD:
105 return _("Multihead");
107 case PLAYBACK_BLONDSYMPHONY:
108 return _("Blond Symphony");
111 return _("Local Host");
114 // Delete strategy dependant objects
115 void AudioOutPrefs::delete_strategy()
131 delete head_count_title;
132 delete head_count_text;
137 delete vdevice_title;
143 int AudioOutPrefs::set_strategy(int strategy)
145 int x = 350, x1 = 450, y = 10;
148 pwindow->thread->edl->session->playback_strategy = strategy;
151 case PLAYBACK_LOCALHOST:
153 case PLAYBACK_MULTIHEAD:
154 add_subwindow(head_title = new BC_Title(x, y, _("Head:")));
155 head_text = new PlaybackHead(this, x1, y);
156 head_text->create_objects();
158 add_subwindow(head_count_title = new BC_Title(x, y, _("Total Heads:")));
159 head_count_text = new PlaybackHeadCount(this, x1, y);
160 head_count_text->create_objects();
163 add_subwindow(vdevice_title = new BC_Title(x, y, _("Video Driver:")));
164 video_device = new VDevicePrefs(x + 100,
168 current_config()->vconfig,
171 video_device->initialize();
173 case PLAYBACK_BLONDSYMPHONY:
174 add_subwindow(head_title = new BC_Title(x, y, _("Head:")));
175 head_text = new PlaybackHead(this, x1, y);
176 head_text->create_objects();
178 add_subwindow(head_count_title = new BC_Title(x, y, _("Total Heads:")));
179 head_count_text = new PlaybackHeadCount(this, x1, y);
180 head_count_text->create_objects();
182 add_subwindow(host_title = new BC_Title(x, y, _("Hostname:")));
183 add_subwindow(host_text = new PlaybackHost(this, x1, y));
186 add_subwindow(vdevice_title = new BC_Title(x, y, _("Video Driver:")));
187 video_device = new VDevicePrefs(x + 100,
191 current_config()->vconfig,
194 video_device->initialize();
201 ArrayList<PlaybackConfig*>* AudioOutPrefs::current_config_list()
203 return &pwindow->thread->edl->session->playback_config[pwindow->thread->edl->session->playback_strategy];
206 PlaybackConfig* AudioOutPrefs::current_config()
208 return current_config_list()->values[current_head];
213 int AudioOutPrefs::get_buffer_bytes()
215 // return pwindow->thread->edl->aconfig->oss_out_bits / 8 * pwindow->thread->preferences->aconfig->oss_out_channels * pwindow->thread->preferences->playback_buffer;
223 PlaybackStrategy::PlaybackStrategy(AudioOutPrefs *prefs,
226 : BC_PopupTextBox(prefs,
228 prefs->strategy_to_string(prefs->pwindow->thread->edl->session->playback_strategy),
237 int PlaybackStrategy::handle_event()
239 prefs->set_strategy(get_number());
247 PlaybackHead::PlaybackHead(AudioOutPrefs *prefs,
250 : BC_TumbleTextBox(prefs,
253 prefs->current_config_list()->total - 1,
261 int PlaybackHead::handle_event()
266 PlaybackHeadCount::PlaybackHeadCount(AudioOutPrefs *prefs,
269 : BC_TumbleTextBox(prefs,
270 prefs->current_config_list()->total,
280 int PlaybackHeadCount::handle_event()
287 PlaybackHost::PlaybackHost(AudioOutPrefs *prefs, int x, int y)
288 : BC_TextBox(x, y, 100, 1, prefs->current_config()->hostname)
293 int PlaybackHost::handle_event()
295 strcpy(prefs->current_config()->hostname, get_text());
302 PlaybackReadLength::PlaybackReadLength(int x, int y, PreferencesWindow *pwindow, AudioOutPrefs *playback, char *text)
303 : BC_TextBox(x, y, 100, 1, text)
305 this->pwindow = pwindow;
306 this->playback = playback;
309 int PlaybackReadLength::handle_event()
311 pwindow->thread->edl->session->audio_read_length = atol(get_text());
318 PlaybackModuleFragment::PlaybackModuleFragment(int x, int y, PreferencesWindow *pwindow, AudioOutPrefs *playback, char *text)
319 : BC_TextBox(x, y, 100, 1, text)
321 this->pwindow = pwindow;
324 int PlaybackModuleFragment::handle_event()
326 pwindow->thread->edl->session->audio_module_fragment = atol(get_text());
333 PlaybackBufferSize::PlaybackBufferSize(int x, int y, PreferencesWindow *pwindow, AudioOutPrefs *playback, char *text)
334 : BC_TextBox(x, y, 100, 1, text)
336 this->pwindow = pwindow;
337 this->playback = playback;
340 int PlaybackBufferSize::handle_event()
342 pwindow->thread->edl->session->playback_buffer = atol(get_text());
346 PlaybackBufferBytes::PlaybackBufferBytes(int x, int y, PreferencesWindow *pwindow, AudioOutPrefs *playback, char *text)
347 : BC_Title(x, y, text)
349 this->pwindow = pwindow;
350 this->playback = playback;
352 int PlaybackBufferBytes::update_bytes()
354 sprintf(string, "%d", playback->get_buffer_bytes());
359 PlaybackDisableNoEdits::PlaybackDisableNoEdits(PreferencesWindow *pwindow, int value, int y)
360 : BC_CheckBox(10, y, value, _("Disable tracks when no edits."))
362 this->pwindow = pwindow;
365 int PlaybackDisableNoEdits::handle_event()
367 pwindow->thread->edl->session->test_playback_edits = get_value();
374 PlaybackViewFollows::PlaybackViewFollows(PreferencesWindow *pwindow, int value, int y)
375 : BC_CheckBox(10, y, value, _("View follows playback"))
377 this->pwindow = pwindow;
380 int PlaybackViewFollows::handle_event()
382 pwindow->thread->edl->session->view_follows_playback = get_value();
389 PlaybackSoftwareTimer::PlaybackSoftwareTimer(PreferencesWindow *pwindow, int value, int y)
390 : BC_CheckBox(10, y, value, _("Use software for positioning information"))
392 this->pwindow = pwindow;
395 int PlaybackSoftwareTimer::handle_event()
397 pwindow->thread->edl->session->playback_software_position = get_value();
404 PlaybackRealTime::PlaybackRealTime(PreferencesWindow *pwindow, int value, int y)
405 : BC_CheckBox(10, y, value, _("Audio playback in real time priority (root only)"))
407 this->pwindow = pwindow;
410 int PlaybackRealTime::handle_event()
412 pwindow->thread->edl->session->real_time_playback = get_value();