You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
142 lines
4.6 KiB
142 lines
4.6 KiB
#!/usr/bin/env python3
|
|
"""
|
|
Test script to verify the application components work without launching GUI.
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
|
|
# Add the project root to Python path
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
def test_core_modules():
|
|
"""Test core application modules"""
|
|
print("Testing core modules...")
|
|
|
|
try:
|
|
from core.midi_channel_manager import MIDIChannelManager
|
|
channel_manager = MIDIChannelManager()
|
|
print(" - MIDI Channel Manager: OK")
|
|
|
|
from core.volume_pattern_engine import VolumePatternEngine
|
|
volume_engine = VolumePatternEngine()
|
|
print(" - Volume Pattern Engine: OK")
|
|
|
|
from core.synth_router import SynthRouter
|
|
synth_router = SynthRouter(channel_manager)
|
|
print(" - Synth Router: OK")
|
|
|
|
from simulator.simulator_engine import SimulatorEngine
|
|
simulator = SimulatorEngine()
|
|
print(" - Simulator Engine: OK")
|
|
|
|
from core.output_manager import OutputManager
|
|
output_manager = OutputManager(simulator)
|
|
print(" - Output Manager: OK")
|
|
|
|
from core.arpeggiator_engine import ArpeggiatorEngine
|
|
arpeggiator = ArpeggiatorEngine(channel_manager, synth_router, volume_engine, output_manager)
|
|
print(" - Arpeggiator Engine: OK")
|
|
|
|
return True, (channel_manager, volume_engine, synth_router, simulator, output_manager, arpeggiator)
|
|
|
|
except Exception as e:
|
|
print(f" - Error: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
return False, None
|
|
|
|
def test_functionality(components):
|
|
"""Test basic functionality"""
|
|
print("\nTesting functionality...")
|
|
|
|
channel_manager, volume_engine, synth_router, simulator, output_manager, arpeggiator = components
|
|
|
|
try:
|
|
# Test channel manager
|
|
channel_manager.set_active_synth_count(4)
|
|
channel_manager.set_channel_instrument(1, 10) # Drum kit
|
|
print(" - Channel management: OK")
|
|
|
|
# Test volume patterns
|
|
volume_engine.set_pattern("swell")
|
|
volume_engine.set_pattern_speed(1.5)
|
|
volumes = volume_engine.get_all_channel_volumes(4)
|
|
print(f" - Volume patterns: OK (generated {len(volumes)} channel volumes)")
|
|
|
|
# Test arpeggiator
|
|
arpeggiator.set_root_note(60) # Middle C
|
|
arpeggiator.set_scale("major")
|
|
arpeggiator.set_pattern_type("up")
|
|
arpeggiator.set_tempo(120)
|
|
print(" - Arpeggiator settings: OK")
|
|
|
|
# Test note handling (without starting playback)
|
|
arpeggiator.note_on(60) # C
|
|
arpeggiator.note_on(64) # E
|
|
arpeggiator.note_on(67) # G
|
|
print(f" - Note input: OK (holding {len(arpeggiator.held_notes)} notes)")
|
|
|
|
# Test simulator
|
|
simulator.play_note(1, 60, 80)
|
|
simulator.stop_note(1, 60)
|
|
print(" - Simulator playback: OK")
|
|
|
|
return True
|
|
|
|
except Exception as e:
|
|
print(f" - Functionality error: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
return False
|
|
|
|
def test_maschine_integration():
|
|
"""Test Maschine integration (without actual hardware)"""
|
|
print("\nTesting Maschine integration...")
|
|
|
|
try:
|
|
from maschine.maschine_interface import MaschineInterface
|
|
from maschine.maschine_controller import MaschineController
|
|
|
|
# Note: This won't actually connect without hardware
|
|
maschine_interface = MaschineInterface()
|
|
print(" - Maschine Interface: OK")
|
|
|
|
# Test finding devices (will return empty list without hardware)
|
|
inputs, outputs = maschine_interface.find_maschine_devices()
|
|
print(f" - Device detection: OK (found {len(inputs)} inputs, {len(outputs)} outputs)")
|
|
|
|
return True
|
|
|
|
except Exception as e:
|
|
print(f" - Maschine integration error: {e}")
|
|
return False
|
|
|
|
def main():
|
|
"""Run all tests"""
|
|
print("MIDI Arpeggiator - Application Test")
|
|
print("=" * 40)
|
|
|
|
# Test core modules
|
|
success, components = test_core_modules()
|
|
if not success:
|
|
print("\nCore module test failed!")
|
|
return 1
|
|
|
|
# Test functionality
|
|
if not test_functionality(components):
|
|
print("\nFunctionality test failed!")
|
|
return 1
|
|
|
|
# Test Maschine integration
|
|
test_maschine_integration()
|
|
|
|
print("\n" + "=" * 40)
|
|
print("All tests completed successfully!")
|
|
print("\nYour application is ready to run!")
|
|
print("Execute: python run.py")
|
|
|
|
return 0
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|